Skip to content

Commit 21536a6

Browse files
committed
minor test restructuring, run base then mask then full component tests
1 parent 5f38e47 commit 21536a6

3 files changed

Lines changed: 38 additions & 16 deletions

File tree

playwright.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,39 +34,55 @@ export default defineConfig({
3434

3535
/* Configure projects for major browsers */
3636
projects: [
37+
{
38+
name: 'base tests',
39+
testMatch: '**/base.spec.ts',
40+
},
41+
{
42+
name: 'mask tests',
43+
testMatch: '**/mask.spec.ts',
44+
dependencies: ['base tests'],
45+
},
3746
{
3847
name: 'chromium',
3948
use: { ...devices['Desktop Chrome'] },
49+
dependencies: ['base tests', 'mask tests'],
4050
},
4151

4252
{
4353
name: 'firefox',
4454
use: { ...devices['Desktop Firefox'] },
55+
dependencies: ['base tests', 'mask tests'],
4556
},
4657

4758
{
4859
name: 'webkit',
4960
use: { ...devices['Desktop Safari'] },
61+
dependencies: ['base tests', 'mask tests'],
5062
},
5163

5264
/* Test against mobile viewports. */
5365
{
5466
name: 'Mobile Chrome',
5567
use: { ...devices['Pixel 5'] },
68+
dependencies: ['base tests', 'mask tests'],
5669
},
5770
{
5871
name: 'Mobile Safari',
5972
use: { ...devices['iPhone 12'] },
73+
dependencies: ['base tests', 'mask tests'],
6074
},
6175

6276
/* Test against branded browsers. */
6377
{
6478
name: 'Microsoft Edge',
6579
use: { ...devices['Desktop Edge'], channel: 'msedge' },
80+
dependencies: ['base tests', 'mask tests'],
6681
},
6782
{
6883
name: 'Google Chrome',
6984
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
85+
dependencies: ['base tests', 'mask tests'],
7086
},
7187
],
7288

tests/base.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { test, expect } from '@playwright/test';
2+
import * as path from 'path';
3+
4+
const projectDir = path.resolve(__dirname, '../');
5+
const filePath = path.join(projectDir, 'examples/index.html');
6+
const fileUrl = `file://${filePath}`;
7+
8+
test.describe('base tests', () => {
9+
test.beforeEach(async ({ page }) => {
10+
await page.goto(fileUrl);
11+
});
12+
13+
test('sanity startup', async ({ page }) => {
14+
const currencyInput = await page.locator('#currency-input');
15+
await expect(currencyInput).toHaveValue('$0.00 USD');
16+
});
17+
18+
test('undefined value results in correct 0 of input', async ({ page }) => {
19+
const nullInputTest = await page.locator('#null-input-test');
20+
await expect(nullInputTest).toHaveValue('$0.00 USD');
21+
});
22+
});

tests/test.spec.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,6 @@ const projectDir = path.resolve(__dirname, '../');
55
const filePath = path.join(projectDir, 'examples/index.html');
66
const fileUrl = `file://${filePath}`;
77

8-
test.describe('test', () => {
9-
test.beforeEach(async ({ page }) => {
10-
await page.goto(fileUrl);
11-
});
12-
13-
test('sanity startup', async ({ page }) => {
14-
const currencyInput = await page.locator('#currency-input');
15-
await expect(currencyInput).toHaveValue('$0.00 USD');
16-
});
17-
18-
test('undefined value results in correct 0 of input', async ({ page }) => {
19-
const nullInputTest = await page.locator('#null-input-test');
20-
await expect(nullInputTest).toHaveValue('$0.00 USD');
21-
});
22-
});
23-
248
test.describe('input caret selection', () => {
259
const suffix = ' USD';
2610
const prefix = '$';

0 commit comments

Comments
 (0)