From a63cc229fc7b8e36cf73fa2d24b665790f9ba7ec Mon Sep 17 00:00:00 2001 From: Veljko Date: Fri, 16 Jun 2023 13:06:39 +0200 Subject: [PATCH] Update nightly tests with proper locator and increase max duration [MAILPOET-5411] --- mailpoet/tests/performance/scenarios.js | 6 +++--- .../tests/performance/tests/lists-complex-segment.js | 11 ++++++++--- .../tests/performance/tests/newsletter-sending.js | 6 +++--- mailpoet/tests/performance/tests/settings-basic.js | 11 ++++++++--- .../tests/performance/tests/subscribers-adding.js | 2 +- .../tests/subscribers-trashing-restoring.js | 10 ++++++++++ 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/mailpoet/tests/performance/scenarios.js b/mailpoet/tests/performance/scenarios.js index afcaa05781..c93f0bb590 100644 --- a/mailpoet/tests/performance/scenarios.js +++ b/mailpoet/tests/performance/scenarios.js @@ -47,14 +47,14 @@ let scenarios = { executor: 'per-vu-iterations', vus: 1, iterations: 1, - maxDuration: '5m', + maxDuration: '10m', exec: 'pullRequests', }, nightlytests: { executor: 'per-vu-iterations', vus: 1, - iterations: 3, - maxDuration: '15m', + iterations: 1, + maxDuration: '30m', exec: 'nightly', }, }; diff --git a/mailpoet/tests/performance/tests/lists-complex-segment.js b/mailpoet/tests/performance/tests/lists-complex-segment.js index e185f97ad9..f738776325 100644 --- a/mailpoet/tests/performance/tests/lists-complex-segment.js +++ b/mailpoet/tests/performance/tests/lists-complex-segment.js @@ -141,15 +141,20 @@ export async function listsComplexSegment() { await page.waitForSelector('[data-automation-id="filters_all"]', { state: 'visible', }); + const locator = + "//div[@class='notice-success'].//p[starts-with(text(),'Segment successfully updated!')]"; describe(listsPageTitle, () => { describe('should be able to see Segment Updated message', () => { - expect(page.locator('div.notice').innerText()).to.contain( - 'Segment successfully updated!', - ); + expect(page.locator(locator)).to.exist; }); }); await page.waitForLoadState('networkidle'); + await page.screenshot({ + path: screenshotPath + 'Lists_Complex_Segment_05.png', + fullPage: fullPageSet, + }); + // Thinking time and closing sleep(randomIntBetween(thinkTimeMin, thinkTimeMax)); page.close(); diff --git a/mailpoet/tests/performance/tests/newsletter-sending.js b/mailpoet/tests/performance/tests/newsletter-sending.js index a3e85bb8c4..9049dabb3f 100644 --- a/mailpoet/tests/performance/tests/newsletter-sending.js +++ b/mailpoet/tests/performance/tests/newsletter-sending.js @@ -95,12 +95,12 @@ export async function newsletterSending() { }); // Wait for the success notice message and confirm it + const locator = + "//div[@class='notice-success'].//p[starts-with(text(),'Subscriber was added successfully!')]"; await page.waitForSelector('#mailpoet_notices'); describe(emailsPageTitle, () => { describe('should be able to see Newsletter Sent message', () => { - expect(page.locator('div > .notice-success').innerText()).to.contain( - 'The newsletter is being sent...', - ); + expect(page.locator(locator)).to.exist; }); }); await page.waitForLoadState('networkidle'); diff --git a/mailpoet/tests/performance/tests/settings-basic.js b/mailpoet/tests/performance/tests/settings-basic.js index e59648ee0a..8e208b11e4 100644 --- a/mailpoet/tests/performance/tests/settings-basic.js +++ b/mailpoet/tests/performance/tests/settings-basic.js @@ -56,14 +56,19 @@ export async function settingsBasic() { await page.waitForLoadState('networkidle'); // Check if there's notice about saved settings + const locator = + "//div[@class='notice-success'].//p[starts-with(text(),'Settings saved')]"; describe(settingsPageTitle, () => { describe('should be able to see Settings Saved message', () => { - expect(page.locator('div.notice').innerText()).to.contain( - 'Settings saved', - ); + expect(page.locator(locator)).to.exist; }); }); + await page.screenshot({ + path: screenshotPath + 'Settings_Basic_02.png', + fullPage: fullPageSet, + }); + // Thinking time and closing sleep(randomIntBetween(thinkTimeMin, thinkTimeMax)); page.close(); diff --git a/mailpoet/tests/performance/tests/subscribers-adding.js b/mailpoet/tests/performance/tests/subscribers-adding.js index d2a6d56cc2..d704a142c2 100644 --- a/mailpoet/tests/performance/tests/subscribers-adding.js +++ b/mailpoet/tests/performance/tests/subscribers-adding.js @@ -67,11 +67,11 @@ export async function subscribersAdding() { await page.locator('input[name="last_name"]').type(lastName); selectInSelect2(page, defaultListName); await page.locator('button[type="submit"]').click(); + await page.waitForLoadState('networkidle'); // Verify you see the success message and the filter is visible const locator = "//div[@class='notice-success'].//p[starts-with(text(),'Subscriber was added successfully!')]"; - await page.waitForSelector(locator); describe(subscribersPageTitle, () => { describe('should be able to see Subscriber Added message', () => { expect(page.locator(locator)).to.exist; diff --git a/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js b/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js index 963da0967e..028632ae6e 100644 --- a/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js +++ b/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js @@ -74,6 +74,11 @@ export async function subscribersTrashingRestoring() { }); }); + await page.screenshot({ + path: screenshotPath + 'Subscribers_Trashing_Restoring_02.png', + fullPage: fullPageSet, + }); + // Restore from trash all the trashed subscribers await page.locator('[data-automation-id="filters_trash"]').click(); await page.waitForSelector('[data-automation-id="empty_trash"]'); @@ -87,6 +92,11 @@ export async function subscribersTrashingRestoring() { waitForSelectorToBeVisible(page, '.colspanchange'); waitForSelectorToBeVisible(page, '[data-automation-id="filters_subscribed"]'); + await page.screenshot({ + path: screenshotPath + 'Subscribers_Trashing_Restoring_03.png', + fullPage: fullPageSet, + }); + // Thinking time and closing sleep(randomIntBetween(thinkTimeMin, thinkTimeMax)); page.close();