Skip to content

Commit 5ff32b7

Browse files
authored
test(docs): update viewport docs (#28197)
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. --> I needed this constant for a different PR but realized the docs were outdated: https://github.com/ionic-team/ionic-framework/blob/81714d45bd97f0ba91729959b60a0dc1d1d06533/core/src/utils/test/playwright/viewports/index.ts ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Docs reference correct constant name ## 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. -->
1 parent b5c736f commit 5ff32b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/utils/test/playwright/docs/best-practices.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,17 @@ Tests are distributed across many test runners on continuous integration (CI) to
187187

188188
By default, we run tests on mobile viewports only (think iPhone sized viewports). However, there are some components that have different layouts on tablet viewports. Two examples are `ion-split-pane` and the card variant of `ion-modal`.
189189

190-
For this scenario, developers must write tests that target the tablet viewport. This can be done by using [page.setViewportSize](https://playwright.dev/docs/api/class-page#page-set-viewport-size). The Playwright test utils directory also contains a `TabletViewport` constant which can be used to take consistent tablet-sized screenshots.
190+
For this scenario, developers must write tests that target the tablet viewport. This can be done by using [page.setViewportSize](https://playwright.dev/docs/api/class-page#page-set-viewport-size). The Playwright test utils directory also contains a `Viewports` constant which contains some common viewport presets. Developers should feel free to add new viewports to this as is applicable.
191191

192192
**Example:**
193193

194194
```javascript
195-
import { configs, test, TabletViewport } from '@utils/test/playwright';
195+
import { configs, test, Viewports } from '@utils/test/playwright';
196196

197197
configs().forEach(({ config, title }) => {
198198
test.describe(title('thing: rendering'), () => {
199199
test('it should do a thing on tablet viewports', async ({ page }) => {
200-
await page.setViewportSize(TabletViewport);
200+
await page.setViewportSize(Viewports.tablet.portrait);
201201

202202
...
203203

0 commit comments

Comments
 (0)