From d9a84fc7c8c871ea5a52c29d65dcb3e24d4dd549 Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Thu, 12 Dec 2024 09:41:41 +0100 Subject: [PATCH 1/2] PMM-7 Fix product tour tests --- tests/helper/grafana_helper.js | 4 ++-- tests/pages/homePage.js | 2 +- tests/product-tour/productTour_test.js | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/helper/grafana_helper.js b/tests/helper/grafana_helper.js index e1ced1185..ad96ba8ea 100644 --- a/tests/helper/grafana_helper.js +++ b/tests/helper/grafana_helper.js @@ -34,7 +34,7 @@ class Grafana extends Helper { Playwright.setPlaywrightRequestHeaders({ Authorization: `Basic ${basicAuthEncoded}` }); } - async enableProductTour() { + async enableProductTour(snooze = false) { const { Playwright } = this.helpers; await Playwright.page.route('**/v1/users/me', async (route, request) => { @@ -45,7 +45,7 @@ class Grafana extends Helper { user_id: 1, product_tour_completed: false, alerting_tour_completed: false, - snoozed_pmm_version: '', + snoozed_pmm_version: snooze ? '3.2.0' : '', }), }); } else { diff --git a/tests/pages/homePage.js b/tests/pages/homePage.js index 2c5c9a803..9b591023b 100644 --- a/tests/pages/homePage.js +++ b/tests/pages/homePage.js @@ -12,7 +12,7 @@ module.exports = { genericOauthUrl: 'graph/login/generic_oauth', requestEnd: '/v1/Updates/Check', elements: { - pageContent: locate('//div[@id="pageContent"]'), + pageContent: locate('//main[@id="pageContent"]'), }, fields: { systemsUnderMonitoringCount: diff --git a/tests/product-tour/productTour_test.js b/tests/product-tour/productTour_test.js index e9b18171f..9e51d6a73 100644 --- a/tests/product-tour/productTour_test.js +++ b/tests/product-tour/productTour_test.js @@ -1,8 +1,11 @@ Feature('Pmm Product tour tests'); -Before(async ({ I }) => { +Before(async ({ I, settingsAPI }) => { await I.stopMockingProductTourApi(); await I.Authorize(); + // todo: it would be better to disable updates once PMM-13608 is fixed + // snooze update modal + await settingsAPI.setTourOptions(false, true, '3.2.0'); await I.sendGetRequest('v1/users/me', { Authorization: `Basic ${await I.getAuth()}` }); }); @@ -31,7 +34,7 @@ Scenario('PMM-T1881 Verify that product tour dialog contains all the components. }).config('Playwright', { waitForNavigation: 'load' }); Scenario('PMM-T1882 Verify that product tour dialog is not displayed after skipping @grafana-pr', async ({ I, homePage }) => { - await I.enableProductTour(); + await I.enableProductTour(true); await I.amOnPage(''); await I.waitForElement(homePage.productTour.skipButton); From fa981a16cc3efb94d0714982c6dfe46196d3e59a Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Thu, 12 Dec 2024 10:45:14 +0100 Subject: [PATCH 2/2] PMM-7 Reorder requests --- tests/product-tour/productTour_test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/product-tour/productTour_test.js b/tests/product-tour/productTour_test.js index 9e51d6a73..db9597b7e 100644 --- a/tests/product-tour/productTour_test.js +++ b/tests/product-tour/productTour_test.js @@ -3,10 +3,11 @@ Feature('Pmm Product tour tests'); Before(async ({ I, settingsAPI }) => { await I.stopMockingProductTourApi(); await I.Authorize(); + // get request will create the initial state + await I.sendGetRequest('v1/users/me', { Authorization: `Basic ${await I.getAuth()}` }); // todo: it would be better to disable updates once PMM-13608 is fixed // snooze update modal await settingsAPI.setTourOptions(false, true, '3.2.0'); - await I.sendGetRequest('v1/users/me', { Authorization: `Basic ${await I.getAuth()}` }); }); Scenario('PMM-T1879 Verify that product tour dialog is displayed after check later button pressed. @grafana-pr', async ({ I, homePage }) => {