@@ -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