Fix SubscriberManagementCest - wait for select2 to render and add more specific selector for Save button (was failing randomly)

This commit is contained in:
Ján Mikláš
2018-12-12 16:00:55 +01:00
parent 4260960b59
commit f6e9601e04
2 changed files with 8 additions and 3 deletions

View File

@@ -186,6 +186,7 @@ class SubscriberForm extends React.Component { // eslint-disable-line react/pref
</h1> </h1>
<Form <Form
automationId="subscriber_edit_form"
endpoint="subscribers" endpoint="subscribers"
fields={fields} fields={fields}
params={this.props.match.params} params={this.props.match.params}

View File

@@ -62,7 +62,7 @@ class SubscriberManagementCest {
$I->fillField(['name' => 'first_name'], 'New'); $I->fillField(['name' => 'first_name'], 'New');
$I->fillField(['name' => 'last_name'], 'GlobalUser'); $I->fillField(['name' => 'last_name'], 'GlobalUser');
$I->selectOptionInSelect2($this->segment->get('name')); $I->selectOptionInSelect2($this->segment->get('name'));
$I->click('Save'); $I->click('[data-automation-id="subscriber_edit_form"] input[type="submit"]');
$I->amOnMailPoetPage ('Subscribers'); $I->amOnMailPoetPage ('Subscribers');
$I->fillField('#search_input', 'newglobaluser99@fakemail.fake'); $I->fillField('#search_input', 'newglobaluser99@fakemail.fake');
$I->click('Search'); $I->click('Search');
@@ -98,8 +98,10 @@ class SubscriberManagementCest {
$I->clickItemRowActionByItemName($new_subscriber_email, 'Edit'); $I->clickItemRowActionByItemName($new_subscriber_email, 'Edit');
$I->waitForText('Subscriber', 30); $I->waitForText('Subscriber', 30);
$I->seeInCurrentUrl('mailpoet-subscribers#/edit/'); $I->seeInCurrentUrl('mailpoet-subscribers#/edit/');
$I->waitForElementNotVisible('.mailpoet_form_loading');
$I->waitForElement('.select2');
$I->selectOptionInSelect2('Cooking'); $I->selectOptionInSelect2('Cooking');
$I->click('Save'); $I->click('[data-automation-id="subscriber_edit_form"] input[type="submit"]');
$I->seeNoJSErrors(); $I->seeNoJSErrors();
} }
@@ -113,9 +115,11 @@ class SubscriberManagementCest {
$I->clickItemRowActionByItemName($new_subscriber_email, 'Edit'); $I->clickItemRowActionByItemName($new_subscriber_email, 'Edit');
$I->waitForText('Subscriber', 10); $I->waitForText('Subscriber', 10);
$I->seeInCurrentUrl('mailpoet-subscribers#/edit/'); $I->seeInCurrentUrl('mailpoet-subscribers#/edit/');
$I->waitForElementNotVisible('.mailpoet_form_loading');
$I->waitForElement('.select2');
$I->selectOptionInSelect2('Cooking'); $I->selectOptionInSelect2('Cooking');
$I->click('.select2-selection__choice__remove'); $I->click('.select2-selection__choice__remove');
$I->click('Save'); $I->click('[data-automation-id="subscriber_edit_form"] input[type="submit"]');
$I->waitForText('Subscriber was updated', 10); $I->waitForText('Subscriber was updated', 10);
} }