Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test: bats test for Statamic Composer quickstart [skip buildkite]#7116

Merged
stasadev merged 3 commits intoddev:mainfrom
rpkoller:20250317-rpkoller-statamic-bats-test
Mar 19, 2025
Merged

test: bats test for Statamic Composer quickstart [skip buildkite]#7116
stasadev merged 3 commits intoddev:mainfrom
rpkoller:20250317-rpkoller-statamic-bats-test

Conversation

@rpkoller
Copy link
Collaborator

The Issue

  • #

How This PR Solves The Issue

Manual Testing Instructions

Automated Testing Overview

Release/Deployment Notes

@rpkoller rpkoller requested a review from a team as a code owner March 18, 2025 02:48
@rpkoller rpkoller force-pushed the 20250317-rpkoller-statamic-bats-test branch from 82fe721 to 5d83d26 Compare March 18, 2025 03:23
@rfay rfay changed the title test: bats test for Statamic Composer quickstart test: bats test for Statamic Composer quickstart [skip buildkite] Mar 18, 2025
@rpkoller
Copy link
Collaborator Author

the only small detail i am not sure about is why selecting YES in the prompt is not working with expect/send .... when i manually tried, it was enough to press Y (that is what i send in line 37 on the bats test followed by a return key press)... but with automatic bats tests the selection remained on NO... no biggie, that way we dont get a super user which we dont need anyway but i would have been curious why it is not picking up on the entry of y

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only small detail i am not sure about is why selecting YES in the prompt is not working with expect/send

I don't think it's working properly, I don't see any user in the database, I noticed that it creates a file in the users folder, when I run it manually, so:

run ddev php please make:user [email protected] --password=admin1234 --super --no-interaction
assert_file_exist users/[email protected]

@rpkoller
Copy link
Collaborator Author

rpkoller commented Mar 18, 2025

the only small detail i am not sure about is why selecting YES in the prompt is not working with expect/send

I don't think it's working properly, I don't see any user in the database, I noticed that it creates a file in the users folder, when I run it manually, so:

run ddev php please make:user [email protected] --password=admin1234 --super --no-interaction
assert_file_exist users/[email protected]

i am either blind or not able to search properly the net. i searched everywhere if it would be possible not to use the prompt but a command line instead. what you've posted is exactly what i was searching for. that expect and send was buggy and also not really convenient. but there is one problem. when i test locally for assert file exist bats failes on macos with zsh with

  -- file does not exist --
   path : ./users/[email protected]
   --

but the file actually exists... on my manual test as well as commenting out the teardown and then examine the automatic bats output. in both cases the file exists with the proper content within the users directory

@stasadev
Copy link
Member

file does not exist

Probably the same thing as here #7114:

ddev mutagen sync

@rfay
Copy link
Member

rfay commented Mar 18, 2025

@ is a special character in lots of languages. Make sure your assert is protecting it. Or use a wildcard, etc. @ is usually used for array in bash.

@rpkoller
Copy link
Collaborator Author

i've tried escaping the @ but that had no effect. and the error output was the same no matter the @ was escaped or not. so the character was already handled properly. but stas'es suspicion was the right one, a mutagen sync fixed it. i will never ever forget again to sync mutagen after any file was altered or created. thank you!

@rfay rfay requested a review from stasadev March 18, 2025 19:26
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@stasadev stasadev merged commit 2027629 into ddev:main Mar 19, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments