From f6e9601e04a86a4bad4d76a93dab41b2d2fa11cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ja=CC=81n=20Mikla=CC=81s=CC=8C?= Date: Wed, 12 Dec 2018 16:00:55 +0100 Subject: [PATCH] Fix SubscriberManagementCest - wait for select2 to render and add more specific selector for Save button (was failing randomly) --- assets/js/src/subscribers/form.jsx | 1 + tests/acceptance/SubscriberManagementCest.php | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/assets/js/src/subscribers/form.jsx b/assets/js/src/subscribers/form.jsx index 6d417db9aa..ebdc1461ea 100644 --- a/assets/js/src/subscribers/form.jsx +++ b/assets/js/src/subscribers/form.jsx @@ -186,6 +186,7 @@ class SubscriberForm extends React.Component { // eslint-disable-line react/pref
fillField(['name' => 'first_name'], 'New'); $I->fillField(['name' => 'last_name'], 'GlobalUser'); $I->selectOptionInSelect2($this->segment->get('name')); - $I->click('Save'); + $I->click('[data-automation-id="subscriber_edit_form"] input[type="submit"]'); $I->amOnMailPoetPage ('Subscribers'); $I->fillField('#search_input', 'newglobaluser99@fakemail.fake'); $I->click('Search'); @@ -98,8 +98,10 @@ class SubscriberManagementCest { $I->clickItemRowActionByItemName($new_subscriber_email, 'Edit'); $I->waitForText('Subscriber', 30); $I->seeInCurrentUrl('mailpoet-subscribers#/edit/'); + $I->waitForElementNotVisible('.mailpoet_form_loading'); + $I->waitForElement('.select2'); $I->selectOptionInSelect2('Cooking'); - $I->click('Save'); + $I->click('[data-automation-id="subscriber_edit_form"] input[type="submit"]'); $I->seeNoJSErrors(); } @@ -113,9 +115,11 @@ class SubscriberManagementCest { $I->clickItemRowActionByItemName($new_subscriber_email, 'Edit'); $I->waitForText('Subscriber', 10); $I->seeInCurrentUrl('mailpoet-subscribers#/edit/'); + $I->waitForElementNotVisible('.mailpoet_form_loading'); + $I->waitForElement('.select2'); $I->selectOptionInSelect2('Cooking'); $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); }