We have written come acceptance tests in the last tutorial. Time to run them on the cloud. No way I would spend 10 minutes to wait for my tests ran for multiple PHP and WordPress versions. Continue from the last tutorial, I’ve removed some unused pieces and added PHP_CodeSniffer to the project. Nothing related to acceptance testing. Head over to the GitHub repo if you are interested.
A problem I found is that the tests failed randomly. The reason is that our tests tries to click some links before they show up on the screen. Adding $I->waitForElement(‘some element’, 10); solves the problem.
Secondly, when changing the screen size, the link
Acceptance Test for rmcl fails out of the screen. Adding
$I->click(‘Acceptance Test for rmcl’); solves it.
$I->scrollTo([‘css’ => ‘h2.entry-title’]);
You can run the tests on real browsers on TravisCI with Sauce Labs. But it’s too slow for me. I opt for PhantomJS instead.
The Selenium server I used the last tutorial becomes buggy. I switched to use PhantomJS lately.
$ composer require –dev jakoch/phantomjs-installer neronmoon/scriptsdev site5/phantoman