From 4229ba87f3bf674ed560d04d1fd048a6cde52b3c Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Thu, 12 Jul 2018 11:41:36 +0100 Subject: [PATCH 1/7] Create forms delete acceptance tests [MQ-50] --- assets/js/src/listing/groups.jsx | 1 + tests/DataFactories/Form.php | 35 +++++++++++++ tests/_support/AcceptanceTester.php | 6 +++ tests/acceptance/FormsCreationCest.php | 2 - tests/acceptance/FormsDeletingCest.php | 70 ++++++++++++++++++++++++++ 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 tests/DataFactories/Form.php create mode 100644 tests/acceptance/FormsDeletingCest.php diff --git a/assets/js/src/listing/groups.jsx b/assets/js/src/listing/groups.jsx index 226175f34a..ba7c9b7393 100644 --- a/assets/js/src/listing/groups.jsx +++ b/assets/js/src/listing/groups.jsx @@ -29,6 +29,7 @@ class ListingGroups extends React.Component { href="javascript:;" className={classes} onClick={() => this.handleSelect(group.name)} + data-automation-id={`filters_${group.label.replace(' ', '_').toLowerCase()}`} > {group.label} ({ parseInt(group.count, 10).toLocaleString() }) diff --git a/tests/DataFactories/Form.php b/tests/DataFactories/Form.php new file mode 100644 index 0000000000..71973eb0f8 --- /dev/null +++ b/tests/DataFactories/Form.php @@ -0,0 +1,35 @@ +data = [ + 'name' => 'New form', + 'body' => 'a:2:{i:0;a:5:{s:2:"id";s:5:"email";s:4:"name";s:5:"Email";s:4:"type";s:4:"text";s:6:"static";b:1;s:6:"params";a:2:{s:5:"label";s:5:"Email";s:8:"required";b:1;}}i:1;a:5:{s:2:"id";s:6:"submit";s:4:"name";s:6:"Submit";s:4:"type";s:6:"submit";s:6:"static";b:1;s:6:"params";a:1:{s:5:"label";s:10:"Subscribe!";}}}', + 'settings' => 'a:4:{s:10:"on_success";s:7:"message";s:15:"success_message";s:61:"Check your inbox or spam folder to confirm your subscription.";s:8:"segments";N;s:20:"segments_selected_by";s:5:"admin";}', + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } + + public function withName($name) { + $this->data['name'] = $name; + return $this; + } + + public function withDeleted() { + $this->data['deleted_at'] = Carbon::now(); + return $this; + } + + public function create() { + \MailPoet\Models\Form::createOrUpdate($this->data); + } + +} diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 96c46d04bf..3be7f36771 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -55,4 +55,10 @@ class AcceptanceTester extends \Codeception\Actor { $I->waitForText($page, 5); } + public function clickItemRowActionByItemName($item_name, $link) { + $I = $this; + $I->moveMouseOver(['xpath' => '//*[text()="' . $item_name . '"]//ancestor::tr']); + $I->click($link, ['xpath' => '//*[text()="' . $item_name . '"]//ancestor::tr']); + } + } diff --git a/tests/acceptance/FormsCreationCest.php b/tests/acceptance/FormsCreationCest.php index dc15bf1957..191533c505 100644 --- a/tests/acceptance/FormsCreationCest.php +++ b/tests/acceptance/FormsCreationCest.php @@ -36,6 +36,4 @@ class FormsCreationCest { $I->waitForText('Please select a list.'); } - - } diff --git a/tests/acceptance/FormsDeletingCest.php b/tests/acceptance/FormsDeletingCest.php new file mode 100644 index 0000000000..cc1333dc33 --- /dev/null +++ b/tests/acceptance/FormsDeletingCest.php @@ -0,0 +1,70 @@ +withName($form_name)->create(); + + $I->wantTo('Move a form to trash'); + + $I->login(); + $I->amOnMailpoetPage('Forms'); + $I->waitForText($form_name); + + $I->clickItemRowActionByItemName($form_name, 'Move to trash'); + + $I->waitForElement('[data-automation-id="filters_trash"]'); + $I->click('[data-automation-id="filters_trash"]'); + + $I->waitForText($form_name); + } + + function restoreFormFromTrash(\AcceptanceTester $I) { + $form_name = 'Restore from trash form'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); + + $I->wantTo('Restore a form from trash'); + + $I->login(); + $I->amOnMailpoetPage('Forms'); + + $I->waitForElement('[data-automation-id="filters_trash"]'); + $I->click('[data-automation-id="filters_trash"]'); + $I->waitForText($form_name); + + $I->clickItemRowActionByItemName($form_name, 'Restore'); + $I->click('[data-automation-id="filters_all"]'); + $I->waitForText($form_name); + } + + function deleteFormPermanently(\AcceptanceTester $I) { + $form_name = 'Delete form permanently'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); + + $I->wantTo('Delete a form permanently trash'); + + $I->login(); + $I->amOnMailpoetPage('Forms'); + + $I->waitForElement('[data-automation-id="filters_trash"]'); + $I->click('[data-automation-id="filters_trash"]'); + $I->waitForText($form_name); + + $I->clickItemRowActionByItemName($form_name, 'Delete Permanently'); + + $I->waitForText('1 form was permanently deleted.'); + $I->waitForElementNotVisible($form_name); + } + + +} From 38f8bec4c5c6dbb1aade751862cd0de3d0f07210 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Thu, 12 Jul 2018 16:04:16 +0100 Subject: [PATCH 2/7] Add health check to docker compose [MQ-50] --- docker-compose.yml | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d28440d292..108af98e15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,13 @@ -version: '2' +version: '2.1' services: codeception: build: . depends_on: - - mailhog - - wordpress + mailhog: + condition: service_started + wordpress: + condition: service_healthy volumes: - ./:/project - wp-core:/wp-core @@ -22,8 +24,10 @@ services: build: ./tests/wordpressDockerfile image: wordpress:latest depends_on: - - mysql - - chrome + mysql: + condition: service_healthy + chrome: + condition: service_started volumes: - wp-core:/var/www/html - ./:/var/www/html/wp-content/plugins/mailpoet @@ -35,13 +39,23 @@ services: WORDPRESS_DB_USER: wordpress WORDPRESS_DB_NAME: wordpress WORDPRESS_TABLE_PREFIX: mp_ + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost"] + interval: 1m30s + timeout: 10s + retries: 3 + mysql: image: mysql:5.6 environment: - MYSQL_ROOT_PASSWORD: wordpress - MYSQL_DATABASE: wordpress - MYSQL_USER: wordpress - MYSQL_PASSWORD: wordpress + MYSQL_ROOT_PASSWORD: wordpress + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + healthcheck: + test: mysql --user=wordpress --password=wordpress -e 'SELECT 1' + timeout: 20s + retries: 10 chrome: environment: @@ -53,4 +67,4 @@ services: - 4444 - 5900:5900 volumes: - wp-core: \ No newline at end of file + wp-core: From 4296cd5a3e7a3427059dad21c9c81c345bc06e96 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Mon, 16 Jul 2018 14:13:39 +0100 Subject: [PATCH 3/7] Fix data creation for first test run [MQ-50] --- tests/DataFactories/Form.php | 7 +++++++ tests/_support/AcceptanceTester.php | 2 +- tests/acceptance/FormsDeletingCest.php | 21 ++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/DataFactories/Form.php b/tests/DataFactories/Form.php index 71973eb0f8..177a9ad66c 100644 --- a/tests/DataFactories/Form.php +++ b/tests/DataFactories/Form.php @@ -3,6 +3,9 @@ namespace MailPoet\Test\DataFactories; use Carbon\Carbon; +use MailPoet\Config\Database; + +require_once __DIR__ . '/../../lib/Config/Database.php'; class Form { @@ -29,6 +32,10 @@ class Form { } public function create() { + if(!defined('MP_FORMS_TABLE')) { + $database = new Database(); + $database->defineTables(); + } \MailPoet\Models\Form::createOrUpdate($this->data); } diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 3be7f36771..640358d8d3 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -27,7 +27,7 @@ class AcceptanceTester extends \Codeception\Actor { $this->fillField('Username', 'admin'); $this->fillField('Password', 'password'); $this->click('Log In'); - $this->waitForText('MailPoet', 10); + $this->waitForText('MailPoet', 20); } /** diff --git a/tests/acceptance/FormsDeletingCest.php b/tests/acceptance/FormsDeletingCest.php index cc1333dc33..0cddff28c8 100644 --- a/tests/acceptance/FormsDeletingCest.php +++ b/tests/acceptance/FormsDeletingCest.php @@ -9,13 +9,14 @@ require_once __DIR__ . '/../DataFactories/Form.php'; class FormsDeletingCest { function moveFormToTrash(\AcceptanceTester $I) { - $form_name = 'Move to trash form'; - $form = new Form(); - $form->withName($form_name)->create(); $I->wantTo('Move a form to trash'); $I->login(); + $form_name = 'Move to trash form'; + $form = new Form(); + $form->withName($form_name)->create(); + $I->amOnMailpoetPage('Forms'); $I->waitForText($form_name); @@ -28,13 +29,12 @@ class FormsDeletingCest { } function restoreFormFromTrash(\AcceptanceTester $I) { - $form_name = 'Restore from trash form'; - $form = new Form(); - $form->withName($form_name)->withDeleted()->create(); - $I->wantTo('Restore a form from trash'); $I->login(); + $form_name = 'Restore from trash form'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); $I->amOnMailpoetPage('Forms'); $I->waitForElement('[data-automation-id="filters_trash"]'); @@ -47,13 +47,12 @@ class FormsDeletingCest { } function deleteFormPermanently(\AcceptanceTester $I) { - $form_name = 'Delete form permanently'; - $form = new Form(); - $form->withName($form_name)->withDeleted()->create(); - $I->wantTo('Delete a form permanently trash'); $I->login(); + $form_name = 'Delete form permanently'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); $I->amOnMailpoetPage('Forms'); $I->waitForElement('[data-automation-id="filters_trash"]'); From d8b9b8e649687eb5c8b25def27c35010336f4981 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Mon, 16 Jul 2018 15:35:46 +0100 Subject: [PATCH 4/7] Remove factory, because it doesn't work [MQ-50] --- tests/DataFactories/Form.php | 42 ------------------- tests/acceptance/FormsDeletingCest.php | 57 +++++++++----------------- 2 files changed, 20 insertions(+), 79 deletions(-) delete mode 100644 tests/DataFactories/Form.php diff --git a/tests/DataFactories/Form.php b/tests/DataFactories/Form.php deleted file mode 100644 index 177a9ad66c..0000000000 --- a/tests/DataFactories/Form.php +++ /dev/null @@ -1,42 +0,0 @@ -data = [ - 'name' => 'New form', - 'body' => 'a:2:{i:0;a:5:{s:2:"id";s:5:"email";s:4:"name";s:5:"Email";s:4:"type";s:4:"text";s:6:"static";b:1;s:6:"params";a:2:{s:5:"label";s:5:"Email";s:8:"required";b:1;}}i:1;a:5:{s:2:"id";s:6:"submit";s:4:"name";s:6:"Submit";s:4:"type";s:6:"submit";s:6:"static";b:1;s:6:"params";a:1:{s:5:"label";s:10:"Subscribe!";}}}', - 'settings' => 'a:4:{s:10:"on_success";s:7:"message";s:15:"success_message";s:61:"Check your inbox or spam folder to confirm your subscription.";s:8:"segments";N;s:20:"segments_selected_by";s:5:"admin";}', - 'created_at' => Carbon::now(), - 'updated_at' => Carbon::now(), - ]; - } - - public function withName($name) { - $this->data['name'] = $name; - return $this; - } - - public function withDeleted() { - $this->data['deleted_at'] = Carbon::now(); - return $this; - } - - public function create() { - if(!defined('MP_FORMS_TABLE')) { - $database = new Database(); - $database->defineTables(); - } - \MailPoet\Models\Form::createOrUpdate($this->data); - } - -} diff --git a/tests/acceptance/FormsDeletingCest.php b/tests/acceptance/FormsDeletingCest.php index 0cddff28c8..e5b9d2f87e 100644 --- a/tests/acceptance/FormsDeletingCest.php +++ b/tests/acceptance/FormsDeletingCest.php @@ -2,65 +2,48 @@ namespace MailPoet\Test\Acceptance; -use MailPoet\Test\DataFactories\Form; -require_once __DIR__ . '/../DataFactories/Form.php'; class FormsDeletingCest { - function moveFormToTrash(\AcceptanceTester $I) { + function test(\AcceptanceTester $I) { + $form_name = 'My new form for delete test'; $I->wantTo('Move a form to trash'); $I->login(); - $form_name = 'Move to trash form'; - $form = new Form(); - $form->withName($form_name)->create(); - $I->amOnMailpoetPage('Forms'); - $I->waitForText($form_name); + // 1 - create a new form + $I->click('[data-automation-id="create_new_form"]'); + $I->waitForElement('[data-automation-id="mailpoet_form_name_input"]'); + $I->fillField('[data-automation-id="mailpoet_form_name_input"]', $form_name); + $search_field_element = 'input.select2-search__field'; + $I->fillField($search_field_element, 'My First List'); + $I->pressKey($search_field_element, \WebDriverKeys::ENTER); + $I->click('[data-automation-id="save_form"]'); + $I->click('[data-automation-id="mailpoet_form_go_back"]'); + $I->waitForElement('[data-automation-id="listing_item_1"]'); + + // 2 - Move form to trash $I->clickItemRowActionByItemName($form_name, 'Move to trash'); - - $I->waitForElement('[data-automation-id="filters_trash"]'); - $I->click('[data-automation-id="filters_trash"]'); - - $I->waitForText($form_name); - } - - function restoreFormFromTrash(\AcceptanceTester $I) { - $I->wantTo('Restore a form from trash'); - - $I->login(); - $form_name = 'Restore from trash form'; - $form = new Form(); - $form->withName($form_name)->withDeleted()->create(); - $I->amOnMailpoetPage('Forms'); - $I->waitForElement('[data-automation-id="filters_trash"]'); $I->click('[data-automation-id="filters_trash"]'); $I->waitForText($form_name); + // 3 - Restore the form $I->clickItemRowActionByItemName($form_name, 'Restore'); - $I->click('[data-automation-id="filters_all"]'); - $I->waitForText($form_name); - } - - function deleteFormPermanently(\AcceptanceTester $I) { - $I->wantTo('Delete a form permanently trash'); - - $I->login(); - $form_name = 'Delete form permanently'; - $form = new Form(); - $form->withName($form_name)->withDeleted()->create(); - $I->amOnMailpoetPage('Forms'); + $I->waitForText('form has been restored from the trash'); + $I->waitForText($form_name, 10); + // 4 - Move to trash again + $I->clickItemRowActionByItemName($form_name, 'Move to trash'); $I->waitForElement('[data-automation-id="filters_trash"]'); $I->click('[data-automation-id="filters_trash"]'); $I->waitForText($form_name); + // 5 - Delete permanently $I->clickItemRowActionByItemName($form_name, 'Delete Permanently'); - $I->waitForText('1 form was permanently deleted.'); $I->waitForElementNotVisible($form_name); } From d0f797f88c6ab8929a1313c040da841724bf4c35 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Tue, 17 Jul 2018 13:42:34 +0100 Subject: [PATCH 5/7] Revert "Remove factory, because it doesn't work" This reverts commit d8b9b8e649687eb5c8b25def27c35010336f4981. --- tests/DataFactories/Form.php | 42 ++++++++++++++++++ tests/acceptance/FormsDeletingCest.php | 59 +++++++++++++++++--------- 2 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 tests/DataFactories/Form.php diff --git a/tests/DataFactories/Form.php b/tests/DataFactories/Form.php new file mode 100644 index 0000000000..177a9ad66c --- /dev/null +++ b/tests/DataFactories/Form.php @@ -0,0 +1,42 @@ +data = [ + 'name' => 'New form', + 'body' => 'a:2:{i:0;a:5:{s:2:"id";s:5:"email";s:4:"name";s:5:"Email";s:4:"type";s:4:"text";s:6:"static";b:1;s:6:"params";a:2:{s:5:"label";s:5:"Email";s:8:"required";b:1;}}i:1;a:5:{s:2:"id";s:6:"submit";s:4:"name";s:6:"Submit";s:4:"type";s:6:"submit";s:6:"static";b:1;s:6:"params";a:1:{s:5:"label";s:10:"Subscribe!";}}}', + 'settings' => 'a:4:{s:10:"on_success";s:7:"message";s:15:"success_message";s:61:"Check your inbox or spam folder to confirm your subscription.";s:8:"segments";N;s:20:"segments_selected_by";s:5:"admin";}', + 'created_at' => Carbon::now(), + 'updated_at' => Carbon::now(), + ]; + } + + public function withName($name) { + $this->data['name'] = $name; + return $this; + } + + public function withDeleted() { + $this->data['deleted_at'] = Carbon::now(); + return $this; + } + + public function create() { + if(!defined('MP_FORMS_TABLE')) { + $database = new Database(); + $database->defineTables(); + } + \MailPoet\Models\Form::createOrUpdate($this->data); + } + +} diff --git a/tests/acceptance/FormsDeletingCest.php b/tests/acceptance/FormsDeletingCest.php index e5b9d2f87e..0cddff28c8 100644 --- a/tests/acceptance/FormsDeletingCest.php +++ b/tests/acceptance/FormsDeletingCest.php @@ -2,48 +2,65 @@ namespace MailPoet\Test\Acceptance; +use MailPoet\Test\DataFactories\Form; +require_once __DIR__ . '/../DataFactories/Form.php'; class FormsDeletingCest { - function test(\AcceptanceTester $I) { - $form_name = 'My new form for delete test'; + function moveFormToTrash(\AcceptanceTester $I) { $I->wantTo('Move a form to trash'); $I->login(); + $form_name = 'Move to trash form'; + $form = new Form(); + $form->withName($form_name)->create(); + + $I->amOnMailpoetPage('Forms'); + $I->waitForText($form_name); + + $I->clickItemRowActionByItemName($form_name, 'Move to trash'); + + $I->waitForElement('[data-automation-id="filters_trash"]'); + $I->click('[data-automation-id="filters_trash"]'); + + $I->waitForText($form_name); + } + + function restoreFormFromTrash(\AcceptanceTester $I) { + $I->wantTo('Restore a form from trash'); + + $I->login(); + $form_name = 'Restore from trash form'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); $I->amOnMailpoetPage('Forms'); - // 1 - create a new form - $I->click('[data-automation-id="create_new_form"]'); - $I->waitForElement('[data-automation-id="mailpoet_form_name_input"]'); - $I->fillField('[data-automation-id="mailpoet_form_name_input"]', $form_name); - $search_field_element = 'input.select2-search__field'; - $I->fillField($search_field_element, 'My First List'); - $I->pressKey($search_field_element, \WebDriverKeys::ENTER); - $I->click('[data-automation-id="save_form"]'); - $I->click('[data-automation-id="mailpoet_form_go_back"]'); - $I->waitForElement('[data-automation-id="listing_item_1"]'); - - // 2 - Move form to trash - $I->clickItemRowActionByItemName($form_name, 'Move to trash'); $I->waitForElement('[data-automation-id="filters_trash"]'); $I->click('[data-automation-id="filters_trash"]'); $I->waitForText($form_name); - // 3 - Restore the form $I->clickItemRowActionByItemName($form_name, 'Restore'); - $I->waitForText('form has been restored from the trash'); - $I->waitForText($form_name, 10); + $I->click('[data-automation-id="filters_all"]'); + $I->waitForText($form_name); + } + + function deleteFormPermanently(\AcceptanceTester $I) { + $I->wantTo('Delete a form permanently trash'); + + $I->login(); + $form_name = 'Delete form permanently'; + $form = new Form(); + $form->withName($form_name)->withDeleted()->create(); + $I->amOnMailpoetPage('Forms'); - // 4 - Move to trash again - $I->clickItemRowActionByItemName($form_name, 'Move to trash'); $I->waitForElement('[data-automation-id="filters_trash"]'); $I->click('[data-automation-id="filters_trash"]'); $I->waitForText($form_name); - // 5 - Delete permanently $I->clickItemRowActionByItemName($form_name, 'Delete Permanently'); + $I->waitForText('1 form was permanently deleted.'); $I->waitForElementNotVisible($form_name); } From 427e826ee5a0b6a51c362e7b63fbbb0e3c0cc915 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Tue, 17 Jul 2018 13:42:47 +0100 Subject: [PATCH 6/7] Revert "Fix data creation for first test run" This reverts commit 4296cd5a3e7a3427059dad21c9c81c345bc06e96. --- tests/DataFactories/Form.php | 7 ------- tests/_support/AcceptanceTester.php | 2 +- tests/acceptance/FormsDeletingCest.php | 21 +++++++++++---------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/DataFactories/Form.php b/tests/DataFactories/Form.php index 177a9ad66c..71973eb0f8 100644 --- a/tests/DataFactories/Form.php +++ b/tests/DataFactories/Form.php @@ -3,9 +3,6 @@ namespace MailPoet\Test\DataFactories; use Carbon\Carbon; -use MailPoet\Config\Database; - -require_once __DIR__ . '/../../lib/Config/Database.php'; class Form { @@ -32,10 +29,6 @@ class Form { } public function create() { - if(!defined('MP_FORMS_TABLE')) { - $database = new Database(); - $database->defineTables(); - } \MailPoet\Models\Form::createOrUpdate($this->data); } diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 640358d8d3..3be7f36771 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -27,7 +27,7 @@ class AcceptanceTester extends \Codeception\Actor { $this->fillField('Username', 'admin'); $this->fillField('Password', 'password'); $this->click('Log In'); - $this->waitForText('MailPoet', 20); + $this->waitForText('MailPoet', 10); } /** diff --git a/tests/acceptance/FormsDeletingCest.php b/tests/acceptance/FormsDeletingCest.php index 0cddff28c8..cc1333dc33 100644 --- a/tests/acceptance/FormsDeletingCest.php +++ b/tests/acceptance/FormsDeletingCest.php @@ -9,14 +9,13 @@ require_once __DIR__ . '/../DataFactories/Form.php'; class FormsDeletingCest { function moveFormToTrash(\AcceptanceTester $I) { - - $I->wantTo('Move a form to trash'); - - $I->login(); $form_name = 'Move to trash form'; $form = new Form(); $form->withName($form_name)->create(); + $I->wantTo('Move a form to trash'); + + $I->login(); $I->amOnMailpoetPage('Forms'); $I->waitForText($form_name); @@ -29,12 +28,13 @@ class FormsDeletingCest { } function restoreFormFromTrash(\AcceptanceTester $I) { - $I->wantTo('Restore a form from trash'); - - $I->login(); $form_name = 'Restore from trash form'; $form = new Form(); $form->withName($form_name)->withDeleted()->create(); + + $I->wantTo('Restore a form from trash'); + + $I->login(); $I->amOnMailpoetPage('Forms'); $I->waitForElement('[data-automation-id="filters_trash"]'); @@ -47,12 +47,13 @@ class FormsDeletingCest { } function deleteFormPermanently(\AcceptanceTester $I) { - $I->wantTo('Delete a form permanently trash'); - - $I->login(); $form_name = 'Delete form permanently'; $form = new Form(); $form->withName($form_name)->withDeleted()->create(); + + $I->wantTo('Delete a form permanently trash'); + + $I->login(); $I->amOnMailpoetPage('Forms'); $I->waitForElement('[data-automation-id="filters_trash"]'); From f314d5d706c98ed55929b41e2d7e9bf278c64c3d Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Tue, 17 Jul 2018 13:45:09 +0100 Subject: [PATCH 7/7] Test fixing tests [MQ-50] --- codeception.acceptance.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codeception.acceptance.yml b/codeception.acceptance.yml index 72cec51ffe..489db315b2 100644 --- a/codeception.acceptance.yml +++ b/codeception.acceptance.yml @@ -28,13 +28,16 @@ modules: adminPath: /wp-admin log_js_errors: true WPLoader: - loadOnly: true + loadOnly: false wpRootFolder: /wp-core dbName: wordpress dbHost: mysql dbUser: wordpress dbPassword: wordpress domain: wordpress + tablePrefix: 'mp_' + plugins: ['mailpoet/mailpoet.php'] + activatePlugins: ['mailpoet/mailpoet.php'] WPDb: dsn: 'mysql:host=mysql;dbname=wordpress' user: wordpress