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 data view bulk actions select all #1185

Open
wants to merge 13 commits into
base: development
Choose a base branch
from
3 changes: 3 additions & 0 deletions apps/web-mzima-client/src/app/feed/feed.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<div
class="feed-page__controls feed-page__controls--actions"
*ngIf="isDesktop || isBulkOptionsVisible"
[attr.data-qa]="'feed-page-controls-actions'"
>
<ng-container *ngIf="isBulkOptionsVisible">
<mzima-client-button
Expand Down Expand Up @@ -112,6 +113,7 @@ <h3 class="menu-title">{{ 'app.mark_as' | translate }}</h3>
[disabled]="!selectedPosts.length"
[placeholder]="'app.mark_as' | translate"
(selectionChange)="changePostsStatus($event.value)"
[attr.data-qa]="'mark-as'"
>
<mat-option
*ngFor="let status of statuses"
Expand Down Expand Up @@ -152,6 +154,7 @@ <h3 class="menu-title">{{ 'app.mark_as' | translate }}</h3>
*ngIf="user?.allowed_privileges?.includes('update')"
(buttonClick)="toggleBulkOptions(!isBulkOptionsVisible)"
[disabled]="isLoading || !posts.length"
[attr.data-qa]="'bulk-actions'"
>
{{ 'post.modify.bulk_actions' | translate }}
</mzima-client-button>
Expand Down
4 changes: 4 additions & 0 deletions e2e-testing/cypress/e2e/12-data-view/data-view.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ describe('Automated Tests for Posts in the Data View', () => {
postFunctions.complete_add_post_steps();
dataViewFunctions.verify_post_appears_for_user();
});

it('Verify bulk actions select all posts', () => {
dataViewFunctions.verify_bulk_actions_select_all_posts();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@ class DataViewFunctions {
.children(DataViewLocators.postItem)
.contains('Automated Title Response');
}

verify_bulk_actions_select_all_posts() {
this.click_data_view_btn();
cy.wait(1000);
//check select all posts in the page
cy.get('button:contains("Bulk Actions")').click();
cy.get('button:contains("Select All")').click({ force: true });
//verify all posts are selected
cy.get(DataViewLocators.postPreview)
.children(DataViewLocators.postItem)
.find('.mat-checkbox-input')
.should('have.attr', 'aria-checked', 'true');
//change status of posts
cy.get(DataViewLocators.controlActionsBtn)
.find(DataViewLocators.markAsDropdown)
.click({ force: true });
cy.get('.mat-select-panel').find('#select-option-published').click();
//verify all posts have changed status
cy.get(DataViewLocators.postPreview)
.children(DataViewLocators.postItem)
.find(DataViewLocators.postStatus)
.contains('Published')
.should('be.visible');
}
}

export default DataViewFunctions;
5 changes: 4 additions & 1 deletion e2e-testing/cypress/locators/DataViewLocators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const DataViewLocators = {
surveySelectItem: '[data-qa="survey-select-item"]',
postPreview: '[data-qa="post-preview"]',
postItem: '[data-qa="post-item"]',
postStatus: '[data-qa="status"]',
feedPageResults: '[data-qa="feed-page-results"]',
mainResultsTotal: '[data-qa="search-form-main-filters-total"]',
clearBtn: '[data-qa="clear"]',
Expand All @@ -18,7 +19,9 @@ const DataViewLocators = {
publishPostBtn: '[data-qa="btn-publish-post"]',

postDetails: '[data-qa="post-details"]',

bulkActionsBtn: '[data-qa="bulk-actions"]',
controlActionsBtn: '[data-qa="feed-page-controls-actions"]',
markAsDropdown: '[data-qa="mark-as"]',
};

export default DataViewLocators;
Loading