Acceptance + Robo task
- added $file argument to test:acceptance - updated test:unit's argument name for consistency - beefing up form widget acceptance test
This commit is contained in:
10
RoboFile.php
10
RoboFile.php
@@ -55,7 +55,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$this->_exec(join(' ', array(
|
$this->_exec(join(' ', array(
|
||||||
'./node_modules/stylus/bin/stylus',
|
'./node_modules/stylus/bin/stylus',
|
||||||
'--include ./node_modules',
|
'--include ./node_modules',
|
||||||
'--include-css',
|
'--include-css',
|
||||||
'-u nib',
|
'-u nib',
|
||||||
join(' ', $this->css_files),
|
join(' ', $this->css_files),
|
||||||
'-o assets/css/'
|
'-o assets/css/'
|
||||||
@@ -76,13 +76,13 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testUnit($singleUnit = null) {
|
function testUnit($file = null) {
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
$this->_exec('vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
$this->_exec('vendor/bin/codecept run unit ' . (($singleUnit) ? $singleUnit : ''));
|
$this->_exec('vendor/bin/codecept run unit '.(($file) ? $file : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAcceptance() {
|
function testAcceptance($file = null) {
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
$this->compileAll();
|
$this->compileAll();
|
||||||
$this->_exec('vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
@@ -91,7 +91,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->background()
|
->background()
|
||||||
->run();
|
->run();
|
||||||
sleep(2);
|
sleep(2);
|
||||||
$this->_exec('vendor/bin/codecept run acceptance');
|
$this->_exec('vendor/bin/codecept run acceptance '.(($file) ? $file : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testJavascript() {
|
function testJavascript() {
|
||||||
|
@@ -6,36 +6,65 @@ class FormWidgetCest {
|
|||||||
$I->login();
|
$I->login();
|
||||||
}
|
}
|
||||||
|
|
||||||
function iCanAddAWidget(AcceptanceTester $I) {
|
function iCanAddTheWidget(AcceptanceTester $I) {
|
||||||
$I->amOnPage('/wp-admin/widgets.php');
|
$I->amOnPage('/wp-admin/widgets.php');
|
||||||
$I->see('MailPoet Subscription Form');
|
|
||||||
|
$I->see('MailPoet Subscription Form', '#widgets-left');
|
||||||
|
|
||||||
// select the mailpoet form widget
|
// select the mailpoet form widget
|
||||||
$I->click('#widgets-left div[id*="mailpoet_form"] .widget-title');
|
$I->click('#widgets-left div[id*="mailpoet_form"] .widget-title');
|
||||||
|
|
||||||
// add it as a widget
|
|
||||||
$I->waitForText(
|
$I->waitForText(
|
||||||
'Add Widget',
|
'Add Widget',
|
||||||
1,
|
1,
|
||||||
'#widgets-left div[id*="mailpoet_form"]'
|
'#widgets-left div[id*="mailpoet_form"]'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// add it as a widget
|
||||||
$I->click(
|
$I->click(
|
||||||
'Add Widget',
|
'Add Widget',
|
||||||
'#widgets-left div[id*="mailpoet_form"]'
|
'#widgets-left div[id*="mailpoet_form"]'
|
||||||
);
|
);
|
||||||
|
|
||||||
// wait for the JS animation to end
|
$I->waitForElementVisible(
|
||||||
sleep(1);
|
'#widgets-right div[id*="mailpoet_form"]:last-child '.
|
||||||
|
'input[name="savewidget"]',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
// save the widget
|
// save
|
||||||
$I->click(
|
$I->click(
|
||||||
'Save',
|
'Save',
|
||||||
'#widgets-right div[id*="mailpoet_form"]:last-child'
|
'#widgets-right div[id*="mailpoet_form"]:last-child'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _after(AcceptanceTester $I) {
|
function iSeeTheWidget(AcceptanceTester $I) {
|
||||||
|
$I->amOnPage('/');
|
||||||
|
// make sure we are not in responsive mode
|
||||||
|
$I->resizeWindow(960, 600);
|
||||||
|
|
||||||
|
$I->see('Subscribe to our Newsletter');
|
||||||
|
|
||||||
|
$I->seeElement('.widget_mailpoet_form');
|
||||||
|
$I->seeElement('input', ['name' => 'email']);
|
||||||
|
$I->seeElement('input', ['value' => 'Subscribe!']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iCanDeleteTheWidget(AcceptanceTester $I) {
|
||||||
|
$I->amOnPage('/wp-admin/widgets.php');
|
||||||
|
|
||||||
|
$I->see('MailPoet Subscription Form', '#widgets-right');
|
||||||
|
|
||||||
|
// select an active mailpoet form widget
|
||||||
|
$I->click('#widgets-right div[id*="mailpoet_form"] .widget-action');
|
||||||
|
|
||||||
|
$I->waitForElementVisible(
|
||||||
|
'#widgets-right div[id*="mailpoet_form"]:last-child '.
|
||||||
|
'.widget-control-remove',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
// delete widget
|
// delete widget
|
||||||
$I->click(
|
$I->click(
|
||||||
'Delete',
|
'Delete',
|
||||||
|
Reference in New Issue
Block a user