Rename SettingsScreenTest to ZSettingsScreenTest

...as an ugly workaround to make this test run last, due to it changing
the whole suite's data, causing other tests to fail.
This commit is contained in:
An Phan 2016-11-24 00:36:41 +08:00
parent 92da6df5ab
commit f52b060fbf
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2
4 changed files with 34 additions and 11 deletions

View file

@ -59,12 +59,18 @@ gulp.task("e2e", function (cb) {
console.log(chalk.green('Running E2E tests'));
console.log(chalk.yellow('Make sure Selenium server with Chrome webdriver is listening on port 4444'));
exec('php artisan serve --port=8081');
var child = exec('phpunit tests/e2e -c phpunit.e2e.xml');
child.stdout.on('data', function(data) {
var tasks = [
'php artisan serve --port=8081',
'phpunit tests/e2e -c phpunit.e2e.xml'
];
tasks.forEach(function (t) {
console.log('Executing ' + chalk.magenta(t));
var child = exec(t);
child.stdout.on('data', function(data) {
process.stdout.write(data);
});
child.stderr.on('data', function(data) {
});
child.stderr.on('data', function(data) {
process.stderr.write(data);
});
});
})
});

View file

@ -24,10 +24,20 @@ class ProfileScreenTest extends TestCase
$avatar = $this->el('a.view-profile img');
// Expect the Gravatar to be updated
static::assertEquals('https://www.gravatar.com/avatar/36df72b4484fed183fad058f30b55d21?s=256', $avatar->getAttribute('src'));
// Check "Confirm Closing" and validate its functionality
$this->click('#profileWrapper input[name="confirmClosing"]');
$this->refresh();
$this->waitUntil(WebDriverExpectedCondition::alertIsPresent());
$this->driver->switchTo()->alert()->accept();
$this->driver->switchTo()->alert()->dismiss();
// Reverse all changes for other tests to not be affected
$this->typeIn('#profileWrapper input[name="name"]', 'Koel Admin');
$this->typeIn('#profileWrapper input[name="email"]', 'koel@example.com');
$this->enter();
$this->see('.sweet-alert');
$this->press(WebDriverKeys::ESCAPE);
$this->notSee('.sweet-alert');
$this->click('#profileWrapper input[name="confirmClosing"]');
}
}

View file

@ -43,7 +43,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
{
parent::__construct();
$this->createApp();
$this->prepareForE2E();
$this->resetData();
$this->driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', DesiredCapabilities::chrome());
$this->driver->manage()->window()->setSize(new WebDriverDimension(1440, 900));
$this->driver->manage()->window()->setPosition(new WebDriverPoint(0, 0));
@ -60,7 +60,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
return $this->app;
}
private function prepareForE2E()
protected function resetData()
{
// Make sure we have a fresh database.
@unlink(__DIR__.'/../../database/e2e.sqlite');
@ -95,7 +95,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
protected function loginAndWait()
{
$this->login();
$this->seeText('Koel Admin', '#userBadge > a.view-profile.control > span');
$this->seeText('Koel Admin', '#userBadge > a.view-profile');
return $this;
}

View file

@ -2,7 +2,14 @@
namespace E2E;
class SettingsScreenTest extends TestCase
/**
* Class ZSettingsScreenTest
* The name is an ugly trick to force this test to run last, due to it changing the whole suite's
* data, causing other tests to fail otherwise.
*
* @package E2E
*/
class ZSettingsScreenTest extends TestCase
{
public function testSettingsScreen()
{