You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set the default runner iframe viewport for Browser Mode tests. When not specified, the Browser UI fills the preview panel.
224
+
225
+
```ts
226
+
type BrowserViewport =
227
+
| {
228
+
width: number;
229
+
height: number;
230
+
}
231
+
| DevicePreset;
232
+
```
233
+
234
+
Use an explicit size when you want all files in a browser project to run with the same viewport:
235
+
236
+
```ts title="rstest.config.ts"
237
+
import { defineConfig } from '@rstest/core';
238
+
239
+
export default defineConfig({
240
+
browser: {
241
+
enabled: true,
242
+
provider: 'playwright',
243
+
viewport: { width: 390, height: 844 },
244
+
},
245
+
});
246
+
```
247
+
248
+
You can also use a built-in device preset:
249
+
250
+
```ts title="rstest.config.ts"
251
+
import { defineConfig } from '@rstest/core';
252
+
253
+
export default defineConfig({
254
+
browser: {
255
+
enabled: true,
256
+
provider: 'playwright',
257
+
viewport: 'iPhone12Pro',
258
+
},
259
+
});
260
+
```
261
+
262
+
Supported presets:
263
+
264
+
| Preset | Size |
265
+
| ----------------------- | ----------- |
266
+
| `iPhoneSE` | 375 x 667 |
267
+
| `iPhoneXR` | 414 x 896 |
268
+
| `iPhone12Pro` | 390 x 844 |
269
+
| `iPhone14ProMax` | 430 x 932 |
270
+
| `Pixel7` | 412 x 915 |
271
+
| `SamsungGalaxyS8Plus` | 360 x 740 |
272
+
| `SamsungGalaxyS20Ultra` | 412 x 915 |
273
+
| `iPadMini` | 768 x 1024 |
274
+
| `iPadAir` | 820 x 1180 |
275
+
| `iPadPro` | 1024 x 1366 |
276
+
| `SurfacePro7` | 912 x 1368 |
277
+
| `SurfaceDuo` | 540 x 720 |
278
+
| `GalaxyZFold5` | 344 x 882 |
279
+
| `AsusZenbookFold` | 853 x 1280 |
280
+
| `SamsungGalaxyA51A71` | 412 x 914 |
281
+
| `NestHub` | 1024 x 600 |
282
+
| `NestHubMax` | 1280 x 800 |
283
+
284
+
:::tip
285
+
`browser.viewport`controls the test runner iframe viewport. If you need Playwright context options such as locale, color scheme, or permissions, configure them through [`providerOptions.context`](#provider-options).
0 commit comments