From 3bf79de5c229af5f7034d613db5bc68dc106775f Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 6 May 2024 11:08:55 +0300 Subject: [PATCH 01/45] Add e2e tests for adding posts to categories --- .../cypress/functions/CategoryFunctions.js | 51 +++++++++++++++++++ .../cypress/locators/CategoryLocators.js | 12 +++++ 2 files changed, 63 insertions(+) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index cb6ee44602..1e72043e02 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -59,6 +59,57 @@ class CategoryFunctions { ).click(); } + click_add_post_btn() { + cy.get(CategoryLocators.addPostBtn).click(); + } + + open_survey_with_categories() { + cy.get(CategoryLocators.categoryTestSurvey).click(); + } + + open_settings() { + cy.get(CategoryLocators.stngsBtn).click(); + } + + open_surveys() { + cy.get(CategoryLocators.surveyBtn).click(); + } + + add_survey() { + cy.get(CategoryLocators.addSurveyBtn).click(); + } + + type_post_title(title) { + cy.get(CategoryLocators.postTitleField).should('be.visible').type(title, { force: true }); + } + + type_post_description(description) { + cy.get(CategoryLocators.postDescField).type(description, { force: true }); + } + + create_survey_with_category() { + this.open_settings(); + this.open_surveys(); + this.add_survey(); + cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); + cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); + cy.get(CategoryLocators.addNewFieldBtn).click(); + cy.get(CategoryLocators.selectCategoryField).click(); + cy.get(CategoryLocators.selectCategory).children('mat-checkbox-157-input').click(); + cy.get(CategoryLocators.saveFieldBtn).click(); + } + + add_post_to_category() { + this.click_add_post_btn(); + this.open_survey_with_categories(); + cy.wait(1000); + this.type_post_title('New Post Title'); + this.type_post_description('New Post Description'); + cy.get('mat-checkbox-214-input').click(); + this.save_post(); + cy.get(SurveyConfigurationLocators.successBtn).click(); + } + verify_visibility_matches_parent() { cy.wait(1000); cy.get(CategoryLocators.selectParentCtgry).click(); diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index bf8f8c6ea5..9ed0712bc3 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -1,5 +1,6 @@ const CategoryLocators = { stngsBtn: '[data-qa="btn-settings"]', + surveyBtn: '[data-qa="btn-surveys"]', ctgryBtn: '[data-qa="btn-categories"]', addCategoryBtn: '[data-qa="btn-settings-create"]', ctgryNameField: '[data-qa="name"]', @@ -11,6 +12,17 @@ const CategoryLocators = { translationCheckbox: '[data-qa="translation"]', technologyCheckbox: '[data-qa="technology"]', adminCheckbox: '[data-qa="admin"]', + addPostBtn: '[data-qa="submit-post-button"]', + categoryTestSurvey: '[data-qa="add-post-modal-surveys-item701"]', + addSurveyBtn: '[data-qa="btn-settings-create"]', + surveyNameField: '[data-qa="name"]', + surveyDescriptionField: '[data-qa="description"]', + addNewFieldBtn: '[data-qa="btn-survey-add-field"]', + selectCategoryField: '[data-qa="select-survey.categories"]', + selectCategory: '[data-qa="tag-Automated Parent-Category...."]', + saveFieldBtn: '[data-qa="btn-add-field"]', + postTitleField: '[data-qa="null"]', + postDescField: '[data-qa="description"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From b7ed6587adae3645faca94497f1791901309924b Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 6 May 2024 11:59:43 +0300 Subject: [PATCH 02/45] Add the functions to edited files --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 09032557bf..47c77643b1 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -1,7 +1,7 @@ -import LoginFunctions from "../../functions/LoginFunctions"; -import CategoryFunctions from "../../functions/CategoryFunctions"; +import LoginFunctions from '../../functions/LoginFunctions'; +import CategoryFunctions from '../../functions/CategoryFunctions'; -describe("Automated Tests for Categories", () => { +describe('Automated Tests for Categories', () => { const loginFunctions = new LoginFunctions(); const categoryFunctions = new CategoryFunctions(); @@ -10,10 +10,12 @@ describe("Automated Tests for Categories", () => { cy.visit(Cypress.env('baseUrl')); }); - it("Opens Categories Page", () => { + it('Opens Categories Page', () => { categoryFunctions.open_category_creation_page_steps(); categoryFunctions.add_category_details_steps(); categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); + categoryFunctions.create_survey_with_category(); + categoryFunctions.add_post_to_category(); }); }); From 12b5f149db2f77da845d21b11be8798cce783855 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 6 May 2024 13:26:04 +0300 Subject: [PATCH 03/45] Fix the failing tests --- e2e-testing/cypress/functions/CategoryFunctions.js | 4 ++++ e2e-testing/cypress/locators/CategoryLocators.js | 1 + 2 files changed, 5 insertions(+) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 1e72043e02..a1b7b38a1c 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -87,6 +87,10 @@ class CategoryFunctions { cy.get(CategoryLocators.postDescField).type(description, { force: true }); } + save_post() { + cy.get(SurveyConfigurationLocators.savePostBtn).click(); + } + create_survey_with_category() { this.open_settings(); this.open_surveys(); diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 9ed0712bc3..a6dbc9f27e 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -23,6 +23,7 @@ const CategoryLocators = { saveFieldBtn: '[data-qa="btn-add-field"]', postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', + savePostBtn: '[data-qa="btn-post-item-submit"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 41588197465e2d209a234c3687898bbaf08d1c8f Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 6 May 2024 13:42:55 +0300 Subject: [PATCH 04/45] Fix the failing tests --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index a1b7b38a1c..75533dc4a0 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -88,7 +88,7 @@ class CategoryFunctions { } save_post() { - cy.get(SurveyConfigurationLocators.savePostBtn).click(); + cy.get(CategoryLocators.savePostBtn).click(); } create_survey_with_category() { From fd42faded1359187c0f0bc49b0513533c94b5a7b Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 6 May 2024 13:51:29 +0300 Subject: [PATCH 05/45] Rename locators file --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 75533dc4a0..5ee0b7c0cd 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -111,7 +111,7 @@ class CategoryFunctions { this.type_post_description('New Post Description'); cy.get('mat-checkbox-214-input').click(); this.save_post(); - cy.get(SurveyConfigurationLocators.successBtn).click(); + cy.get(CategoryLocators.successBtn).click(); } verify_visibility_matches_parent() { From 07c66b44c09d412749afe63da85c6990956a0d5d Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 7 May 2024 04:16:28 +0300 Subject: [PATCH 06/45] Add force true --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 5ee0b7c0cd..e03139dd56 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).click(); + cy.get(CategoryLocators.selectCategoryField).click({ force: true }); cy.get(CategoryLocators.selectCategory).children('mat-checkbox-157-input').click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From b32af4d96e0db34720545ecd2065bb858ee2f6c6 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 10 May 2024 15:58:23 +0300 Subject: [PATCH 07/45] Update branch with development changes --- .../create-field-modal/create-field-modal.component.html | 2 +- e2e-testing/cypress/functions/CategoryFunctions.js | 4 ++-- e2e-testing/cypress/locators/CategoryLocators.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web-mzima-client/src/app/settings/surveys/create-field-modal/create-field-modal.component.html b/apps/web-mzima-client/src/app/settings/surveys/create-field-modal/create-field-modal.component.html index 100bf45a91..89a6760e9a 100644 --- a/apps/web-mzima-client/src/app/settings/surveys/create-field-modal/create-field-modal.component.html +++ b/apps/web-mzima-client/src/app/settings/surveys/create-field-modal/create-field-modal.component.html @@ -14,7 +14,7 @@ {{ isTranslateMode ? ('form.translate_field' | translate) : ('form.add_field' | translate) }} - +
diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index e03139dd56..c9934e3cd5 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,8 +98,8 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).click({ force: true }); - cy.get(CategoryLocators.selectCategory).children('mat-checkbox-157-input').click(); + // cy.get(CategoryLocators.selectCategoryField).click({ force: true }); + cy.get(CategoryLocators.addNewFieldModal).find(CategoryLocators.selectCategoryField).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index a6dbc9f27e..bb590bef03 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -24,6 +24,7 @@ const CategoryLocators = { postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', + addNewFieldModal: '[data-qa="new-field-modal"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 08405744940916241f4bce0a23b4a3bd50f0e9bc Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 13:39:23 +0300 Subject: [PATCH 08/45] Add the force true --- e2e-testing/cypress/functions/CategoryFunctions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index c9934e3cd5..280d2afe89 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -99,7 +99,9 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); // cy.get(CategoryLocators.selectCategoryField).click({ force: true }); - cy.get(CategoryLocators.addNewFieldModal).find(CategoryLocators.selectCategoryField).click(); + cy.get(CategoryLocators.addNewFieldModal) + .find(CategoryLocators.selectCategoryField) + .click({ force: true }); cy.get(CategoryLocators.saveFieldBtn).click(); } From 49c5d40cf802ddafb478fbcb676268e5c2abbe58 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 19:23:14 +0300 Subject: [PATCH 09/45] Fix failing test --- e2e-testing/cypress/functions/CategoryFunctions.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 280d2afe89..8292b6275b 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -60,7 +60,7 @@ class CategoryFunctions { } click_add_post_btn() { - cy.get(CategoryLocators.addPostBtn).click(); + cy.get(CategoryLocators.addPostBtn).click({ force: true }); } open_survey_with_categories() { @@ -98,10 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - // cy.get(CategoryLocators.selectCategoryField).click({ force: true }); - cy.get(CategoryLocators.addNewFieldModal) - .find(CategoryLocators.selectCategoryField) - .click({ force: true }); + cy.get(CategoryLocators.selectCategoryField).click({ force: true }); cy.get(CategoryLocators.saveFieldBtn).click(); } From e3bfe83723d03c2e5e4a8bd5d640b7ad2f7e5623 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 19:56:21 +0300 Subject: [PATCH 10/45] Figure out the failing tests --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 47c77643b1..b2c15a5d90 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -16,6 +16,6 @@ describe('Automated Tests for Categories', () => { categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); categoryFunctions.create_survey_with_category(); - categoryFunctions.add_post_to_category(); + // categoryFunctions.add_post_to_category(); }); }); From 67936253c64898dc76cac61d450f5c50942199c5 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 20:17:48 +0300 Subject: [PATCH 11/45] Remove force true --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 8292b6275b..b1b6b4b6a1 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).click({ force: true }); + cy.get(CategoryLocators.selectCategoryField).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From 7ad03bdedb6857b9b19e118c970fd5044dcce2bf Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 21:23:55 +0300 Subject: [PATCH 12/45] Try out alternative for clicking on div --- e2e-testing/cypress/functions/CategoryFunctions.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index b1b6b4b6a1..8ff37d1b16 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,8 +98,13 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).click(); - cy.get(CategoryLocators.saveFieldBtn).click(); + cy.get(CategoryLocators.addNewFieldModal) + .should('be.visible') + .contains('Categories') + .should('be.visible') + .click(); + // cy.get(CategoryLocators.selectCategoryField).click(); + // cy.get(CategoryLocators.saveFieldBtn).click(); } add_post_to_category() { From 8810734c3fe759ae7265fdfbeaf9b2b69d9680e5 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 13 May 2024 21:50:41 +0300 Subject: [PATCH 13/45] Try out alternative for clicking on div --- e2e-testing/cypress/functions/CategoryFunctions.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 8ff37d1b16..a74b014dc4 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,11 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.addNewFieldModal) - .should('be.visible') - .contains('Categories') - .should('be.visible') - .click(); + cy.get(CategoryLocators.addNewFieldModal).should('be.visible').contains('Categories').click(); // cy.get(CategoryLocators.selectCategoryField).click(); // cy.get(CategoryLocators.saveFieldBtn).click(); } From 172c771216bc3293c4a1a87b8c2567beb7182331 Mon Sep 17 00:00:00 2001 From: Shakira Date: Mon, 27 May 2024 12:10:22 +0300 Subject: [PATCH 14/45] Implement triggering click on div --- e2e-testing/cypress/functions/CategoryFunctions.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index a74b014dc4..63c5636750 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,9 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.addNewFieldModal).should('be.visible').contains('Categories').click(); - // cy.get(CategoryLocators.selectCategoryField).click(); - // cy.get(CategoryLocators.saveFieldBtn).click(); + cy.get(CategoryLocators.selectCategoryField).trigger('click'); } add_post_to_category() { From f8f358e92eb8c47dce4f2d76ffd29a5728d68ec0 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 28 May 2024 13:56:42 +0300 Subject: [PATCH 15/45] Add check for is active --- e2e-testing/cypress/functions/CategoryFunctions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 63c5636750..79a629cb98 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,8 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).trigger('click'); + cy.get(CategoryLocators.selectCategoryField).should(be.active); + cy.get(CategoryLocators.selectCategoryField).click(); } add_post_to_category() { From dfdd466f21a5824259f1ef3f041424ee1eda2904 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 28 May 2024 16:06:36 +0300 Subject: [PATCH 16/45] Change should command --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 79a629cb98..601e9a7b4b 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).should(be.active); + cy.get(CategoryLocators.selectCategoryField).should(be.not.disabled); cy.get(CategoryLocators.selectCategoryField).click(); } From f54e7acff5b38d889bf35ab6cc7078ad3c52b295 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 11 Jul 2024 10:50:39 +0300 Subject: [PATCH 17/45] Put quotes in function --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 601e9a7b4b..aee8af9917 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).should(be.not.disabled); + cy.get(CategoryLocators.selectCategoryField).should('be.not.disabled'); cy.get(CategoryLocators.selectCategoryField).click(); } From 87ef964ee1fa51a07b517eb294f0a29429134218 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 11 Jul 2024 18:21:51 +0300 Subject: [PATCH 18/45] Uncomment the add post to category function --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index b2c15a5d90..47c77643b1 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -16,6 +16,6 @@ describe('Automated Tests for Categories', () => { categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); categoryFunctions.create_survey_with_category(); - // categoryFunctions.add_post_to_category(); + categoryFunctions.add_post_to_category(); }); }); From 795c58a229040906a4f900470bce4ff4a2b178d7 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 11 Jul 2024 19:09:21 +0300 Subject: [PATCH 19/45] Add function for the select survey categories --- e2e-testing/cypress/functions/CategoryFunctions.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index aee8af9917..0506133491 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,8 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).should('be.not.disabled'); - cy.get(CategoryLocators.selectCategoryField).click(); + cy.get(`[data-qa="select-survey.categories"]`).should('exist').click(); } add_post_to_category() { From 90d9686bb2cd128305ac57a2d6b154b3ad46f5c0 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 11 Jul 2024 20:23:28 +0300 Subject: [PATCH 20/45] Fix failing test --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 2 +- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 47c77643b1..b2c15a5d90 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -16,6 +16,6 @@ describe('Automated Tests for Categories', () => { categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); categoryFunctions.create_survey_with_category(); - categoryFunctions.add_post_to_category(); + // categoryFunctions.add_post_to_category(); }); }); diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 0506133491..a6b888510e 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(`[data-qa="select-survey.categories"]`).should('exist').click(); + cy.get(`[data-qa="select-survey.categories"]`).find('.mzima-button').should('exist').click(); } add_post_to_category() { From ee92db42df248eab9aa35c1bfb4d1426be8750a6 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 12 Jul 2024 08:46:58 +0300 Subject: [PATCH 21/45] Add select categories and save field --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 ++ e2e-testing/cypress/locators/CategoryLocators.js | 1 + 2 files changed, 3 insertions(+) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index a6b888510e..37cb108eb7 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -99,6 +99,8 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); cy.get(`[data-qa="select-survey.categories"]`).find('.mzima-button').should('exist').click(); + cy.get(CategoryLocators.selectAllCategories).click(); + cy.get(CategoryLocators.saveFieldBtn).click(); } add_post_to_category() { diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index bb590bef03..632917bf99 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -25,6 +25,7 @@ const CategoryLocators = { postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', addNewFieldModal: '[data-qa="new-field-modal"]', + selectAllCategories: '[data-qa="select_all"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 5861087c9bda28cad1ea1c26b772bba93fc0db64 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 12 Jul 2024 09:38:08 +0300 Subject: [PATCH 22/45] Change the target for the categories button --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 37cb108eb7..aaf1d5f833 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(`[data-qa="select-survey.categories"]`).find('.mzima-button').should('exist').click(); + cy.get('.mzima-button').eq(14).click(); cy.get(CategoryLocators.selectAllCategories).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From 45fc843882ab6e326c0c6730292d61911928a628 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 12 Jul 2024 10:32:04 +0300 Subject: [PATCH 23/45] Change the target for the categories button --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index aaf1d5f833..710a65f6f7 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get('.mzima-button').eq(14).click(); + cy.get(CategoryLocators.selectCategoryField).click(); cy.get(CategoryLocators.selectAllCategories).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From 6802016220cc690770332a5592eac6a184de7c1d Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 12 Jul 2024 11:41:24 +0300 Subject: [PATCH 24/45] Specify the button to select --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 710a65f6f7..8158cc7328 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get(CategoryLocators.selectCategoryField).click(); + cy.get('.mzima-button').eq(29).click(); cy.get(CategoryLocators.selectAllCategories).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From c91a09e04338cb6638498b2c5235e6451d435c45 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 12 Jul 2024 12:00:32 +0300 Subject: [PATCH 25/45] Change the index of the button --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 8158cc7328..2ec7f5d739 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -98,7 +98,7 @@ class CategoryFunctions { cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get('.mzima-button').eq(29).click(); + cy.get('.mzima-button').eq(20).click(); cy.get(CategoryLocators.selectAllCategories).click(); cy.get(CategoryLocators.saveFieldBtn).click(); } From 68a22cd3efd7571ba0dc0302a536c89e2139d2e7 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 16 Jul 2024 10:32:34 +0300 Subject: [PATCH 26/45] Change strategy of test --- .../cypress/functions/CategoryFunctions.js | 19 ++++++------------- .../cypress/locators/CategoryLocators.js | 10 +--------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 2ec7f5d739..98a9aaf2e1 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -91,25 +91,18 @@ class CategoryFunctions { cy.get(CategoryLocators.savePostBtn).click(); } - create_survey_with_category() { - this.open_settings(); - this.open_surveys(); - this.add_survey(); - cy.get(CategoryLocators.surveyNameField).type('Survey title with categories'); - cy.get(CategoryLocators.surveyDescriptionField).type('Survey description with categories'); - cy.get(CategoryLocators.addNewFieldBtn).click(); - cy.get('.mzima-button').eq(20).click(); - cy.get(CategoryLocators.selectAllCategories).click(); - cy.get(CategoryLocators.saveFieldBtn).click(); - } - add_post_to_category() { this.click_add_post_btn(); + //open a survey form to fill in a response this.open_survey_with_categories(); cy.wait(1000); + //verify categories are seen as expected + cy.get('mat-label').contains('Categories'); + cy.get('.related-post-list').should('exist'); + //filling in fields and select category this.type_post_title('New Post Title'); this.type_post_description('New Post Description'); - cy.get('mat-checkbox-214-input').click(); + cy.get('.mat-checkbox-14-input').click(); this.save_post(); cy.get(CategoryLocators.successBtn).click(); } diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 632917bf99..50de9cb0b3 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -13,19 +13,11 @@ const CategoryLocators = { technologyCheckbox: '[data-qa="technology"]', adminCheckbox: '[data-qa="admin"]', addPostBtn: '[data-qa="submit-post-button"]', - categoryTestSurvey: '[data-qa="add-post-modal-surveys-item701"]', + categoryTestSurvey: '[data-qa="add-post-modal-surveys-item188"]', addSurveyBtn: '[data-qa="btn-settings-create"]', - surveyNameField: '[data-qa="name"]', - surveyDescriptionField: '[data-qa="description"]', - addNewFieldBtn: '[data-qa="btn-survey-add-field"]', - selectCategoryField: '[data-qa="select-survey.categories"]', - selectCategory: '[data-qa="tag-Automated Parent-Category...."]', - saveFieldBtn: '[data-qa="btn-add-field"]', postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', - addNewFieldModal: '[data-qa="new-field-modal"]', - selectAllCategories: '[data-qa="select_all"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From ad1ae38381c9d006e8505d23fe87d4d7ec7f9172 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 16 Jul 2024 10:53:09 +0300 Subject: [PATCH 27/45] Remove unnecessary function --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index b2c15a5d90..d23f117889 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -15,7 +15,6 @@ describe('Automated Tests for Categories', () => { categoryFunctions.add_category_details_steps(); categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); - categoryFunctions.create_survey_with_category(); - // categoryFunctions.add_post_to_category(); + categoryFunctions.add_post_to_category(); }); }); From 6a6fc43f4fdcb09127c8e9f771ae1bca098771f7 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 16 Jul 2024 11:58:11 +0300 Subject: [PATCH 28/45] Separate the add category function from open categories --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 3 +++ e2e-testing/cypress/functions/CategoryFunctions.js | 12 ------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index d23f117889..3e252be53d 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -15,6 +15,9 @@ describe('Automated Tests for Categories', () => { categoryFunctions.add_category_details_steps(); categoryFunctions.complete_add_category_steps(); categoryFunctions.verify_created_category_exists(); + }); + + it('Add Post to Categories', () => { categoryFunctions.add_post_to_category(); }); }); diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 98a9aaf2e1..89537297aa 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -67,18 +67,6 @@ class CategoryFunctions { cy.get(CategoryLocators.categoryTestSurvey).click(); } - open_settings() { - cy.get(CategoryLocators.stngsBtn).click(); - } - - open_surveys() { - cy.get(CategoryLocators.surveyBtn).click(); - } - - add_survey() { - cy.get(CategoryLocators.addSurveyBtn).click(); - } - type_post_title(title) { cy.get(CategoryLocators.postTitleField).should('be.visible').type(title, { force: true }); } From 85afc9a0c5b4249298fe3a56f0339733a77198c3 Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 16 Jul 2024 12:21:20 +0300 Subject: [PATCH 29/45] Add more steps to add to category --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 3e252be53d..057e656ea3 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -18,6 +18,9 @@ describe('Automated Tests for Categories', () => { }); it('Add Post to Categories', () => { + categoryFunctions.open_category_creation_page_steps(); + categoryFunctions.add_category_details_steps(); + categoryFunctions.complete_add_category_steps(); categoryFunctions.add_post_to_category(); }); }); From 17b3547c7af6f2fd796c77733ff77c052cd9c4df Mon Sep 17 00:00:00 2001 From: Shakira Date: Tue, 16 Jul 2024 12:49:50 +0300 Subject: [PATCH 30/45] Add before each for every e2e test --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 057e656ea3..955daefe8f 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -5,7 +5,7 @@ describe('Automated Tests for Categories', () => { const loginFunctions = new LoginFunctions(); const categoryFunctions = new CategoryFunctions(); - before(() => { + beforeEach(() => { loginFunctions.login_as_admin(); cy.visit(Cypress.env('baseUrl')); }); From d1e76d4caeffc223bc91934bdde15706dde5e080 Mon Sep 17 00:00:00 2001 From: Shakira Date: Wed, 17 Jul 2024 08:53:02 +0300 Subject: [PATCH 31/45] Edit the id for the survey item --- e2e-testing/cypress/locators/CategoryLocators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 50de9cb0b3..ca9d960ed8 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -13,7 +13,7 @@ const CategoryLocators = { technologyCheckbox: '[data-qa="technology"]', adminCheckbox: '[data-qa="admin"]', addPostBtn: '[data-qa="submit-post-button"]', - categoryTestSurvey: '[data-qa="add-post-modal-surveys-item188"]', + categoryTestSurvey: '[data-qa="add-post-modal-surveys-item559"]', addSurveyBtn: '[data-qa="btn-settings-create"]', postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', From 3f81b36a43dc1bb3d79eeb48beed5072524ebb3b Mon Sep 17 00:00:00 2001 From: Shakira Date: Wed, 17 Jul 2024 09:16:21 +0300 Subject: [PATCH 32/45] Remove unnecessary steps --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index 955daefe8f..fa91cebb26 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -18,9 +18,6 @@ describe('Automated Tests for Categories', () => { }); it('Add Post to Categories', () => { - categoryFunctions.open_category_creation_page_steps(); - categoryFunctions.add_category_details_steps(); - categoryFunctions.complete_add_category_steps(); categoryFunctions.add_post_to_category(); }); }); From b6102a6ab08f4c4fabff5cb47470e375cf8cd0c0 Mon Sep 17 00:00:00 2001 From: Shakira Date: Wed, 17 Jul 2024 09:29:34 +0300 Subject: [PATCH 33/45] Specify survey to add post to --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- e2e-testing/cypress/locators/CategoryLocators.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 89537297aa..576abcd67e 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -64,7 +64,7 @@ class CategoryFunctions { } open_survey_with_categories() { - cy.get(CategoryLocators.categoryTestSurvey).click(); + cy.get(CategoryLocators.postSurveys).contains('Automated Parent Category').click(); } type_post_title(title) { diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index ca9d960ed8..3475da2834 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -12,8 +12,7 @@ const CategoryLocators = { translationCheckbox: '[data-qa="translation"]', technologyCheckbox: '[data-qa="technology"]', adminCheckbox: '[data-qa="admin"]', - addPostBtn: '[data-qa="submit-post-button"]', - categoryTestSurvey: '[data-qa="add-post-modal-surveys-item559"]', + postSurveys: '[data-qa="add-post-modal-surveys"]', addSurveyBtn: '[data-qa="btn-settings-create"]', postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', From 1c80ba6ddd33e3256191f7eec476b5cbe9b1364e Mon Sep 17 00:00:00 2001 From: Shakira Date: Wed, 17 Jul 2024 10:30:28 +0300 Subject: [PATCH 34/45] Add the click add post button locator --- e2e-testing/cypress/locators/CategoryLocators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 3475da2834..a79f14318e 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -17,6 +17,7 @@ const CategoryLocators = { postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', + addPostBtn: '[data-qa="submit-post-button"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 5f07d3c7c8ad67c203047f6d223cd0db06922698 Mon Sep 17 00:00:00 2001 From: Shakira Date: Wed, 17 Jul 2024 12:49:53 +0300 Subject: [PATCH 35/45] Add the click add post button locator --- e2e-testing/cypress/functions/CategoryFunctions.js | 4 ++-- e2e-testing/cypress/locators/CategoryLocators.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 576abcd67e..027e4815c1 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -60,11 +60,11 @@ class CategoryFunctions { } click_add_post_btn() { - cy.get(CategoryLocators.addPostBtn).click({ force: true }); + cy.get(CategoryLocators.addPostBtn).click(); } open_survey_with_categories() { - cy.get(CategoryLocators.postSurveys).contains('Automated Parent Category').click(); + cy.get(CategoryLocators.surveySelectItem).click(); } type_post_title(title) { diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index a79f14318e..3fbc8b297f 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -12,7 +12,7 @@ const CategoryLocators = { translationCheckbox: '[data-qa="translation"]', technologyCheckbox: '[data-qa="technology"]', adminCheckbox: '[data-qa="admin"]', - postSurveys: '[data-qa="add-post-modal-surveys"]', + surveySelectItem: '[data-qa="add-post-modal-surveys-item188"]', addSurveyBtn: '[data-qa="btn-settings-create"]', postTitleField: '[data-qa="null"]', postDescField: '[data-qa="description"]', From f8b7d175fb3829aa3d20e510ce052d1912f01b36 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 08:18:38 +0300 Subject: [PATCH 36/45] Change the post title locator --- e2e-testing/cypress/locators/CategoryLocators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 3fbc8b297f..339a8c9040 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -14,7 +14,7 @@ const CategoryLocators = { adminCheckbox: '[data-qa="admin"]', surveySelectItem: '[data-qa="add-post-modal-surveys-item188"]', addSurveyBtn: '[data-qa="btn-settings-create"]', - postTitleField: '[data-qa="null"]', + postTitleField: '[data-qa="title"]', postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', addPostBtn: '[data-qa="submit-post-button"]', From 4e98bc77fb418483808fca5fe4c374be75d88545 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 09:18:33 +0300 Subject: [PATCH 37/45] Change the checkbox class name --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 027e4815c1..60c077a1cd 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -90,7 +90,7 @@ class CategoryFunctions { //filling in fields and select category this.type_post_title('New Post Title'); this.type_post_description('New Post Description'); - cy.get('.mat-checkbox-14-input').click(); + cy.get('.mat-checkbox-16-input').click(); this.save_post(); cy.get(CategoryLocators.successBtn).click(); } From e336478705e18e4edd004fb358bf72fd2c72f6df Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 10:28:07 +0300 Subject: [PATCH 38/45] Change reference to ID name --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 60c077a1cd..c398525292 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -90,7 +90,7 @@ class CategoryFunctions { //filling in fields and select category this.type_post_title('New Post Title'); this.type_post_description('New Post Description'); - cy.get('.mat-checkbox-16-input').click(); + cy.get('#mat-checkbox-16-input').click(); this.save_post(); cy.get(CategoryLocators.successBtn).click(); } From 5c3db503201d9f40a904d838cf65c33d0236d160 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 10:48:55 +0300 Subject: [PATCH 39/45] Add force true --- e2e-testing/cypress/functions/CategoryFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index c398525292..3aaf16ba14 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -90,7 +90,7 @@ class CategoryFunctions { //filling in fields and select category this.type_post_title('New Post Title'); this.type_post_description('New Post Description'); - cy.get('#mat-checkbox-16-input').click(); + cy.get('#mat-checkbox-16-input').click({ force: true }); this.save_post(); cy.get(CategoryLocators.successBtn).click(); } From 1bc2dd685b1e6d411e3e6e52f6537dc1ec155a76 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 11:10:38 +0300 Subject: [PATCH 40/45] Add confirm success button locator --- e2e-testing/cypress/locators/CategoryLocators.js | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 339a8c9040..93c8a0c19b 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -18,6 +18,7 @@ const CategoryLocators = { postDescField: '[data-qa="description"]', savePostBtn: '[data-qa="btn-post-item-submit"]', addPostBtn: '[data-qa="submit-post-button"]', + successBtn: '[data-qa="btn-confirm-success"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 799fdce642c7b5f8564dac95b9b47ffecb80886e Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 11:54:02 +0300 Subject: [PATCH 41/45] Verify that a post is added to a category --- e2e-testing/cypress/functions/CategoryFunctions.js | 7 +++++++ e2e-testing/cypress/locators/CategoryLocators.js | 2 ++ 2 files changed, 9 insertions(+) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 3aaf16ba14..29c1011695 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -105,6 +105,13 @@ class CategoryFunctions { ); } + verify_post_with_categories_exists() { + cy.get(CategoryLocators.postPreview) + .children(CategoryLocators.postItem) + .contains('New Post Title') + .should('be.visible'); + } + verify_created_category_exists() { cy.contains(this.uniqueParentCtgry).should('exist'); } diff --git a/e2e-testing/cypress/locators/CategoryLocators.js b/e2e-testing/cypress/locators/CategoryLocators.js index 93c8a0c19b..bb13c9f06e 100644 --- a/e2e-testing/cypress/locators/CategoryLocators.js +++ b/e2e-testing/cypress/locators/CategoryLocators.js @@ -19,6 +19,8 @@ const CategoryLocators = { savePostBtn: '[data-qa="btn-post-item-submit"]', addPostBtn: '[data-qa="submit-post-button"]', successBtn: '[data-qa="btn-confirm-success"]', + postPreview: '[data-qa="post-preview"]', + postItem: '[data-qa="post-item"]', }; export const getUniqueSelector = (name) => name.split(' ').join('-').toLowerCase(); From 760d8a3f6e5e0aea8a2b885f59b35da38ef2c642 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 11:57:32 +0300 Subject: [PATCH 42/45] Add step to add post to category --- e2e-testing/cypress/e2e/5-categories/category.cy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-testing/cypress/e2e/5-categories/category.cy.js b/e2e-testing/cypress/e2e/5-categories/category.cy.js index fa91cebb26..fa71665d5e 100644 --- a/e2e-testing/cypress/e2e/5-categories/category.cy.js +++ b/e2e-testing/cypress/e2e/5-categories/category.cy.js @@ -19,5 +19,6 @@ describe('Automated Tests for Categories', () => { it('Add Post to Categories', () => { categoryFunctions.add_post_to_category(); + categoryFunctions.verify_post_with_categories_exists(); }); }); From 0c9d39c15483e3d3103dc9efe2385678d1d3fe41 Mon Sep 17 00:00:00 2001 From: Shakira Date: Thu, 18 Jul 2024 12:25:27 +0300 Subject: [PATCH 43/45] Rename a post with categories --- e2e-testing/cypress/functions/CategoryFunctions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 29c1011695..5d62e17f1e 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -88,8 +88,8 @@ class CategoryFunctions { cy.get('mat-label').contains('Categories'); cy.get('.related-post-list').should('exist'); //filling in fields and select category - this.type_post_title('New Post Title'); - this.type_post_description('New Post Description'); + this.type_post_title('New Post Title With Categories'); + this.type_post_description('New Post Description With Categories'); cy.get('#mat-checkbox-16-input').click({ force: true }); this.save_post(); cy.get(CategoryLocators.successBtn).click(); @@ -108,8 +108,10 @@ class CategoryFunctions { verify_post_with_categories_exists() { cy.get(CategoryLocators.postPreview) .children(CategoryLocators.postItem) - .contains('New Post Title') - .should('be.visible'); + .contains('New Post Title With Categories') + .should('be.visible') + .click(); + cy.get('.post__group').find('.category').exists(); } verify_created_category_exists() { From 07b8dfdf674ff6b111e8e35d9e4e018d28d6bc9d Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 19 Jul 2024 06:24:43 +0300 Subject: [PATCH 44/45] Remove unnecessary changes --- e2e-testing/cypress/functions/CategoryFunctions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 5d62e17f1e..31c11c8c6f 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -111,7 +111,6 @@ class CategoryFunctions { .contains('New Post Title With Categories') .should('be.visible') .click(); - cy.get('.post__group').find('.category').exists(); } verify_created_category_exists() { From dfb0430608966abfa2a2d2c54d839e8dbcac4411 Mon Sep 17 00:00:00 2001 From: Shakira Date: Fri, 19 Jul 2024 08:33:19 +0300 Subject: [PATCH 45/45] Remove click on post --- e2e-testing/cypress/functions/CategoryFunctions.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e-testing/cypress/functions/CategoryFunctions.js b/e2e-testing/cypress/functions/CategoryFunctions.js index 31c11c8c6f..d82379528a 100644 --- a/e2e-testing/cypress/functions/CategoryFunctions.js +++ b/e2e-testing/cypress/functions/CategoryFunctions.js @@ -109,8 +109,7 @@ class CategoryFunctions { cy.get(CategoryLocators.postPreview) .children(CategoryLocators.postItem) .contains('New Post Title With Categories') - .should('be.visible') - .click(); + .should('be.visible'); } verify_created_category_exists() {