Skip to content

Commit eb8b5e4

Browse files
committed
feat: add tests for install-command flag
1 parent 49044c8 commit eb8b5e4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

packages/cli/e2e/__tests__/pw-test.spec.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,28 @@ describe('pw-test', { timeout: 45000 }, () => {
5151
expect(checklyConfig.config?.checks).toBeDefined()
5252
expect(checklyConfig.config?.checks?.playwrightConfigPath).toBe('./playwright.config.ts')
5353
expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined()
54-
expect(checklyConfig.config?.checks?.playwrightChecks.length).toBe(1)
55-
expect(checklyConfig.config?.checks?.playwrightChecks[0].name).toBe('Playwright Test: --grep @TAG-B')
56-
expect(checklyConfig.config?.checks?.playwrightChecks[0].testCommand).toBe('npx playwright test --grep @TAG-B')
54+
const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks
55+
expect(playwrightChecks).toBeDefined()
56+
expect(playwrightChecks!.length).toBe(1)
57+
expect(playwrightChecks![0].name).toBe('Playwright Test: --grep @TAG-B')
58+
expect(playwrightChecks![0].testCommand).toBe('npx playwright test --grep @TAG-B')
59+
})
60+
61+
it('Should add a Playwright test with custom install command to the config', async () => {
62+
const result = await runChecklyCli({
63+
args: ['pw-test', '--install-command', 'pnpm install', '--create-check', '--', `--grep`, '@TAG-B'],
64+
apiKey: config.get('apiKey'),
65+
accountId: config.get('accountId'),
66+
directory: FIXTURE_TEST_PWT_NATIVE,
67+
timeout: 120000, // 2 minutes
68+
})
69+
expect(result.status).toBe(0)
70+
const checklyConfig = await loadChecklyConfig(FIXTURE_TEST_PWT_NATIVE)
71+
expect(checklyConfig.config?.checks).toBeDefined()
72+
expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined()
73+
const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks
74+
expect(playwrightChecks).toBeDefined()
75+
expect(playwrightChecks!.length).toBe(1)
76+
expect(playwrightChecks![0].installCommand).toBe('pnpm install')
5777
})
5878
})

0 commit comments

Comments
 (0)