Skip to content

Commit

Permalink
chore(deps): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mkosir committed Feb 1, 2024
1 parent 34bb290 commit b0a00a4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions e2e/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const IFRAME_SELECTOR = 'iframe[title="storybook-preview-iframe"]';
10 changes: 5 additions & 5 deletions e2e/events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { test, expect } from '@playwright/test';

const IFRAME_LOCATOR = 'iframe[title="storybook-preview-iframe"]';
import { IFRAME_SELECTOR } from './consts';

test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.getByRole('link', { name: 'Event - Params' }).click();
});

test("should trigger 'onMove' event with 'mousemove' event type when mouse hovers tilt element", async ({ page }) => {
const content = page.frameLocator(IFRAME_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });
await expect(content.getByTestId('evenDescription')).toHaveText(
Expand All @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });
await content.getByText('Track events:').hover();
Expand All @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByLabel('onMove').uncheck();
await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });
Expand All @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByLabel('onMove').uncheck();
await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });
Expand Down
13 changes: 13 additions & 0 deletions e2e/global.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// import { test as setup } from '@playwright/test';

// setup('do login', async ({ page }) => {
// await page.goto('/');
// await page.getByLabel('User Name').fill('user');
// await page.getByLabel('Password').fill('password');
// await page.getByText('Sign in').click();

// // Wait until the page actually signs in.
// await expect(page.getByText('Hello, user!')).toBeVisible();

// await page.context().storageState({ path: STORAGE_STATE });
// });
8 changes: 4 additions & 4 deletions e2e/on-move-params.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';

import { OnMoveParams } from 'index';

const IFRAME_LOCATOR = 'iframe[title="storybook-preview-iframe"]';
import { IFRAME_SELECTOR } from './consts';

test.beforeEach(async ({ page }) => {
await page.goto('/');
Expand All @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByTestId('topLeft').hover({ position: { x: 10, y: 10 } });
await expect(content.getByTestId('tiltAngleX')).toHaveText('-20.00° / -100.00%');
Expand All @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByTestId('topLeft').hover({ position: { x: 10, y: 10 } });

Expand Down Expand Up @@ -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_LOCATOR);
const content = page.frameLocator(IFRAME_SELECTOR);

await content.getByTestId('topMidLeft').hover({ position: { x: 10, y: 10 } });

Expand Down
11 changes: 11 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,50 @@ export default defineConfig({
},

projects: [
{
name: 'setup',
testMatch: /global.setup\.ts/,
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
dependencies: ['setup'],
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
dependencies: ['setup'],
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
dependencies: ['setup'],
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// dependencies: ['setup'],
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// dependencies: ['setup'],
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// dependencies: ['setup'],
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// dependencies: ['setup'],
// },
],

Expand Down

0 comments on commit b0a00a4

Please sign in to comment.