Skip to content

Commit fbf9ce7

Browse files
authored
feat: add scope tests (#168)
## Context This PR will add scopes to playwright for `@mobile` and `@desktop` ## Changes - Added: tags to tests - Added: greps to projects - Updated: eslinter rule ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] I have tested my code for breaking changes and added the corresponding footer in this PR if needed - [x] I have added tests that prove my fix is effective or that my feature works
1 parent 18cf12e commit fbf9ce7

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const eslintConfig = [
1717
...compat.config({
1818
extends: ['next/core-web-vitals', 'next/typescript'],
1919
rules: {
20-
'no-console': 'error',
20+
'no-console': ['error', { allow: ['error'] }],
2121
'react/prop-types': 'off',
2222
'react/react-in-jsx-scope': 'off',
2323
'@typescript-eslint/no-empty-function': 'off',

playwright.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,30 @@ export default defineConfig({
2626
projects: [
2727
{
2828
name: 'chromium',
29+
grep: /@desktop|@chrome|@chromium/,
2930
use: { ...devices['Desktop Chrome'] },
3031
},
3132

3233
{
3334
name: 'firefox',
35+
grep: /@desktop|@firefox/,
3436
use: { ...devices['Desktop Firefox'] },
3537
},
36-
3738
{
3839
name: 'webkit',
40+
grep: /@desktop|@webkit|@safari/,
3941
use: { ...devices['Desktop Safari'] },
4042
},
4143
{
4244
name: 'mobile webkit',
45+
grep: /@mobile|@ios/,
4346
use: {
4447
...devices['iPhone 15'],
4548
},
4649
},
4750
{
4851
name: 'mobile chromium',
52+
grep: /@mobile|@android/,
4953
use: {
5054
...devices['Pixel 7'],
5155
},

src/e2e/homepage.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { expect, test } from '@playwright/test';
22

3-
test.describe('Test homepage', () => {
4-
test('Verify page content', async ({ page }) => {
3+
test(
4+
'Verify page content',
5+
{
6+
tag: ['@mobile', '@desktop'],
7+
},
8+
async ({ page }) => {
59
await page.goto('/', { waitUntil: 'domcontentloaded' });
610

711
await expect(
@@ -13,5 +17,5 @@ test.describe('Test homepage', () => {
1317
).toBeVisible();
1418

1519
await expect(page.getByRole('img', { name: 'Next.js logo' })).toBeVisible();
16-
});
17-
});
20+
},
21+
);

0 commit comments

Comments
 (0)