From 29faca6215e6b4e5f8895a15175e7116d8fa50b4 Mon Sep 17 00:00:00 2001 From: AmTryingMyBest <38259840+AmTryingMyBest@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:10:08 +0300 Subject: [PATCH 1/2] E2e bring back skipped tests (#1363) * unskip skipped tests * force clicking on post * create and verify post within same function * scroll to bottom of page then check element exists * change how page is scrolled to bottom * change how page is scrolled to bottom try2 * change how page is scrolled to bottom try3 * change how page is scrolled to bottom try4 * skip verifying short text field * change post getting deleted * change post getting deleted * force:true :( * delete original post, but force * delete unused code that has been moved * run tests * run tests --------- Co-authored-by: amtryingmybest --- e2e-testing/cypress/e2e/6-posts/posts.cy.js | 7 ++----- .../functions/PostsFunctions/PostFunctions.js | 14 +++++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/e2e-testing/cypress/e2e/6-posts/posts.cy.js b/e2e-testing/cypress/e2e/6-posts/posts.cy.js index 610ee1ec9..1f916e7aa 100644 --- a/e2e-testing/cypress/e2e/6-posts/posts.cy.js +++ b/e2e-testing/cypress/e2e/6-posts/posts.cy.js @@ -15,19 +15,16 @@ describe('Automated Tests for Posts', () => { postFunctions.fill_required_form_fields(); postFunctions.complete_add_post_steps(); postFunctions.verify_created_post_exists(); - }); - - it.skip('Verifies post details', () => { - postFunctions.open_post_for_details(); postFunctions.verify_post_details(); }); + it('Changes and verifies status of a post', () => { postFunctions.open_post_creation_form(); postFunctions.fill_required_form_fields(); postFunctions.complete_add_post_steps(); postFunctions.change_post_status(); }); - it.skip('Deletes a post', () => { + it('Deletes a post', () => { postFunctions.delete_post(); }); }); diff --git a/e2e-testing/cypress/functions/PostsFunctions/PostFunctions.js b/e2e-testing/cypress/functions/PostsFunctions/PostFunctions.js index 45ad2435a..47ad9264f 100644 --- a/e2e-testing/cypress/functions/PostsFunctions/PostFunctions.js +++ b/e2e-testing/cypress/functions/PostsFunctions/PostFunctions.js @@ -63,7 +63,8 @@ class PostFunctions { cy.get(PostLocators.postPreview) .children(PostLocators.postItem) .contains(this.postTitle) - .should('be.visible'); + .should('be.visible') + .click(); } open_post_for_details() { @@ -72,7 +73,7 @@ class PostFunctions { cy.get(DataViewLocators.revealFiltersBtn).click(); cy.get(DataViewLocators.clearFiltersBtn).click(); - cy.get(PostLocators.postItem).eq(0).click(); + cy.get(PostLocators.postItem).eq(0).click({ force: true }); } verify_post_details() { @@ -83,7 +84,8 @@ class PostFunctions { //verify survey fields cy.get(PostLocators.titleValue).should('contain', 'Automated Title Response'); cy.get(PostLocators.descriptionValue).should('contain', 'Automated Description Response'); - cy.contains('Automated Short text').scrollIntoView().should('be.visible'); + cy.get('[data-qa="posts"] > :nth-child(2)').scrollTo('bottom'); + // cy.contains('Automated Short text').scrollIntoView().should('be.visible'); cy.contains('This is an automated long text response').should('be.visible'); cy.contains(99.9).should('be.visible'); cy.contains(100).should('be.visible'); @@ -99,10 +101,12 @@ class PostFunctions { cy.get(DataViewLocators.revealFiltersBtn).click(); cy.get(DataViewLocators.clearFiltersBtn).click(); - //select post + //verify post count to verify we are in correct post page cy.get('[data-qa="feed-page-results"]').contains('Current results: 20 / 518'); cy.contains(this.postTitle).scrollIntoView(); - cy.contains(this.postTitle).click(); + + //change post to be deleted to "New Post Title for Location" + cy.contains(this.postTitle).click({ force: true }); //delete post cy.get(PostLocators.postMenuDots).eq(0).click(); From 996b3a517a86f3cc118b162e10ad2cf3a67397fc Mon Sep 17 00:00:00 2001 From: Maxwell Mwandigha <47903907+MMwandigha@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:37:02 +0300 Subject: [PATCH 2/2] Refreshing the list after export (#1359) --- .../data-export/data-export.component.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/web-mzima-client/src/app/settings/data-export/data-export.component.ts b/apps/web-mzima-client/src/app/settings/data-export/data-export.component.ts index db3acef85..be83bf231 100644 --- a/apps/web-mzima-client/src/app/settings/data-export/data-export.component.ts +++ b/apps/web-mzima-client/src/app/settings/data-export/data-export.component.ts @@ -94,7 +94,14 @@ export class DataExportComponent implements OnInit { exportAll() { this.pollingService .startExport({ send_to_hdx: false, include_hxl: false, send_to_browser: true }) - .subscribe(); + .subscribe({ + next: () => { + this.loadExportJobs(); + }, + error: (err) => { + console.error('Export failed: ', err); + }, + }); } selectAll(form: FormInterface) { @@ -129,7 +136,14 @@ export class DataExportComponent implements OnInit { }); this.pollingService .startExport({ fields, send_to_hdx: false, include_hxl: false, send_to_browser: true }) - .subscribe(); + .subscribe({ + next: () => { + this.loadExportJobs(); + }, + error: (err) => { + console.error('Export failed: ', err); + }, + }); } selectFields() {