/**
  * @dataProvider provider
  */
 public function testWalkthrough($filename)
 {
     $test = file_get_contents("walkthroughs/{$filename}");
     $title = $this->randomString();
     $account = $this->createUser();
     $this->login($account->username, $account->password);
     $this->url('walkthrough/import');
     $this->byId('edit-selenium-code')->value($test);
     $this->byId('edit-next')->click();
     $this->byId('edit-title')->value($title);
     $this->byId('edit-body')->value($this->randomString());
     $this->select($this->byId('edit-severity'))->selectOptionByLabel('does not change anything (tour)');
     $this->byId('edit-save')->click();
     // Walkthrough has been created.
     $this->assertEquals($title, $this->byId('page-title')->text());
     // Test screenshotting flag.
     $this->byLinkText('Create screenshots')->click();
     $this->byLinkText('Play')->click();
     $wu = new PHPUnit_Extensions_Selenium2TestCase_WaitUntil($this);
     $self = $this;
     $wu->run(function () use($self) {
         return ($item = $self->byXPath('//div[contains(@class, "walkthrough-start-dialog")]//button[@type="button"]')) ? $item : NULL;
     }, 30000);
     $this->byXPath('//div[contains(@class, "walkthrough-start-dialog")]//button[@type="button"]')->click();
     $this->frame($this->byCssSelector('#ui-id-2'));
     $steps = $this->numberOfSteps($test);
     for ($i = 0; $i <= $steps; $i++) {
         $this->byCssSelector('.wtbubble-next')->click();
     }
     $finish_button = $this->byLinkText('Finish');
     $this->assertTrue((bool) $finish_button, 'Walkthrough did not finish correctly');
 }
示例#2
0
 /**
  * Wait until callback isn't null or timeout occurs
  *
  * @param $callback
  * @param null $timeout
  * @return mixed
  */
 public function waitUntil($callback, $timeout = NULL)
 {
     $waitUntil = new PHPUnit_Extensions_Selenium2TestCase_WaitUntil($this);
     return $waitUntil->run($callback, $timeout);
 }