Skip to content

Commit

Permalink
chore(alert): add alert media query ui test (VIV-1564) (#1599)
Browse files Browse the repository at this point in the history
Co-authored-by: root <root@Mono>
  • Loading branch information
rachelbt and root authored Feb 22, 2024
1 parent 7a19f93 commit c98fb90
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion libs/components/src/lib/alert/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('should show the component', async ({ page }: { page: Page }) => {
`${htmlString} <div>${block}</div>`,'');

page.setViewportSize({ width: 1300, height: 2750 });

await loadComponents({
page,
components,
Expand All @@ -41,3 +41,32 @@ test('should show the component', async ({ page }: { page: Page }) => {
'./snapshots/alert.png'
);
});

async function testResponsiveAlert({ page }: { page: Page }) {
const template = `
<div style="margin: 5px; height: 250px; transform: translateY(0px);">
<vwc-alert text="An important information for you" removable open></vwc-alert>
</div>
`;

await page.setViewportSize({ width: 420, height: 300 });

await loadComponents({
page,
components,
});
await loadTemplate({
page,
template,
});

const testWrapper = await page.$('#wrapper');

await page.waitForLoadState('networkidle');


expect(await testWrapper?.screenshot()).toMatchSnapshot(
'./snapshots/alert-mobile.png',
);
}
test('alert in mobile screens', testResponsiveAlert);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c98fb90

Please sign in to comment.