@@ -27,6 +27,8 @@ import { cypressEntityFiles, cypressFiles } from './files.js';
2727
2828const { ANGULAR } = clientFrameworkTypes ;
2929
30+ const WAIT_TIMEOUT = 3 * 60000 ;
31+
3032export default class CypressGenerator extends BaseApplicationGenerator {
3133 async beforeQueue ( ) {
3234 if ( ! this . fromBlueprint ) {
@@ -188,22 +190,28 @@ export default class CypressGenerator extends BaseApplicationGenerator {
188190 } ,
189191
190192 configure ( { application } ) {
193+ const { devServerPort, devServerPortProxy : devServerPortE2e = devServerPort } = application ;
194+
191195 const clientPackageJson = this . createStorage ( this . destinationPath ( application . clientRootDir ! , 'package.json' ) ) ;
192196 clientPackageJson . merge ( {
193197 devDependencies : {
194198 'eslint-plugin-cypress' : application . nodeDependencies [ 'eslint-plugin-cypress' ] ,
195199 } ,
196200 scripts : {
201+ 'ci:e2e:run' : 'concurrently -k -s first -n application,e2e -c red,blue npm:ci:e2e:server:start npm:e2e:headless' ,
202+ 'ci:e2e:dev' : `concurrently -k -s first -n application,e2e -c red,blue npm:app:start npm:e2e:headless` ,
203+ cypress : 'cypress open --e2e' ,
197204 e2e : 'npm run e2e:cypress:headed --' ,
198- 'e2e:headless' : 'npm run e2e:cypress --' ,
199- 'e2e:cypress:headed' : 'npm run e2e:cypress -- --headed' ,
200205 'e2e:cypress' : 'cypress run --e2e --browser chrome' ,
206+ 'e2e:cypress:headed' : 'npm run e2e:cypress -- --headed' ,
201207 'e2e:cypress:record' : 'npm run e2e:cypress -- --record' ,
202- cypress : 'cypress open --e2e' ,
208+ 'e2e:dev' : `concurrently -k -s first -n application,e2e -c red,blue npm:app:start npm:e2e` ,
209+ 'e2e:devserver' : `concurrently -k -s first -n backend,frontend,e2e -c red,yellow,blue npm:backend:start npm:start "wait-on -t ${ WAIT_TIMEOUT } http-get://127.0.0.1:${ devServerPortE2e } && npm run e2e:headless -- -c baseUrl=http://localhost:${ devServerPortE2e } "` ,
210+ 'pree2e:headless' : 'npm run ci:server:await' ,
211+ 'e2e:headless' : 'npm run e2e:cypress --' ,
203212 } ,
204213 } ) ;
205214 } ,
206-
207215 configureAudits ( { application } ) {
208216 if ( ! application . cypressAudit ) return ;
209217 const clientPackageJson = this . createStorage ( this . destinationPath ( application . clientRootDir ! , 'package.json' ) ) ;
@@ -220,7 +228,7 @@ export default class CypressGenerator extends BaseApplicationGenerator {
220228 } ) ;
221229 } ,
222230 configureCoverage ( { application, source } ) {
223- const { cypressCoverage, clientFrameworkAngular, dasherizedBaseName } = application ;
231+ const { cypressCoverage, clientFrameworkAngular, clientRootDir , dasherizedBaseName } = application ;
224232 if ( ! cypressCoverage ) return ;
225233 const clientPackageJson = this . createStorage ( this . destinationPath ( application . clientRootDir ! , 'package.json' ) ) ;
226234 clientPackageJson . merge ( {
@@ -241,7 +249,10 @@ export default class CypressGenerator extends BaseApplicationGenerator {
241249 } ) ;
242250 if ( clientFrameworkAngular ) {
243251 // Add 'ng build --configuration instrumenter' support
244- this . createStorage ( 'angular.json' ) . setPath ( `projects.${ dasherizedBaseName } .architect.build.configurations.instrumenter` , { } ) ;
252+ this . createStorage ( `${ clientRootDir } angular.json` ) . setPath (
253+ `projects.${ dasherizedBaseName } .architect.build.configurations.instrumenter` ,
254+ { } ,
255+ ) ;
245256 source . addWebpackConfig ?.( {
246257 config : `targetOptions.configuration === 'instrumenter'
247258 ? {
0 commit comments