diff --git a/packages/plugin-e2e/src/fixtures/annotationEditPage.ts b/packages/plugin-e2e/src/fixtures/annotationEditPage.ts index d0b51e5c5b..c9226c5d39 100644 --- a/packages/plugin-e2e/src/fixtures/annotationEditPage.ts +++ b/packages/plugin-e2e/src/fixtures/annotationEditPage.ts @@ -8,8 +8,12 @@ type AnnotationEditPageFixture = TestFixture< PluginFixture & PluginOptions & PlaywrightCombinedArgs >; -const annotationEditPage: AnnotationEditPageFixture = async ({ page, selectors, grafanaVersion, request }, use) => { - const annotationPage = new AnnotationPage({ page, selectors, grafanaVersion, request }); +const annotationEditPage: AnnotationEditPageFixture = async ( + { page, selectors, grafanaVersion, request }, + use, + testInfo +) => { + const annotationPage = new AnnotationPage({ page, selectors, grafanaVersion, request, testInfo }); await annotationPage.goto(); const annotationEditPage = await annotationPage.clickAddNew(); await use(annotationEditPage); diff --git a/packages/plugin-e2e/src/fixtures/explorePage.ts b/packages/plugin-e2e/src/fixtures/explorePage.ts index 9b8cdc891b..8fe3375009 100644 --- a/packages/plugin-e2e/src/fixtures/explorePage.ts +++ b/packages/plugin-e2e/src/fixtures/explorePage.ts @@ -5,8 +5,8 @@ import { PlaywrightCombinedArgs } from './types'; type ExplorePageFixture = TestFixture; -const explorePage: ExplorePageFixture = async ({ page, selectors, grafanaVersion, request }, use) => { - const explorePage = new ExplorePage({ page, selectors, grafanaVersion, request }); +const explorePage: ExplorePageFixture = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => { + const explorePage = new ExplorePage({ page, selectors, grafanaVersion, request, testInfo }); await explorePage.goto(); await use(explorePage); }; diff --git a/packages/plugin-e2e/src/fixtures/newDashboardPage.ts b/packages/plugin-e2e/src/fixtures/newDashboardPage.ts index ef333668c4..bdbb0007fe 100644 --- a/packages/plugin-e2e/src/fixtures/newDashboardPage.ts +++ b/packages/plugin-e2e/src/fixtures/newDashboardPage.ts @@ -5,8 +5,12 @@ import { PlaywrightCombinedArgs } from './types'; type NewDashboardPageFixture = TestFixture; -const newDashboardPage: NewDashboardPageFixture = async ({ page, request, selectors, grafanaVersion }, use) => { - const newDashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request }); +const newDashboardPage: NewDashboardPageFixture = async ( + { page, request, selectors, grafanaVersion }, + use, + testInfo +) => { + const newDashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request, testInfo }); await newDashboardPage.goto(); await use(newDashboardPage); }; diff --git a/packages/plugin-e2e/src/fixtures/variableEditPage.ts b/packages/plugin-e2e/src/fixtures/variableEditPage.ts index a51f236f38..6476747148 100644 --- a/packages/plugin-e2e/src/fixtures/variableEditPage.ts +++ b/packages/plugin-e2e/src/fixtures/variableEditPage.ts @@ -5,8 +5,12 @@ import { PlaywrightCombinedArgs } from './types'; type VariableEditPageFixture = TestFixture; -const variableEditPage: VariableEditPageFixture = async ({ page, selectors, grafanaVersion, request }, use) => { - const variablePage = new VariablePage({ page, selectors, grafanaVersion, request }); +const variableEditPage: VariableEditPageFixture = async ( + { page, selectors, grafanaVersion, request }, + use, + testInfo +) => { + const variablePage = new VariablePage({ page, selectors, grafanaVersion, request, testInfo }); await variablePage.goto(); const variableEditPage = await variablePage.clickAddNew(); await use(variableEditPage); diff --git a/packages/plugin-e2e/src/types.ts b/packages/plugin-e2e/src/types.ts index 5fad9b32cc..a947ec4fe5 100644 --- a/packages/plugin-e2e/src/types.ts +++ b/packages/plugin-e2e/src/types.ts @@ -1,11 +1,11 @@ -import { Locator, PlaywrightTestArgs, Response } from '@playwright/test'; +import { Locator, PlaywrightTestArgs, Response, TestInfo } from '@playwright/test'; import { E2ESelectors } from './e2e-selectors/types'; /** * The context object passed to page object models */ -export type PluginTestCtx = { grafanaVersion: string; selectors: E2ESelectors } & Pick< +export type PluginTestCtx = { grafanaVersion: string; selectors: E2ESelectors; testInfo: TestInfo } & Pick< PlaywrightTestArgs, 'page' | 'request' >; diff --git a/packages/plugin-e2e/tests/as-admin-user/datasource/data-assertions/dataAssertion.spec.ts b/packages/plugin-e2e/tests/as-admin-user/datasource/data-assertions/dataAssertion.spec.ts index e09d25eca1..89a83bd9af 100644 --- a/packages/plugin-e2e/tests/as-admin-user/datasource/data-assertions/dataAssertion.spec.ts +++ b/packages/plugin-e2e/tests/as-admin-user/datasource/data-assertions/dataAssertion.spec.ts @@ -8,9 +8,12 @@ test.describe('panel edit page', () => { grafanaVersion, request, readProvisionedDashboard, - }) => { + }, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'redshift.json' }); - const panelEditPage = new PanelEditPage({ page, selectors, grafanaVersion, request }, { dashboard, id: '3' }); + const panelEditPage = new PanelEditPage( + { page, selectors, grafanaVersion, request, testInfo }, + { dashboard, id: '3' } + ); await panelEditPage.goto(); await panelEditPage.setVisualization('Table'); await expect(panelEditPage.panel.locator).toBeVisible(); @@ -24,9 +27,12 @@ test.describe('panel edit page', () => { grafanaVersion, request, readProvisionedDashboard, - }) => { + }, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'google-sheets.json' }); - const panelEditPage = new PanelEditPage({ page, selectors, grafanaVersion, request }, { dashboard, id: '1' }); + const panelEditPage = new PanelEditPage( + { page, selectors, grafanaVersion, request, testInfo }, + { dashboard, id: '1' } + ); await panelEditPage.goto(); await panelEditPage.setVisualization('Time series'); await panelEditPage.toggleTableView(); @@ -36,18 +42,30 @@ test.describe('panel edit page', () => { }); test.describe('dashboard page', () => { - test('getting panel by title', async ({ page, selectors, grafanaVersion, request, readProvisionedDashboard }) => { + test('getting panel by title', async ({ + page, + selectors, + grafanaVersion, + request, + readProvisionedDashboard, + }, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'redshift.json' }); - const dashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request }, dashboard); + const dashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request, testInfo }, dashboard); await dashboardPage.goto(); const panel = await dashboardPage.getPanelByTitle('Basic table example'); await expect(panel.fieldNames).toContainText(['time', 'temperature', 'humidity', 'environment']); await expect(panel.data).toContainText(['25', '32', 'staging']); }); - test('getting panel by id', async ({ page, selectors, grafanaVersion, request, readProvisionedDashboard }) => { + test('getting panel by id', async ({ + page, + selectors, + grafanaVersion, + request, + readProvisionedDashboard, + }, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'redshift.json' }); - const dashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request }, dashboard); + const dashboardPage = new DashboardPage({ page, selectors, grafanaVersion, request, testInfo }, dashboard); await dashboardPage.goto(); const panel = await dashboardPage.getPanelById('3'); await expect(panel.fieldNames).toContainText(['time', 'temperature', 'humidity', 'environment']); diff --git a/packages/plugin-e2e/tests/as-admin-user/datasource/variables/customVariableQueryRunner.integration.spec.ts b/packages/plugin-e2e/tests/as-admin-user/datasource/variables/customVariableQueryRunner.integration.spec.ts index 29811eeaa6..9853ad164f 100644 --- a/packages/plugin-e2e/tests/as-admin-user/datasource/variables/customVariableQueryRunner.integration.spec.ts +++ b/packages/plugin-e2e/tests/as-admin-user/datasource/variables/customVariableQueryRunner.integration.spec.ts @@ -24,10 +24,10 @@ test('custom variable editor query runner should return data when valid query fr selectors, grafanaVersion, readProvisionedDashboard, -}) => { +}, testInfo) => { const provision = await readProvisionedDashboard({ fileName: 'redshift.json' }); const variableEditPage = new VariableEditPage( - { request, page, selectors, grafanaVersion }, + { request, page, selectors, grafanaVersion, testInfo }, { dashboard: { uid: provision.uid }, id: '2' } ); await variableEditPage.goto(); diff --git a/packages/plugin-e2e/tests/as-admin-user/datasource/variables/variableInterpolation.spec.ts b/packages/plugin-e2e/tests/as-admin-user/datasource/variables/variableInterpolation.spec.ts index 2519f57966..05d4b1c82e 100644 --- a/packages/plugin-e2e/tests/as-admin-user/datasource/variables/variableInterpolation.spec.ts +++ b/packages/plugin-e2e/tests/as-admin-user/datasource/variables/variableInterpolation.spec.ts @@ -1,9 +1,15 @@ import { test, expect, PanelEditPage } from '../../../../src'; -test('variable interpolation', async ({ readProvisionedDashboard, request, page, selectors, grafanaVersion }) => { +test('variable interpolation', async ({ + readProvisionedDashboard, + request, + page, + selectors, + grafanaVersion, +}, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'redshift.json' }); const panelEditPage = new PanelEditPage( - { request, page, selectors, grafanaVersion }, + { request, page, selectors, grafanaVersion, testInfo }, { id: '5', dashboard, @@ -24,10 +30,10 @@ test('variable interpolation (navigate to panel from dashboard)', async ({ page, selectors, grafanaVersion, -}) => { +}, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'redshift.json' }); const panelEditPage = new PanelEditPage( - { request, page, selectors, grafanaVersion }, + { request, page, selectors, grafanaVersion, testInfo }, { id: '5', dashboard, diff --git a/packages/plugin-e2e/tests/as-admin-user/panel/panel.spec.ts b/packages/plugin-e2e/tests/as-admin-user/panel/panel.spec.ts index d933bf9d12..aeb48d8bd4 100644 --- a/packages/plugin-e2e/tests/as-admin-user/panel/panel.spec.ts +++ b/packages/plugin-e2e/tests/as-admin-user/panel/panel.spec.ts @@ -18,10 +18,10 @@ test('open a clock panel in a provisioned dashboard and set time format to "12 h request, grafanaVersion, readProvisionedDashboard, -}) => { +}, testInfo) => { const dashboard = await readProvisionedDashboard({ fileName: 'clock-panel.json' }); const args = { dashboard: { uid: dashboard.uid }, id: '5' }; - const panelEditPage = await new PanelEditPage({ page, selectors, grafanaVersion, request }, args); + const panelEditPage = await new PanelEditPage({ page, selectors, grafanaVersion, request, testInfo }, args); await panelEditPage.goto(); await expect(panelEditPage.getVisualizationName()).toHaveText('Clock'); await panelEditPage.collapseSection('Clock');