chore(testing): update nightly ci to ensure cy is available (#18951)

This commit is contained in:
Caleb Ukle 2023-08-31 14:50:36 -05:00 committed by GitHub
parent 6d686564fa
commit 5146a7c9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,16 +94,17 @@ describe('env vars', () => {
});`
);
// contains the correct output and works
const run1 = runCLI(
`e2e ${myapp}-e2e --no-watch --env.cliArg="i am from the cli args"`
);
expect(run1).toContain('All specs passed!');
await killPort(4200);
// tests should not fail because of a config change
updateFile(
`apps/${myapp}-e2e/cypress.config.ts`,
`
if (runE2ETests()) {
// contains the correct output and works
const run1 = runCLI(
`e2e ${myapp}-e2e --no-watch --env.cliArg="i am from the cli args"`
);
expect(run1).toContain('All specs passed!');
await killPort(4200);
// tests should not fail because of a config change
updateFile(
`apps/${myapp}-e2e/cypress.config.ts`,
`
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
@ -113,18 +114,18 @@ export default defineConfig({
fixturesFolder: undefined,
},
});`
);
);
const run2 = runCLI(
`e2e ${myapp}-e2e --no-watch --env.cliArg="i am from the cli args"`
);
expect(run2).toContain('All specs passed!');
await killPort(4200);
const run2 = runCLI(
`e2e ${myapp}-e2e --no-watch --env.cliArg="i am from the cli args"`
);
expect(run2).toContain('All specs passed!');
await killPort(4200);
// make sure project.json env vars also work
updateFile(
`apps/${myapp}-e2e/src/e2e/env.cy.ts`,
`
// make sure project.json env vars also work
updateFile(
`apps/${myapp}-e2e/src/e2e/env.cy.ts`,
`
describe('env vars', () => {
it('should not have cli args', () => {
assert.equal(Cypress.env('cliArg'), undefined);
@ -144,11 +145,12 @@ describe('env vars', () => {
);
});
});`
);
const run3 = runCLI(`e2e ${myapp}-e2e --no-watch`);
expect(run3).toContain('All specs passed!');
);
const run3 = runCLI(`e2e ${myapp}-e2e --no-watch`);
expect(run3).toContain('All specs passed!');
expect(await killPort(4200)).toBeTruthy();
expect(await killPort(4200)).toBeTruthy();
}
},
TEN_MINS_MS
);
@ -164,16 +166,18 @@ describe('env vars', () => {
`generate @nx/angular:app ${ngAppName} --e2eTestRunner=cypress --linter=eslint --no-interactive`
);
const results = runCLI(
`run-many --target=e2e --parallel=2 --port=cypress-auto --output-style=stream`
);
expect(results).toContain('Using port 4200');
expect(results).toContain('Using port 4201');
expect(results).toContain('Successfully ran target e2e for 2 projects');
checkFilesDoNotExist(
`node_modules/@nx/cypress/src/executors/cypress/4200.txt`,
`node_modules/@nx/cypress/src/executors/cypress/4201.txt`
);
if (runE2ETests()) {
const results = runCLI(
`run-many --target=e2e --parallel=2 --port=cypress-auto --output-style=stream`
);
expect(results).toContain('Using port 4200');
expect(results).toContain('Using port 4201');
expect(results).toContain('Successfully ran target e2e for 2 projects');
checkFilesDoNotExist(
`node_modules/@nx/cypress/src/executors/cypress/4200.txt`,
`node_modules/@nx/cypress/src/executors/cypress/4201.txt`
);
}
},
TEN_MINS_MS
);