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:
@@ -76,13 +76,13 @@ class RoboFile extends \Robo\Tasks {
|
||||
);
|
||||
}
|
||||
|
||||
function testUnit($singleUnit = null) {
|
||||
function testUnit($file = null) {
|
||||
$this->loadEnv();
|
||||
$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->compileAll();
|
||||
$this->_exec('vendor/bin/codecept build');
|
||||
@@ -91,7 +91,7 @@ class RoboFile extends \Robo\Tasks {
|
||||
->background()
|
||||
->run();
|
||||
sleep(2);
|
||||
$this->_exec('vendor/bin/codecept run acceptance');
|
||||
$this->_exec('vendor/bin/codecept run acceptance '.(($file) ? $file : ''));
|
||||
}
|
||||
|
||||
function testJavascript() {
|
||||
|
@@ -6,36 +6,65 @@ class FormWidgetCest {
|
||||
$I->login();
|
||||
}
|
||||
|
||||
function iCanAddAWidget(AcceptanceTester $I) {
|
||||
function iCanAddTheWidget(AcceptanceTester $I) {
|
||||
$I->amOnPage('/wp-admin/widgets.php');
|
||||
$I->see('MailPoet Subscription Form');
|
||||
|
||||
$I->see('MailPoet Subscription Form', '#widgets-left');
|
||||
|
||||
// select the mailpoet form widget
|
||||
$I->click('#widgets-left div[id*="mailpoet_form"] .widget-title');
|
||||
|
||||
// add it as a widget
|
||||
$I->waitForText(
|
||||
'Add Widget',
|
||||
1,
|
||||
'#widgets-left div[id*="mailpoet_form"]'
|
||||
);
|
||||
|
||||
// add it as a widget
|
||||
$I->click(
|
||||
'Add Widget',
|
||||
'#widgets-left div[id*="mailpoet_form"]'
|
||||
);
|
||||
|
||||
// wait for the JS animation to end
|
||||
sleep(1);
|
||||
$I->waitForElementVisible(
|
||||
'#widgets-right div[id*="mailpoet_form"]:last-child '.
|
||||
'input[name="savewidget"]',
|
||||
1
|
||||
);
|
||||
|
||||
// save the widget
|
||||
// save
|
||||
$I->click(
|
||||
'Save',
|
||||
'#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
|
||||
$I->click(
|
||||
'Delete',
|
||||
|
Reference in New Issue
Block a user