Skip to content

Commit 6111c17

Browse files
Adding snapshot tests for shadow feature
1 parent d60840e commit 6111c17

7 files changed

+60
-18
lines changed

core/src/components/tab-bar/test/expand/tab-bar.e2e.ts

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,45 @@ import { configs, test } from '@utils/test/playwright';
66
*/
77
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
88
test.describe(title('tab-bar: expand'), () => {
9+
test.describe(title('full'), () => {
10+
test('should not have visual regressions', async ({ page }) => {
11+
await page.setContent(
12+
`
13+
<style>
14+
:root {
15+
background: #ccc7c7;
16+
}
17+
</style>
18+
19+
<ion-content>
20+
<ion-tab-bar expand="full">
21+
<ion-tab-button tab="1">
22+
<ion-icon name="triangle-outline"></ion-icon>
23+
<ion-label>Label</ion-label>
24+
</ion-tab-button>
25+
26+
<ion-tab-button tab="2">
27+
<ion-icon name="triangle-outline"></ion-icon>
28+
<ion-label>Label</ion-label>
29+
</ion-tab-button>
30+
31+
<ion-tab-button tab="3">
32+
<ion-icon name="triangle-outline"></ion-icon>
33+
<ion-label>Label</ion-label>
34+
</ion-tab-button>
35+
</ion-tab-bar>
36+
</ion-content>
37+
`,
38+
config
39+
);
40+
41+
// Used the `ion-content` element to take the screenshot because the `ion-tab-bar`element would not be visible otherwise
42+
const content = page.locator('ion-content');
43+
44+
await expect(content).toHaveScreenshot(screenshot(`tab-bar-expand-full`));
45+
});
46+
});
47+
948
test.describe(title('compact'), () => {
1049
test('should not have visual regressions', async ({ page }) => {
1150
await page.setContent(
@@ -16,29 +55,32 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screensh
1655
}
1756
</style>
1857
19-
<ion-tab-bar expand="compact">
20-
<ion-tab-button tab="1">
21-
<ion-icon name="triangle-outline"></ion-icon>
22-
<ion-label>Label</ion-label>
23-
</ion-tab-button>
24-
25-
<ion-tab-button tab="2">
26-
<ion-icon name="triangle-outline"></ion-icon>
27-
<ion-label>Label</ion-label>
28-
</ion-tab-button>
29-
30-
<ion-tab-button tab="3">
31-
<ion-icon name="triangle-outline"></ion-icon>
32-
<ion-label>Label</ion-label>
33-
</ion-tab-button>
34-
</ion-tab-bar>
58+
<ion-content>
59+
<ion-tab-bar expand="compact">
60+
<ion-tab-button tab="1">
61+
<ion-icon name="triangle-outline"></ion-icon>
62+
<ion-label>Label</ion-label>
63+
</ion-tab-button>
64+
65+
<ion-tab-button tab="2">
66+
<ion-icon name="triangle-outline"></ion-icon>
67+
<ion-label>Label</ion-label>
68+
</ion-tab-button>
69+
70+
<ion-tab-button tab="3">
71+
<ion-icon name="triangle-outline"></ion-icon>
72+
<ion-label>Label</ion-label>
73+
</ion-tab-button>
74+
</ion-tab-bar>
75+
</ion-content>
3576
`,
3677
config
3778
);
3879

39-
const tabBar = page.locator('ion-tab-bar');
80+
// Used the `ion-content` element to take the screenshot because the `ion-tab-bar`element would not be visible otherwise
81+
const content = page.locator('ion-content');
4082

41-
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-expand-compact`));
83+
await expect(content).toHaveScreenshot(screenshot(`tab-bar-expand-compact`));
4284
});
4385
});
4486
});
2.85 KB
Loading
Loading
2.55 KB
Loading
5.08 KB
Loading
11.5 KB
Loading
4.94 KB
Loading

0 commit comments

Comments
 (0)