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 for adding a post to a collection #1017

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1c386a3
Update the e2e tests for the collections
Apr 3, 2024
80e1318
Add option to the specify post items
Apr 3, 2024
8803d52
Update the checkbox option
Apr 3, 2024
e041756
Add force true to click button
Apr 3, 2024
05432b4
Edit the close button locator
Apr 3, 2024
31c930f
Add force true to click button
Apr 3, 2024
808de7d
Remove unnecessary children method from cypress function
Apr 3, 2024
509e25a
Fix merge conflicts
Apr 12, 2024
92631cd
Add changes to post to collection fucntion
Apr 15, 2024
524b627
Add data-qa attribute to add to collection field
Apr 15, 2024
f5f2055
Remove the unnecessary data-qa
Apr 15, 2024
148f7e8
Add function to create collection
Apr 15, 2024
553b286
Add success button click to create collection funtion
Apr 15, 2024
417d122
Add id to collection
Apr 15, 2024
64b4751
Change the collection id to the correct figure
Apr 15, 2024
00aa8c1
Specify collection and change checkbox id
Apr 16, 2024
de8fb5e
Add wait command to the function
Apr 16, 2024
40790b9
Reload the data
Apr 16, 2024
b0a3305
Add wait command
Apr 16, 2024
0c99d5d
Add click to the data view
Apr 16, 2024
ce0e062
Add wait command
Apr 16, 2024
200a334
Add reload
Apr 16, 2024
aeb35c3
Rename commands from response to reload
Apr 16, 2024
a3905a3
Implement feedback
Apr 16, 2024
c8d882f
Add the force true to click
Apr 16, 2024
5362625
Fix failing tests
Apr 16, 2024
7ba48e4
Change the function to verify the post is added to the collection
Apr 16, 2024
c2be287
Remove wait commands and reload
Apr 16, 2024
5afcd91
Merge branch 'development' of https://github.com/ushahidi/platform-cl…
Apr 16, 2024
cb5843a
Fix merge conflicts
Apr 26, 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 @@ -31,7 +31,7 @@
class="post-head__control post-head__control--dots"
[matMenuTriggerFor]="actions"
>
<mat-icon icon svgIcon="dots"></mat-icon>
<mat-icon icon svgIcon="dots" [data-qa]="'more-post-actions'"></mat-icon>
</mzima-client-button>

<mat-menu #actions="matMenu" xPosition="before">
Expand All @@ -42,6 +42,7 @@
"
mat-menu-item
(click)="addToCollection()"
[data-qa]="'add-collection-to-post'"
>
<mat-icon svgIcon="collections"></mat-icon>
{{ 'set.add_to_collection' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
class="collection-item"
(click)="selectable && changeChecked($event)"
[ngClass]="{ 'collection-item--has-checkbox': selectable }"
[attr.data-qa]="'collection-item'"
[attr.data-qa]="'collection-item' + collection.id"
>
<div *ngIf="selectable" class="collection-item__checkbox" (click)="$event.preventDefault()">
<div
*ngIf="selectable"
class="collection-item__checkbox"
(click)="$event.preventDefault()"
[attr.data-qa]="'collection-item-checkbox'"
>
<mat-checkbox [checked]="checked"> </mat-checkbox>
</div>
<div class="collection-item__actions" *ngIf="actions && !selectable">
Expand Down
2 changes: 1 addition & 1 deletion e2e-testing/cypress/e2e/7-collections/collections.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("Automated Tests for Collections", () => {
collectionFunctions.create_collection();
});

it.skip("Add post to collection", ()=>{
it("Add post to collection", ()=>{
collectionFunctions.add_post_to_collection();
})
});
21 changes: 14 additions & 7 deletions e2e-testing/cypress/functions/CollectionFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CollectionFunctions {

save_collection() {
cy.get(CollectionLocators.saveCollectionBtn).click();
cy.get(CollectionLocators.successBtn).click();
}

open_collections() {
Expand Down Expand Up @@ -49,12 +50,18 @@ class CollectionFunctions {
cy.get(CollectionLocators.postCheckBox).click({ force: true });
this.save_post();
cy.get(CollectionLocators.successBtn).click();
}

verify_post_added_to_collection() {
this.open_collections();
this.select_collections();
cy.contains('Post Title').should('exist');
cy.get(CollectionLocators.postItem).eq(0).find(CollectionLocators.morePostActionsBtn).click();
cy.get(CollectionLocators.addCollectionToPostCheckbox).click();
cy.get(CollectionLocators.selectCollection)
.children(CollectionLocators.collectionCheckbox)
.click();
cy.get(CollectionLocators.closeCollectionModalBtn).click();
cy.get(CollectionLocators.collectionBtn).click();
cy.get(CollectionLocators.collectionItem).click({ force: true });
cy.get(CollectionLocators.dataViewBtn).click({ force: true });
cy.get(CollectionLocators.postPreview)
.children(CollectionLocators.postItem)
.contains('Post Title');
}

create_collection() {
Expand All @@ -67,8 +74,8 @@ class CollectionFunctions {
}

add_post_to_collection() {
this.create_collection();
this.post_to_collection();
this.verify_post_added_to_collection();
}
}

Expand Down
12 changes: 10 additions & 2 deletions e2e-testing/cypress/locators/CollectionLocators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const CollectionLocators = {
collectionDescField: '[data-qa="description"]',
onlyMeRadio: '[data-qa="only-me"]',
saveCollectionBtn: '[data-qa="save-collection-btn"]',
selectCollection: '[data-qa="collection-item"]',
selectCollection: '[data-qa="collection-item270"]',
collectionCheckbox: '[data-qa="collection-item-checkbox"]',
surveyItem: '[data-qa="add-post-modal-surveys-item2"]',
submitPostButton: '[data-qa="submit-post-button"]',
surveySelectionList: '[data-qa="survey-selection-list"]',
Expand All @@ -19,8 +20,15 @@ const CollectionLocators = {
surveySelectItem: '[data-qa="survey-select-item2"]',
addPostButton: '[data-qa="submit-post-button"]',
saveCollectionButton: '[data-qa="save-collection-btn"]',
collectionItem: '[data-qa="collection-item"]',
collectionItem: '[data-qa="collection-item270"]',
visibilityOption: '[data-qa="option"]',
postItem: '[data-qa="post-item"]',
morePostActionsBtn: '[data-qa="more-post-actions"]',
addCollectionToPostCheckbox: '[data-qa="add-collection-to-post"]',
closeCollectionModalBtn: '[data-qa="btn-close"]',
dataViewBtn: '[data-qa="btn-data"]',
postPreview: '[data-qa="post-preview"]',
postItem: '[data-qa="post-item"]',
};

export default CollectionLocators;
Loading