-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(tab-button): add focus state screenshots (#27731)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> We do not have screenshots that verify the focus states are being applied correctly. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added screenshot tests to verify focus states are being captured for non-translucent tab bars (iOS and MD) as well as translucent tab bars (iOS only) ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: ionitron <hi@ionicframework.com>
- Loading branch information
1 parent
db9a001
commit 4906d02
Showing
19 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
core/src/components/tab-button/test/states/tab-button.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { expect } from '@playwright/test'; | ||
import { configs, test } from '@utils/test/playwright'; | ||
|
||
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
test.describe(title('tab-button: states with no translucency'), () => { | ||
test.describe('focus', () => { | ||
test('should render correct focus state with default theme and no translucency', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-tab-bar style="width: 300px"> | ||
<ion-tab-button href="#" class="ion-focused"> | ||
<ion-label>Favorites</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
`, | ||
config | ||
); | ||
|
||
const tabBar = page.locator('ion-tab-bar'); | ||
await expect(tabBar).toHaveScreenshot(screenshot('tab-button-focus-no-translucency')); | ||
}); | ||
|
||
test('should render correct focus state with custom theme and no translucency', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-tab-bar style="width: 300px" color="success"> | ||
<ion-tab-button href="#" class="ion-focused"> | ||
<ion-label>Favorites</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
`, | ||
config | ||
); | ||
|
||
const tabBar = page.locator('ion-tab-bar'); | ||
await expect(tabBar).toHaveScreenshot(screenshot('tab-button-focus-color-no-translucency')); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
test.describe(title('tab-button: states with translucency'), () => { | ||
test.describe('focus', () => { | ||
test('should render correct focus state with default theme and translucency', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-content color="dark"> | ||
<ion-tab-bar style="width: 300px" translucent="true"> | ||
<ion-tab-button href="#" class="ion-focused"> | ||
<ion-label>Favorites</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
</ion-content> | ||
`, | ||
config | ||
); | ||
|
||
const tabBar = page.locator('ion-tab-bar'); | ||
await expect(tabBar).toHaveScreenshot(screenshot('tab-button-focus-translucency')); | ||
}); | ||
|
||
test('should render correct focus state with custom theme and translucency', async ({ page }) => { | ||
await page.setContent( | ||
` | ||
<ion-content color="dark"> | ||
<ion-tab-bar style="width: 300px" color="success" translucent="true"> | ||
<ion-tab-button href="#" class="ion-focused"> | ||
<ion-label>Favorites</ion-label> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
</ion-content> | ||
`, | ||
config | ||
); | ||
|
||
const tabBar = page.locator('ion-tab-bar'); | ||
await expect(tabBar).toHaveScreenshot(screenshot('tab-button-focus-color-translucency')); | ||
}); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+1.67 KB
...napshots/tab-button-focus-color-no-translucency-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.9 KB
...apshots/tab-button-focus-color-no-translucency-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.56 KB
...napshots/tab-button-focus-color-no-translucency-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.42 KB
...snapshots/tab-button-focus-color-no-translucency-md-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...napshots/tab-button-focus-color-no-translucency-md-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.24 KB
...snapshots/tab-button-focus-color-no-translucency-md-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.71 KB
...s-snapshots/tab-button-focus-color-translucency-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.9 KB
...-snapshots/tab-button-focus-color-translucency-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.56 KB
...s-snapshots/tab-button-focus-color-translucency-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.59 KB
...e.ts-snapshots/tab-button-focus-no-translucency-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.77 KB
....ts-snapshots/tab-button-focus-no-translucency-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.48 KB
...e.ts-snapshots/tab-button-focus-no-translucency-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
...2e.ts-snapshots/tab-button-focus-no-translucency-md-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.52 KB
...e.ts-snapshots/tab-button-focus-no-translucency-md-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.19 KB
...2e.ts-snapshots/tab-button-focus-no-translucency-md-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.61 KB
....e2e.ts-snapshots/tab-button-focus-translucency-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.77 KB
...e2e.ts-snapshots/tab-button-focus-translucency-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.5 KB
....e2e.ts-snapshots/tab-button-focus-translucency-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.