From 1464a86c6833b57d670f1dcc271fb1dcf4f73d18 Mon Sep 17 00:00:00 2001 From: mkosir Date: Sun, 11 Feb 2024 10:58:38 +0100 Subject: [PATCH] chore(deps): update dependencies --- e2e/consts.ts | 9 ++++++++- e2e/events.spec.ts | 10 +++++----- e2e/on-move-params.spec.ts | 8 ++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/e2e/consts.ts b/e2e/consts.ts index d77f40c9..bbfe0231 100644 --- a/e2e/consts.ts +++ b/e2e/consts.ts @@ -1 +1,8 @@ -export const IFRAME_SELECTOR = 'iframe[title="storybook-preview-iframe"]'; +import { FrameLocator, Page } from '@playwright/test'; + +const IFRAME_SELECTOR = 'iframe[title="storybook-preview-iframe"]'; + +export const getIframeContent = (page: Page): FrameLocator => { + const content = page.frameLocator(IFRAME_SELECTOR); + return content; +}; diff --git a/e2e/events.spec.ts b/e2e/events.spec.ts index 69fbfa1b..601ab406 100644 --- a/e2e/events.spec.ts +++ b/e2e/events.spec.ts @@ -1,6 +1,6 @@ import { test, expect } from '@playwright/test'; -import { IFRAME_SELECTOR } from './consts'; +import { getIframeContent } from './consts'; test.beforeEach(async ({ page }) => { await page.goto('/'); @@ -8,7 +8,7 @@ test.beforeEach(async ({ page }) => { }); test("should trigger 'onMove' event with 'mousemove' event type when mouse hovers tilt element", async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } }); await expect(content.getByTestId('evenDescription')).toHaveText( @@ -17,7 +17,7 @@ test("should trigger 'onMove' event with 'mousemove' event type when mouse hover }); test("should trigger 'onMove' event with 'autoreset' event type when mouse leaves tilt element", async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } }); await content.getByText('Track events:').hover(); @@ -27,7 +27,7 @@ test("should trigger 'onMove' event with 'autoreset' event type when mouse leave }); test("should trigger 'onEnter' event with 'mouseenter' event type when mouse enters tilt element", async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByLabel('onMove').uncheck(); await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } }); @@ -37,7 +37,7 @@ test("should trigger 'onEnter' event with 'mouseenter' event type when mouse ent }); test("should trigger 'onLeave' event with 'mouseleave' event type when mouse enters tilt element", async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByLabel('onMove').uncheck(); await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } }); diff --git a/e2e/on-move-params.spec.ts b/e2e/on-move-params.spec.ts index 0cdfd33d..710f91e0 100644 --- a/e2e/on-move-params.spec.ts +++ b/e2e/on-move-params.spec.ts @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test'; import { OnMoveParams } from 'index'; -import { IFRAME_SELECTOR } from './consts'; +import { getIframeContent } from './consts'; test.beforeEach(async ({ page }) => { await page.goto('/'); @@ -12,7 +12,7 @@ test.beforeEach(async ({ page }) => { test('should get max values of move params rendered when mouse is positioned at top left corner of tilt element', async ({ page, }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByTestId('topLeft').hover({ position: { x: 10, y: 10 } }); await expect(content.getByTestId('tiltAngleX')).toHaveText('-20.00° / -100.00%'); @@ -22,7 +22,7 @@ test('should get max values of move params rendered when mouse is positioned at }); test('should get max values of move params when mouse is positioned at corners of tilt element', async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByTestId('topLeft').hover({ position: { x: 10, y: 10 } }); @@ -74,7 +74,7 @@ test('should get max values of move params when mouse is positioned at corners o }); test('should get half of max value when mouse is positioned in the middle of tilt element', async ({ page }) => { - const content = page.frameLocator(IFRAME_SELECTOR); + const content = getIframeContent(page); await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });