From d406e7c05ef8bef6abeee3daeab0720f46b38ec4 Mon Sep 17 00:00:00 2001 From: Veljko Date: Wed, 22 Feb 2023 11:24:58 +0100 Subject: [PATCH] Complete the test and update xk6-binary file to the latest [MAILPOET-4956] --- mailpoet/tests/performance/scenarios.js | 4 ++-- .../performance/tests/subscribers-adding.js | 20 +++++++++++++------ mailpoet/tools/xk6browser.php | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/mailpoet/tests/performance/scenarios.js b/mailpoet/tests/performance/scenarios.js index 8f93dcf810..80e7103619 100644 --- a/mailpoet/tests/performance/scenarios.js +++ b/mailpoet/tests/performance/scenarios.js @@ -34,14 +34,14 @@ let scenarios = { executor: 'per-vu-iterations', vus: 1, iterations: 1, - maxDuration: '2m', + maxDuration: '5m', exec: 'pullRequests', }, nightlytests: { executor: 'per-vu-iterations', vus: 1, iterations: 3, - maxDuration: '5m', + maxDuration: '15m', exec: 'nightly', }, }; diff --git a/mailpoet/tests/performance/tests/subscribers-adding.js b/mailpoet/tests/performance/tests/subscribers-adding.js index 501b170c28..2c21740f73 100644 --- a/mailpoet/tests/performance/tests/subscribers-adding.js +++ b/mailpoet/tests/performance/tests/subscribers-adding.js @@ -1,4 +1,3 @@ -/* eslint-disable no-shadow */ /* eslint-disable import/no-unresolved */ /* eslint-disable import/no-default-export */ /** @@ -31,7 +30,10 @@ export function subscribersAdding() { }); const page = browser.newPage(); - group('Subscribers - Add a new subscriber', function subscribersAdding() { + group('Subscribers - Add a new subscriber', () => { + let subscriberEmail = + 'test+' + Math.floor(Math.random() * 9999 + 1) + '@test.com'; + page .goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers`, { waitUntil: 'networkidle', @@ -51,9 +53,7 @@ export function subscribersAdding() { page .locator('[data-automation-id="add-new-subscribers-button"]') .click(); - page - .locator('input[name="email"]') - .type('test+' + Math.floor(Math.random() * 9999 + 1) + '@test.com'); + page.locator('input[name="email"]').type(subscriberEmail); page.locator('input[name="first_name"]').type(firstName); page.locator('input[name="last_name"]').type(lastName); selectInSelect2(page, defaultListName); @@ -68,7 +68,15 @@ export function subscribersAdding() { }) .then(() => { - // search for added subscriber + page.waitForNavigation({ waitUntil: 'networkidle' }); + page.locator('#search_input').type(subscriberEmail, { delay: 50 }); + page.waitForSelector('.mailpoet-listing-no-items'); + page.waitForSelector('[data-automation-id="filters_subscribed"]'); + check(page, { + 'newly added subscriber is present in the listing': + page.locator('.mailpoet-listing-title').textContent() === + subscriberEmail, + }); }) .finally(() => { diff --git a/mailpoet/tools/xk6browser.php b/mailpoet/tools/xk6browser.php index 4069ae70d8..c0b57bad5d 100644 --- a/mailpoet/tools/xk6browser.php +++ b/mailpoet/tools/xk6browser.php @@ -22,7 +22,7 @@ if (!file_exists($vendorDir)) { } // paths -$version = 'v0.7.0'; +$version = 'v0.8.1'; $extension = $os === 'macos' || $os === 'windows' ? 'zip' : 'tar.gz'; $name = "xk6-browser-$version-$os-$arch"; $url = "https://github.com/grafana/xk6-browser/releases/download/$version/$name.$extension";