fix(testing): increase the default timeout to 60s for the cypress web dev server to start (#22132)

This commit is contained in:
Leosvel Pérez Espinosa 2024-03-04 15:38:04 +01:00 committed by GitHub
parent 1d6e0f8c67
commit dee40997da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1 additions and 12 deletions

View File

@ -13,7 +13,6 @@ import {
runCLI, runCLI,
runCommandUntil, runCommandUntil,
runE2ETests, runE2ETests,
setCypressWebServerTimeout,
tmpProjPath, tmpProjPath,
uniq, uniq,
updateFile, updateFile,
@ -128,7 +127,6 @@ describe('Angular Projects', () => {
// check e2e tests // check e2e tests
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`${app1}-e2e/cypress.config.ts`);
const e2eResults = runCLI(`e2e ${app1}-e2e`); const e2eResults = runCLI(`e2e ${app1}-e2e`);
expect(e2eResults).toContain('All specs passed!'); expect(e2eResults).toContain('All specs passed!');
expect(await killPort(4200)).toBeTruthy(); expect(await killPort(4200)).toBeTruthy();

View File

@ -8,7 +8,6 @@ import {
runCLI, runCLI,
runCommandUntil, runCommandUntil,
runE2ETests, runE2ETests,
setCypressWebServerTimeout,
uniq, uniq,
updateFile, updateFile,
} from '@nx/e2e/utils'; } from '@nx/e2e/utils';
@ -378,7 +377,6 @@ describe('Angular Module Federation', () => {
expect(buildRemoteOutput).toContain('Successfully ran target build'); expect(buildRemoteOutput).toContain('Successfully ran target build');
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`${host}-e2e/cypress.config.ts`);
const e2eProcess = await runCommandUntil(`e2e ${host}-e2e`, (output) => const e2eProcess = await runCommandUntil(`e2e ${host}-e2e`, (output) =>
output.includes('All specs passed!') output.includes('All specs passed!')
); );
@ -470,7 +468,6 @@ describe('Angular Module Federation', () => {
expect(buildRemoteOutput).toContain('Successfully ran target build'); expect(buildRemoteOutput).toContain('Successfully ran target build');
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`${host}-e2e/cypress.config.ts`);
const e2eProcess = await runCommandUntil(`e2e ${host}-e2e`, (output) => const e2eProcess = await runCommandUntil(`e2e ${host}-e2e`, (output) =>
output.includes('All specs passed!') output.includes('All specs passed!')
); );

View File

@ -7,7 +7,6 @@ import {
readJson, readJson,
runCLI, runCLI,
runE2ETests, runE2ETests,
setCypressWebServerTimeout,
uniq, uniq,
updateFile, updateFile,
} from '@nx/e2e/utils'; } from '@nx/e2e/utils';
@ -77,7 +76,6 @@ describe('env vars', () => {
); );
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`apps/${myapp}-e2e/cypress.config.ts`);
// contains the correct output and works // contains the correct output and works
const run1 = runCLI( const run1 = runCLI(
`e2e ${myapp}-e2e --config \\'{\\"env\\":{\\"cliArg\\":\\"i am from the cli args\\"}}\\'` `e2e ${myapp}-e2e --config \\'{\\"env\\":{\\"cliArg\\":\\"i am from the cli args\\"}}\\'`
@ -169,7 +167,6 @@ export default defineConfig({
); );
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`apps/${appName}/cypress.config.ts`);
expect(runCLI(`run ${appName}:component-test`)).toContain( expect(runCLI(`run ${appName}:component-test`)).toContain(
'All specs passed!' 'All specs passed!'
); );
@ -198,7 +195,6 @@ export default defineConfig({
); );
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`apps/${appName}/cypress.config.ts`);
expect(runCLI(`run ${appName}:component-test`)).toContain( expect(runCLI(`run ${appName}:component-test`)).toContain(
'All specs passed!' 'All specs passed!'
); );

View File

@ -6,7 +6,6 @@ import {
readFile, readFile,
runCLI, runCLI,
runE2ETests, runE2ETests,
setCypressWebServerTimeout,
uniq, uniq,
updateFile, updateFile,
} from '@nx/e2e/utils'; } from '@nx/e2e/utils';
@ -194,7 +193,6 @@ describe('Next.js Applications', () => {
); );
if (runE2ETests('cypress')) { if (runE2ETests('cypress')) {
setCypressWebServerTimeout(`${appName}-e2e/cypress.config.ts`);
const e2eResults = runCLI(`e2e-ci ${appName}-e2e --verbose`, { const e2eResults = runCLI(`e2e-ci ${appName}-e2e --verbose`, {
verbose: true, verbose: true,
}); });

View File

@ -172,7 +172,7 @@ function waitForServer(
let pollTimeout: NodeJS.Timeout | null; let pollTimeout: NodeJS.Timeout | null;
const { protocol } = new URL(url); const { protocol } = new URL(url);
const timeoutDuration = webServerConfig?.timeout ?? 15 * 1000; const timeoutDuration = webServerConfig?.timeout ?? 60 * 1000;
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
clearTimeout(pollTimeout); clearTimeout(pollTimeout);
reject( reject(