Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2e tests add post to categories #1169

Open
wants to merge 53 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3bf79de
Add e2e tests for adding posts to categories
May 6, 2024
b7ed658
Add the functions to edited files
May 6, 2024
12b5f14
Fix the failing tests
May 6, 2024
4158819
Fix the failing tests
May 6, 2024
fd42fad
Rename locators file
May 6, 2024
07c66b4
Add force true
May 7, 2024
6743b54
Merge branch 'development' of https://github.com/ushahidi/platform-cl…
May 8, 2024
d8dab3a
Merge branch 'development' of https://github.com/ushahidi/platform-cl…
May 10, 2024
b32af4d
Update branch with development changes
May 10, 2024
0840574
Add the force true
May 13, 2024
49c5d40
Fix failing test
May 13, 2024
e3bfe83
Figure out the failing tests
May 13, 2024
6793625
Remove force true
May 13, 2024
7ad03bd
Try out alternative for clicking on div
May 13, 2024
8810734
Try out alternative for clicking on div
May 13, 2024
3599a9a
Merge branch 'development' of https://github.com/ushahidi/platform-cl…
May 27, 2024
172c771
Implement triggering click on div
May 27, 2024
f8f358e
Add check for is active
May 28, 2024
dfdd466
Change should command
May 28, 2024
57d923b
Merge branch 'development' of https://github.com/ushahidi/platform-cl…
Jul 10, 2024
f54e7ac
Put quotes in function
Jul 11, 2024
87ef964
Uncomment the add post to category function
Jul 11, 2024
795c58a
Add function for the select survey categories
Jul 11, 2024
90d9686
Fix failing test
Jul 11, 2024
ee92db4
Add select categories and save field
Jul 12, 2024
5861087
Change the target for the categories button
Jul 12, 2024
45fc843
Change the target for the categories button
Jul 12, 2024
6802016
Specify the button to select
Jul 12, 2024
c91a09e
Change the index of the button
Jul 12, 2024
68a22cd
Change strategy of test
Jul 16, 2024
ad1ae38
Remove unnecessary function
Jul 16, 2024
6a6fc43
Separate the add category function from open categories
Jul 16, 2024
85afc9a
Add more steps to add to category
Jul 16, 2024
17b3547
Add before each for every e2e test
Jul 16, 2024
d1e76d4
Edit the id for the survey item
Jul 17, 2024
3f81b36
Remove unnecessary steps
Jul 17, 2024
b6102a6
Specify survey to add post to
Jul 17, 2024
1c80ba6
Add the click add post button locator
Jul 17, 2024
5f07d3c
Add the click add post button locator
Jul 17, 2024
f8b7d17
Change the post title locator
Jul 18, 2024
4e98bc7
Change the checkbox class name
Jul 18, 2024
e336478
Change reference to ID name
Jul 18, 2024
5c3db50
Add force true
Jul 18, 2024
1bc2dd6
Add confirm success button locator
Jul 18, 2024
799fdce
Verify that a post is added to a category
Jul 18, 2024
760d8a3
Add step to add post to category
Jul 18, 2024
0c9d39c
Rename a post with categories
Jul 18, 2024
07b8dfd
Remove unnecessary changes
Jul 19, 2024
dfb0430
Remove click on post
Jul 19, 2024
a65e9f0
Fix merge conflicts
Jul 19, 2024
876c2f0
Merge branch 'development' into e2e-tests-add-post-to-categories
shakirandagire Jul 23, 2024
4a97f0b
Merge branch 'development' into e2e-tests-add-post-to-categories
shakirandagire Aug 13, 2024
41a0399
Merge branch 'development' into e2e-tests-add-post-to-categories
AmTryingMyBest Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<strong mat-dialog-title>{{
isTranslateMode ? ('form.translate_field' | translate) : ('form.add_field' | translate)
}}</strong>
<mat-dialog-content>
<mat-dialog-content [data-qa]="'new-field-modal'">
<ng-container *ngIf="selectedFieldType; else allFields">
<ng-container *ngIf="!isTranslateMode; else translateMode">
<div class="form-row">
Expand Down
6 changes: 6 additions & 0 deletions e2e-testing/cypress/e2e/5-categories/category.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ describe('Automated Tests for Categories', () => {
categoryFunctions.verify_created_category_exists();
});

//Adds post to categories
it('Add Post to Categories', () => {
categoryFunctions.add_post_to_category();
categoryFunctions.verify_post_with_categories_exists();
});

//Deletes category called Children B
it('Deletes a child Category - Bulk Actions', () => {
categoryFunctions.open_category_list_page();
Expand Down
43 changes: 43 additions & 0 deletions e2e-testing/cypress/functions/CategoryFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,42 @@ class CategoryFunctions {
).click();
}

click_add_post_btn() {
cy.get(CategoryLocators.addPostBtn).click();
}

open_survey_with_categories() {
cy.get(CategoryLocators.surveySelectItem).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 });
}

save_post() {
cy.get(CategoryLocators.savePostBtn).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 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();
}

verify_visibility_matches_parent() {
cy.wait(1000);
cy.get(CategoryLocators.selectParentCtgry).click();
Expand All @@ -134,6 +170,13 @@ class CategoryFunctions {
);
}

verify_post_with_categories_exists() {
cy.get(CategoryLocators.postPreview)
.children(CategoryLocators.postItem)
.contains('New Post Title With Categories')
.should('be.visible');
}

verify_created_category_exists() {
cy.contains(this.uniqueParentCtgry).should('exist');
}
Expand Down
10 changes: 10 additions & 0 deletions e2e-testing/cypress/locators/CategoryLocators.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const CategoryLocators = {
dataViewBtn: '[data-qa="btn-data"]',
categoryFilterBtn: '[data-qa="categories-filter"]',
stngsBtn: '[data-qa="btn-settings"]',
surveyBtn: '[data-qa="btn-surveys"]',
ctgryBtn: '[data-qa="btn-categories"]',
addCategoryBtn: '[data-qa="btn-settings-create"]',
blkActionsBtn: '[data-qa="btn-settings-action"]',
Expand All @@ -16,6 +17,15 @@ const CategoryLocators = {
translationCheckbox: '[data-qa="translation"]',
technologyCheckbox: '[data-qa="technology"]',
adminCheckbox: '[data-qa="admin"]',
surveySelectItem: '[data-qa="add-post-modal-surveys-item188"]',
addSurveyBtn: '[data-qa="btn-settings-create"]',
postTitleField: '[data-qa="title"]',
postDescField: '[data-qa="description"]',
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"]',
categoryDeleteBtn: '[data-qa="btn-category-delete"]',
toggleChildrenBtn: '[data-qa="toggle-children"]',
};
Expand Down
Loading