Skip to content

Commit

Permalink
add screenshots & tmp folder
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Nov 6, 2017
1 parent 1ac7553 commit 5e5497a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 10 deletions.
9 changes: 9 additions & 0 deletions tests/TestBaseClass.php
Expand Up @@ -11,6 +11,12 @@ class TestBaseClass extends TestCase
*/
protected static $testHelper = null;

/** @var string $tempFolder*/
protected $tempFolder;

/** @var string $screenshotsFolder */
protected $screenshotsFolder;


/**
* @var int
Expand All @@ -22,6 +28,9 @@ public function setUp()
parent::setUp();
self::$testHelper = new TestHelper();

$this->tempFolder = __DIR__.'/tmp';
$this->screenshotsFolder = $this->tempFolder.'/screenshots';

self::$testHelper->importAll();

}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestBaseClassView.php
Expand Up @@ -38,7 +38,7 @@ protected function findViewTag($name, $view)
$element = null;

$screenshot = $this->webDriver->takeScreenshot();
file_put_contents(__DIR__ . '/tmp/'.$name.'.png', $screenshot);
file_put_contents($this->screenshotsFolder. '/'.$name.'.png', $screenshot);
try {
$element = $this->webDriver->findElement(WebDriverBy::id('action::'.$name));
} catch (\Exception $e) {
Expand Down
8 changes: 4 additions & 4 deletions tests/questions/DateTimeValidationTest.php
Expand Up @@ -80,10 +80,10 @@ public function testBasic()
$submit = $this->webDriver->findElement(WebDriverBy::id('ls-button-submit'));
} catch (NoSuchElementException $ex) {
$screenshot = $this->webDriver->takeScreenshot();
file_put_contents(__DIR__ . '/../tmp/tmp.png', $screenshot);
file_put_contents($this->screenshotsFolder . '/tmp.png', $screenshot);
$this->assertFalse(
true,
'Screenshot in ' . __DIR__ . '/tmp.png' . PHP_EOL . $ex->getMessage()
'Screenshot in ' . $this->screenshotsFolder . '/tmp.png' . PHP_EOL . $ex->getMessage()
);
}

Expand All @@ -105,10 +105,10 @@ public function testBasic()
$this->assertNotEmpty($div);
} catch (NoSuchElementException $ex) {
$screenshot = $this->webDriver->takeScreenshot();
file_put_contents(__DIR__ . '/../tmp/tmp.png', $screenshot);
file_put_contents($this->screenshotsFolder . '/tmp.png', $screenshot);
$this->assertFalse(
true,
'Screenshot in ' . __DIR__ . '/tmp.png' . PHP_EOL . $ex->getMessage()
'Screenshot in ' . $this->screenshotsFolder . '/tmp.png' . PHP_EOL . $ex->getMessage()
);
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/tmp/.gitignore
@@ -1,2 +1,3 @@
*
!screenshots
!.gitignore
2 changes: 2 additions & 0 deletions tests/tmp/screenshots/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 1 addition & 1 deletion third_party/doctrine/instantiator
Submodule instantiator updated from 7af806 to 8e884e
2 changes: 1 addition & 1 deletion third_party/facebook/webdriver
Submodule webdriver updated from e304e7 to d59d2c
2 changes: 1 addition & 1 deletion third_party/phpunit/php-code-coverage
Submodule php-code-coverage updated from 8e1d23 to 117402
2 changes: 1 addition & 1 deletion third_party/phpunit/phpunit-mock-objects
Submodule phpunit-mock-objects updated from fb7702 to a9a136
2 changes: 1 addition & 1 deletion third_party/symfony/process
Submodule process updated from ae1f0f to dce0aa

0 comments on commit 5e5497a

Please sign in to comment.