Skip to content

Commit

Permalink
chore: added vrt cases for popover with autoalign scroll (carbon-desi…
Browse files Browse the repository at this point in the history
…gn-system#18082)

* chore: added vrt cases for popover with autoalign scroll

* fix: snapshot names should be unique
  • Loading branch information
preetibansalui authored Nov 17, 2024
1 parent 1df6d92 commit 6972097
Showing 1 changed file with 74 additions and 1 deletion.
75 changes: 74 additions & 1 deletion e2e/components/Popover/Popover-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

const { test } = require('@playwright/test');
const { themes } = require('../../test-utils/env');
const { snapshotStory } = require('../../test-utils/storybook');
const { snapshot } = require('../../test-utils/snapshot');
const { snapshotStory, visitStory } = require('../../test-utils/storybook');

test.describe('Popover', () => {
themes.forEach((theme) => {
Expand All @@ -29,6 +30,78 @@ test.describe('Popover', () => {
theme,
});
});
// test experimental autoAlign
test('popover - expermental autoAlign scroll to left @vrt', async ({
page,
}) => {
await visitStory(page, {
component: 'popover',
story: 'experimental-auto-align',
theme,
});
await page.evaluate(() => {
window.scrollBy(-500, 0); // Scroll 500px to the left
});
await snapshot(page, {
component: 'popover',
story: 'experimental-auto-align-left',
theme,
});
});

test('popover - expermental autoAlign scroll to right @vrt', async ({
page,
}) => {
await visitStory(page, {
component: 'popover',
story: 'experimental-auto-align',
theme,
});
await page.evaluate(() => {
window.scrollBy(500, 0); // Scroll 500px to the right
});
await snapshot(page, {
component: 'popover',
story: 'experimental-auto-align-right',
theme,
});
});

test('popover - expermental autoAlign scroll to top @vrt', async ({
page,
}) => {
await visitStory(page, {
component: 'popover',
story: 'experimental-auto-align',
theme,
});
await page.evaluate(() => {
window.scrollBy(0, -350); // Scroll 350px to the top
});
await snapshot(page, {
component: 'popover',
story: 'experimental-auto-align-top',
theme,
});
});

test('popover - expermental autoAlign scroll to bottom @vrt', async ({
page,
}) => {
await visitStory(page, {
component: 'popover',
story: 'experimental-auto-align',
theme,
});
await page.evaluate(() => {
window.scrollBy(0, 350); // Scroll 350px to the bottom
});
await snapshot(page, {
component: 'popover',
story: 'experimental-auto-align-bottom',
theme,
});
});
});
});
});

0 comments on commit 6972097

Please sign in to comment.