Closed traveler9878 closed 1 year ago
Taking a look now.
First, you need to update /tests/Acceptance.suite.yml
(details here).
You may have already done that, but when I had you reinstall Codeception the changes were reset. : )
Once you do that, a problem I see in your test code is you're trying to click the submit button like this:
$I->click("test-submit");
Here is the button in question:
<button type='submit' test='submit-button' value='test-submit'>Roll</button>
If you're trying to target that button using the test
attribute, the test code should look like this:
$I->click('[test=submit-button');
(Reference for using custom attributes in testing: https://hesweb.dev/e2/notes/php/testing-codeception#test-the-review-form)
Other things I anticipate creating problems:
Yes because it looks like a configuration problem and the test script isn't seeing the page at all I simplified it and tried using the techniques from the codeception site where they use value= to click submit.
I decided to test the case where the user has not selected a bet and gets the error message since I made the app capable of erroring like that intentionally to be able to demonstrate validation....
Your instructions are way better than the ones on the site by the way. I really appreciate the help you have given everyone along the way in the course and I've registered for your follow on course next spring.
I have to do one elective and my capstone to graduate in May, I was going to do an easy course but I think it's worth the extra effort to continue with this.
With this issue: I stopped when I found that my Test.Acceptance.P3Cest.playGame.fail.html is a 404 html page not my actual page. I did verify that my Acceptance.suite.yml was updated
I'm thinking there is a typo or something in my configuration causing the test not to connect to the index.blade.php page I'm trying to test.
This is the page on condeception where the use an example of assigning a value attribute to a submit button and using that attribute to click and submit, not a good technique in my opinion, but I'm pretty sure my test just isn't seeing my index.blade.php page:
FAILURES! Tests: 1, Assertions: 0, Failures: 1. root@hes:/var/www/e2/p3# more /var/www/e2/p3/tests/_output/Tests.Acceptance.P3Cest.playGame.fail.html
root@hes:/var/www/e2/p3#
FAILURES! Tests: 1, Assertions: 0, Failures: 1. root@hes:/var/www/e2/p3# more /var/www/e2/p3/tests/_output/Tests.Acceptance.P3Cest.playGame.fail.html404 Not Found 404 Not Found
nginx/1.18.0 (Ubuntu) root@hes:/var/www/e2/p3#
Found the typo issue... I started closing pages and the Acceptance.suite.yml wasn't saved after updating the URL. Now getting a "Module Assert could not be found and loaded".... progress
I dropped the tests directory and codeception.yml and ran Bootstrap again. I successfully created the P3Cest file using the codecept command line. I updated the Acceptance.suite.yml and recreated a simple test. Now I'm getting the following:
root@hes:/var/www/e2/p3# php vendor/bin/codecept run Acceptance --steps Codeception PHP Testing Framework v5.0.5 https://helpukrainewin.org
In ModuleContainer.php line 102:
Module Assert - PhpBrowser: url: http://e2p3.davidcurtis.me could not be found and loaded
run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--phpunit-xml [PHPUNIT-XML]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--shard SHARD] [--filter FILTER] [--grep GREP] [--bootstrap [BOOTSTRAP]] [--no-redirect] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-cobertura [COVERAGE-COBERTURA]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast [FAIL-FAST]] [--no-rebuild] [--seed SEED] [--no-artifacts] [--] [
root@hes:/var/www/e2/p3#
solved the above, it was caused by having 2 spaces instead of one between the hyphen and 'Assert': "- Assert" should have been "- Assert". Fixed that now the PHP URL error is gone and the Module Assert could not be found and loaded is back:
actor: AcceptanceTester modules: enabled:
I'd really like to run codeception version 3 where assertions were not installed separately. Is that something worth trying? I know it's the purpose of the composer json to ensure we have a stable version to work with...
lol, i fixed it. Figuring it to be a typo or spacing of some sort, I did a cut and paste from the zipfoods Acceptance.suite.yml file in the notes. Upon making this change, I noticed I was using "Assert" not "Asserts". Pretty sure this was causing the most recent module load failure but there were changes in behavior based on spacing in the .yml file as well. The cut and past resolved all the issues, I did have to remove the line for the helpers because I don't have them in my project.
root@hes:/var/www/e2/p3# php vendor/bin/codecept run Acceptance --steps Codeception PHP Testing Framework v5.0.5 https://helpukrainewin.org
Tests.Acceptance Tests (1) --------------------------------------------------------------------------------------------------------------------------------- P3Cest: Play game Signature: Tests\Acceptance\P3Cest:playGame Test: tests/Acceptance/P3Cest.php:playGame Scenario -- I am on page "/" I click "[test=submit-button]" I see "The value for bet can not be blank" PASSED
Time: 00:00.159, Memory: 10.00 MB
OK (1 test, 1 assertion) root@hes:/var/www/e2/p3#
This was quite the journey! : ) Looks like you got it all sorted out in the end. Way to stick with it.
RE: enrolling in CSCI E-15 - glad to hear it!
Here if you have any additional questions.
typos are the worst...
RE: > typos are the worst...
My kids got me a shirt that says:
SOFTWARE DEVELOPMENT PROCESS
@RobertHolzhauser That's hilarious - I see students (and myself) cycle through those 5 emotions all the time. 😄
Taking a break from working on this for a while, got the test for amOnPage to work and getting not found or malformed errors trying to access page content. checked the output html and it's a 404 file...