- Added acceptance tests for the Newsletters page
- Added a shim to make PhantomJS work with React (temporary workaround) - Removed asset compilation during acceptance testing Closes #111
This commit is contained in:
@ -95,7 +95,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
function testAcceptance($file = null) {
|
function testAcceptance($file = null) {
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
$this->compileAll();
|
|
||||||
$this->_exec('vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
$this
|
$this
|
||||||
->taskExec('phantomjs --webdriver=4444')
|
->taskExec('phantomjs --webdriver=4444')
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inherited Methods
|
* Inherited Methods
|
||||||
* @method void wantToTest($text)
|
* @method void wantToTest($text)
|
||||||
@ -15,18 +14,19 @@
|
|||||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD)
|
* @SuppressWarnings(PHPMD)
|
||||||
*/
|
*/
|
||||||
class AcceptanceTester extends \Codeception\Actor
|
class AcceptanceTester extends \Codeception\Actor {
|
||||||
{
|
use _generated\AcceptanceTesterActions;
|
||||||
use _generated\AcceptanceTesterActions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define custom actions here
|
* Define custom actions here
|
||||||
*/
|
*/
|
||||||
public function login() {
|
public function login() {
|
||||||
$this->amOnPage('/wp-login.php');
|
if($this->loadSessionSnapshot('login')) return;
|
||||||
$this->fillField('Username', getenv('WP_TEST_USER'));
|
$this->amOnPage('/wp-login.php');
|
||||||
$this->fillField('Password', getenv('WP_TEST_PASSWORD'));
|
$this->fillField('Username', getenv('WP_TEST_USER'));
|
||||||
$this->click('Log In');
|
$this->fillField('Password', getenv('WP_TEST_PASSWORD'));
|
||||||
}
|
$this->click('Log In');
|
||||||
|
$this->saveSessionSnapshot('login');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Helper\Acceptance;
|
||||||
|
|
||||||
class NewslettersPageCest {
|
class NewslettersPageCest {
|
||||||
|
|
||||||
function _before(AcceptanceTester $I) {
|
function _before(AcceptanceTester $I) {
|
||||||
$I->login();
|
$I->login();
|
||||||
|
$I->resizeWindow(1024, 768);
|
||||||
|
$this->firstElementInList = '//*[@id="newsletters"]/div/div/table/tbody/tr[1]';
|
||||||
|
$this->waitTime = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
function iCanSeeTheTitle(AcceptanceTester $I) {
|
function iCanSeeTheTitle(AcceptanceTester $I) {
|
||||||
@ -11,6 +16,52 @@ class NewslettersPageCest {
|
|||||||
$I->see('Newsletters');
|
$I->see('Newsletters');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function iCanAddNewsletterFromListingPage(AcceptanceTester $I) {
|
||||||
|
$I->see('No newsletters found');
|
||||||
|
$I->click('New', '#newsletters');
|
||||||
|
$I->fillField('Subject', 'first newsletter');
|
||||||
|
$I->fillField('Body', 'some body');
|
||||||
|
$I->click('Save');
|
||||||
|
$I->waitForText('1 item', $this->waitTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanAddNewsletterFromNewNewsletterPage(AcceptanceTester $I) {
|
||||||
|
$I->amOnPage('/wp-admin/admin.php?page=mailpoet-newsletters#/form');
|
||||||
|
$I->fillField('Subject', 'second newsletter');
|
||||||
|
$I->fillField('Body', 'some body');
|
||||||
|
$I->click('Save');
|
||||||
|
$I->waitForText('2 item', $this->waitTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanSortNewsletterBySubject(AcceptanceTester $I) {
|
||||||
|
$I->click('Subject');
|
||||||
|
$I->waitForText('first', $this->waitTime, $this->firstElementInList);
|
||||||
|
$I->click('Subject');
|
||||||
|
$I->waitForText('second', $this->waitTime, $this->firstElementInList);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanSortNewsletterByCreatedDate(AcceptanceTester $I) {
|
||||||
|
$I->click('Created on');
|
||||||
|
$I->waitForText('first', $this->waitTime, $this->firstElementInList);
|
||||||
|
$I->click('Created on');
|
||||||
|
$I->waitForText('second', $this->waitTime, $this->firstElementInList);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanSearchNewsletters(AcceptanceTester $I) {
|
||||||
|
$searchTerm = 'second';
|
||||||
|
$I->fillField('Search', $searchTerm);
|
||||||
|
$I->click('Search');
|
||||||
|
$I->waitForText($searchTerm, $this->waitTime, $this->firstElementInList);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanSeeMobileView(AcceptanceTester $I) {
|
||||||
|
$listingHeadings = '//*[@id="newsletters"]/div/div/table/thead';
|
||||||
|
$I->resizeWindow(640, 480);
|
||||||
|
$I->dontSee('Created on', $listingHeadings);
|
||||||
|
$I->dontSee('Last modified', $listingHeadings);
|
||||||
|
$I->see('Subject', $listingHeadings);
|
||||||
|
}
|
||||||
|
|
||||||
function _after(AcceptanceTester $I) {
|
function _after(AcceptanceTester $I) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<!-- javascripts -->
|
<!-- javascripts -->
|
||||||
<%= javascript(
|
<%= javascript(
|
||||||
|
'acceptance_test_phantomjs_shim.js',
|
||||||
'vendor.js',
|
'vendor.js',
|
||||||
'mailpoet.js',
|
'mailpoet.js',
|
||||||
'admin.js'
|
'admin.js'
|
||||||
|
Reference in New Issue
Block a user