Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My preferred selenium / PHPUnit Configuration:</p> <p>Maintaining integration (selenium) tests can be a lot of work. I use the firefox selenium IDE for developing test cases, which doesn't support exporting test suites to PHPUnit, and only supports individual test cases. As such - if I had to maintain even 5 tests, that'd be a lot of manual work to re-PHPUnit them every time they needed to be updated. <strong>That is why I setup PHPUnit to use Selenium IDE's HTML Test files! They can be reloaded &amp; reused between PHPUnit &amp; selenium IDE</strong> </p> <pre><code>&lt;?php class RunSeleniumTests extends PHPUnit_Extensions_SeleniumTestCase { protected $captureScreenshotOnFailure = true; protected $screenshotPath = 'build/screenshots'; protected $screenshotUrl = "http://localhost/site-under-test/build/screenshots"; //This is where the magic happens! PHPUnit will parse all "selenese" *.html files public static $seleneseDirectory = 'tests/selenium'; protected function setUp() { parent::setUp(); $selenium_running = false; $fp = @fsockopen('localhost', 4444); if ($fp !== false) { $selenium_running = true; fclose($fp); } if (! $selenium_running) $this-&gt;markTestSkipped('Please start selenium server'); //OK to run tests $this-&gt;setBrowser("*firefox"); $this-&gt;setBrowserUrl("http://localhost/"); $this-&gt;setSpeed(0); $this-&gt;start(); //Setup each test case to be logged into WordPress $this-&gt;open('/site-under-test/wp-login.php'); $this-&gt;type('id=user_login', 'admin'); $this-&gt;type('id=user_pass', '1234'); $this-&gt;click('id=wp-submit'); $this-&gt;waitForPageToLoad(); } //No need to write separate tests here - PHPUnit runs them all from the Selenese files stored in the $seleneseDirectory above! } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload