shoneZ89
(Nenad Z)
August 15, 2014, 7:14pm
1
Acceptance tests that comes with basic template fail when you run them. Functional and unit passes.
So when you try to run acceptance tests, they will fail on first step if you haven’t run php built in web server. I have xampp runing on Linux, but I can not run acceptance tests if I do not run php 5.4 built in one. ( Can you change this somehow ? ).
After you run this php server, then all tests will fail on second step. For example:
$I->see('About', 'h1')
will fail. If you remove ‘h1’ it will pass, but then it will fail at next step. All tests behave like this. For example contact page test will fail to submitt the contact form because it do not see contact submit button. It seems like codeception have a trouble to parse main.php layout.
Can you please investigate this ? I got no idea what can be the problem.
samdark
(Alexander Makarov)
August 15, 2014, 7:20pm
2
There was a problem with Codeception (it uses Symfony components and these were broken again) so try updating.
shoneZ89
(Nenad Z)
August 15, 2014, 7:23pm
3
I am using the latest version
shoneZ89
(Nenad Z)
August 15, 2014, 8:00pm
4
I have solved the problem. If you edit the acceptance.suite.yml file to not use php 5.4 localhost port of 8080, and use your normal lampp server, acceptance tests will pass. So inside
basic/tests/acceptance.suite.yml
file, on line 22, change the "url" to :
'http://localhost'
shoneZ89
(Nenad Z)
August 23, 2014, 4:53pm
5
Acceptance tests fail again, now even with apache server.
php server report these errors for all test tries:
[Sat Aug 23 18:33:15 2014] 127.0.0.1:55475 [404]: /frontend/web/index-test.php/site/contact - No such file or directory
I have htaccess file from the guide, and new yii2-app-advanced.
EDIT:
errors when running apache:
Can’t be on page “/frontend/web/index-test.php”:
GuzzleHttp\Exception\RequestException: cURL error 56: Problem (2) in the Chunked-Encoded data
samdark
(Alexander Makarov)
August 23, 2014, 9:33pm
6
Can you visit the same page using browser?
shoneZ89
(Nenad Z)
August 23, 2014, 9:34pm
7
Yes, app works fine. Only acceptance tests fail.
samdark
(Alexander Makarov)
August 24, 2014, 10:33pm
8
shoneZ89
(Nenad Z)
August 24, 2014, 10:54pm
9
http://localhost:8080/basic/web/index-test.php/site/contact
Runs just fine. Same for advanced.
EDIT:
Here is the full error I get when I run codecept run acceptance --verbose -vvv ( for LoginCept )
4) Failed to ensure that login works in LoginCept (/opt/lampp/htdocs/basic/tests/codeception/acceptance/LoginCept.php)
Couldn't see "Login","h1":
Failed asserting that any element by 'h1' on page /index-test.php/site/login
+ <h1>Not Found</h1>
contains text 'Login'
Scenario Steps:
2. I see "Login","h1"
1. I am on page "/index-test.php/site/login"
[PHPUnit_Framework_ExpectationFailedException] Failed asserting that any element by 'h1' on page \<bold>/index-test.php/site/login\</bold>
+ \<info>\<h1>Not Found\</h1>\</info>
contains text 'Login'
#0 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/Constraint.php(99): Codeception\PHPUnit\Constraint\Crawler->fail(Object(Symfony\Component\DomCrawler\Crawler), 'h1')
#1 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/Assert.php(2218): PHPUnit_Framework_Constraint->evaluate(Object(Symfony\Component\DomCrawler\Crawler), 'h1')
#2 phar:///usr/local/bin/codecept/src/Codeception/Util/Shared/Asserts.php(210): PHPUnit_Framework_Assert::assertThat(Object(Symfony\Component\DomCrawler\Crawler), Object(Codeception\PHPUnit\Constraint\Crawler), 'h1')
#3 phar:///usr/local/bin/codecept/src/Codeception/Lib/InnerBrowser.php(866): Codeception\Module->assertThat(Object(Symfony\Component\DomCrawler\Crawler), Object(Codeception\PHPUnit\Constraint\Crawler), 'h1')
#4 phar:///usr/local/bin/codecept/src/Codeception/Lib/InnerBrowser.php(150): Codeception\Lib\InnerBrowser->assertDomContains(Object(Symfony\Component\DomCrawler\Crawler), 'h1', 'Login')
#5 [internal function]: Codeception\Lib\InnerBrowser->see('Login', 'h1')
#6 phar:///usr/local/bin/codecept/src/Codeception/Step.php(125): call_user_func_array(Array, Array)
#7 phar:///usr/local/bin/codecept/src/Codeception/TestCase/Shared/Actor.php(67): Codeception\Step->run()
#8 phar:///usr/local/bin/codecept/src/Codeception/Scenario.php(93): Codeception\TestCase\Cept->runStep(Object(Codeception\Step\Assertion))
#9 /opt/lampp/htdocs/basic/tests/codeception/acceptance/AcceptanceTester.php(217): Codeception\Scenario->runStep(Object(Codeception\Step\Assertion))
#10 /opt/lampp/htdocs/basic/tests/codeception/acceptance/LoginCept.php(10): AcceptanceTester->see('Login', 'h1')
#11 phar:///usr/local/bin/codecept/src/Codeception/TestCase/Cept.php(64): require('/opt/lampp/htdo...')
#12 [internal function]: Codeception\TestCase\Cept->testCodecept()
#13 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(963): ReflectionMethod->invokeArgs(Object(Codeception\TestCase\Cept), Array)
#14 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(835): PHPUnit_Framework_TestCase->runTest()
#15 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestResult.php(643): PHPUnit_Framework_TestCase->runBare()
#16 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(771): PHPUnit_Framework_TestResult->run(Object(Codeception\TestCase\Cept))
#17 phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestSuite.php(703): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#18 phar:///usr/local/bin/codecept/src/Codeception/PHPUnit/Runner.php(100): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#19 phar:///usr/local/bin/codecept/src/Codeception/SuiteManager.php(153): Codeception\PHPUnit\Runner->doEnhancedRun(Object(PHPUnit_Framework_TestSuite), Object(PHPUnit_Framework_TestResult), Array)
#20 phar:///usr/local/bin/codecept/src/Codeception/Codecept.php(162): Codeception\SuiteManager->run(Object(Codeception\PHPUnit\Runner), Object(PHPUnit_Framework_TestResult), Array)
#21 phar:///usr/local/bin/codecept/src/Codeception/Codecept.php(145): Codeception\Codecept->runSuite(Array, 'acceptance', NULL)
#22 phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php(255): Codeception\Codecept->run('acceptance')
#23 phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php(183): Codeception\Command\Run->runSuites(Array, Array)
#24 phar:///usr/local/bin/codecept/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Codeception\Command\Run->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 phar:///usr/local/bin/codecept/vendor/symfony/console/Symfony/Component/Console/Application.php(889): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 phar:///usr/local/bin/codecept/vendor/symfony/console/Symfony/Component/Console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Codeception\Command\Run), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 phar:///usr/local/bin/codecept/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 phar:///usr/local/bin/codecept/codecept(34): Symfony\Component\Console\Application->run()
#29 /usr/local/bin/codecept(7): require_once('phar:///usr/loc...')
#30 {main}
samdark
(Alexander Makarov)
August 25, 2014, 9:55am
10
Well, you should run webserver at apps/basic/web, not at the very root. URL should be http://localhost:8080/index-test.php/site/contact
shoneZ89
(Nenad Z)
August 25, 2014, 11:15am
11
If I do it like that, I can run basic template tests. If I start php server inside advanced/frontend/web, acceptance tests still fail. The biggest problem is that in both basic and advanced templates acceptance tests fail when I am using lamp stack. I have some older version of basic template wich works flawless with lamp stack, and I remember advanced was working too, but I lost that version of advanced.
EDIT: I just figured out that in advanced template you have to start php server inside advanced folder in order for acceptance tests to work. At least I can run them now, but too bad it doesnt work with just the lamp stack. I will try to figure out what is wrong there.
samdark
(Alexander Makarov)
August 25, 2014, 1:12pm
12