Skip to content

Commit a3be0ef

Browse files
committed
test(safe-area): update to use Capacitor variables
1 parent bde8cdb commit a3be0ef

File tree

50 files changed

+69
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+69
-10
lines changed

core/src/components/app/test/safe-area/app.e2e.ts

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,56 @@ configs({ directions: ['ltr'] }).forEach(({ config, title, screenshot }) => {
1818

1919
await expect(page).toHaveScreenshot(screenshot(`app-${screenshotModifier}-diff`));
2020
};
21+
2122
test.beforeEach(async ({ page }) => {
2223
await page.goto(`/src/components/app/test/safe-area`, config);
2324
});
24-
test('should not have visual regressions with action sheet', async ({ page }) => {
25-
await testOverlay(page, '#show-action-sheet', 'ionActionSheetDidPresent', 'action-sheet');
26-
});
27-
test('should not have visual regressions with menu', async ({ page }) => {
28-
await testOverlay(page, '#show-menu', 'ionDidOpen', 'menu');
29-
});
30-
test('should not have visual regressions with picker', async ({ page }) => {
31-
await testOverlay(page, '#show-picker', 'ionPickerDidPresent', 'picker');
25+
26+
test.describe(title('Ionic safe area variables'), () => {
27+
test.beforeEach(async ({ page }) => {
28+
const htmlTag = page.locator('html');
29+
const hasSafeAreaClass = await htmlTag.evaluate((el) => el.classList.contains('safe-area'));
30+
31+
expect(hasSafeAreaClass).toBe(true);
32+
});
33+
34+
test('should not have visual regressions with action sheet', async ({ page }) => {
35+
await testOverlay(page, '#show-action-sheet', 'ionActionSheetDidPresent', 'action-sheet');
36+
});
37+
test('should not have visual regressions with menu', async ({ page }) => {
38+
await testOverlay(page, '#show-menu', 'ionDidOpen', 'menu');
39+
});
40+
test('should not have visual regressions with picker', async ({ page }) => {
41+
await testOverlay(page, '#show-picker', 'ionPickerDidPresent', 'picker');
42+
});
43+
test('should not have visual regressions with toast', async ({ page }) => {
44+
await testOverlay(page, '#show-toast', 'ionToastDidPresent', 'toast');
45+
});
3246
});
33-
test('should not have visual regressions with toast', async ({ page }) => {
34-
await testOverlay(page, '#show-toast', 'ionToastDidPresent', 'toast');
47+
48+
test.describe(title('Capacitor safe area variables'), () => {
49+
test.beforeEach(async ({ page }) => {
50+
const toggleButton = page.locator('#toggle-safe-area');
51+
await toggleButton.click();
52+
53+
const htmlTag = page.locator('html');
54+
const hasSafeAreaClass = await htmlTag.evaluate((el) => el.classList.contains('safe-area-capacitor'));
55+
56+
expect(hasSafeAreaClass).toBe(true);
57+
});
58+
59+
test('should not have visual regressions with action sheet', async ({ page }) => {
60+
await testOverlay(page, '#show-action-sheet', 'ionActionSheetDidPresent', 'capacitor-action-sheet');
61+
});
62+
test('should not have visual regressions with menu', async ({ page }) => {
63+
await testOverlay(page, '#show-menu', 'ionDidOpen', 'capacitor-menu');
64+
});
65+
test('should not have visual regressions with picker', async ({ page }) => {
66+
await testOverlay(page, '#show-picker', 'ionPickerDidPresent', 'capacitor-picker');
67+
});
68+
test('should not have visual regressions with toast', async ({ page }) => {
69+
await testOverlay(page, '#show-toast', 'ionToastDidPresent', 'capacitor-toast');
70+
});
3571
});
3672
});
3773
});
791 Bytes
2.6 KB
2.16 KB
373 Bytes
1.55 KB
1.29 KB
21.3 KB
30.9 KB
25 KB

0 commit comments

Comments
 (0)