Skip to content

Commit 382238d

Browse files
authored
test: fix tests (#13)
1 parent ce2f033 commit 382238d

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on:
66
branches: [ main ]
77
jobs:
88
build:
9-
runs-on: ubuntu-latest
9+
runs-on: ${{ matrix.os }}
1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
node-version: [12.x, 14.x, 16.x]
14+
os: [ubuntu-latest, windows-latest, macos-latest]
1415
steps:
1516
- uses: actions/checkout@v2
1617
- name: Use Node.js ${{ matrix.node-version }}

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616
import { PlaywrightTestConfig } from '@playwright/test';
17-
import path from 'path';
1817

1918
const config: PlaywrightTestConfig = {
2019
timeout: 120 * 1000,
2120
testDir: './tests',
21+
reporter: 'list',
2222
};
2323

2424
export default config;

tests/integration.spec.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,37 @@ for (const packageManager of ['npm', 'yarn'] as ('npm' | 'yarn')[]) {
7272
});
7373

7474
test('should generate be able to run TS examples successfully', async ({ run }) => {
75+
test.slow();
7576
const { exitCode, dir, exec } = await run([], { installGitHubActions: false, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false });
7677
expect(exitCode).toBe(0);
7778
expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeTruthy();
7879
expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy();
7980
expect(fs.existsSync(path.join(dir, 'playwright.config.ts'))).toBeTruthy();
8081

81-
const result = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'test']);
82-
expect(result.code).toBe(0);
82+
{
83+
const { code } = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'install-deps']);
84+
expect(code).toBe(0);
85+
}
86+
87+
const { code } = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'test']);
88+
expect(code).toBe(0);
8389
});
8490

8591
test('should generate be able to run JS examples successfully', async ({ run }) => {
92+
test.slow();
8693
const { exitCode, dir, exec } = await run([], { installGitHubActions: false, testDir: 'tests', language: 'JavaScript', installPlaywrightDependencies: false });
8794
expect(exitCode).toBe(0);
8895
expect(fs.existsSync(path.join(dir, 'tests/example.spec.js'))).toBeTruthy();
8996
expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy();
9097
expect(fs.existsSync(path.join(dir, 'playwright.config.js'))).toBeTruthy();
9198

92-
const result = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'test']);
93-
expect(result.code).toBe(0);
99+
{
100+
const { code } = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'install-deps']);
101+
expect(code).toBe(0);
102+
}
103+
104+
const { code } = await exec(packageManager === 'npm' ? 'npx' : 'yarn', ['playwright', 'test']);
105+
expect(code).toBe(0);
94106
});
95107
});
96108
}

0 commit comments

Comments
 (0)