fix(testing): add cleanup on cypress e2e tests (#12089)
This commit is contained in:
parent
f84f2819f6
commit
96be1f55fe
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
checkFilesDoNotExist,
|
checkFilesDoNotExist,
|
||||||
|
cleanupProject,
|
||||||
createFile,
|
createFile,
|
||||||
newProject,
|
newProject,
|
||||||
runCLI,
|
runCLI,
|
||||||
@ -144,6 +145,8 @@ import {CommonModule} from '@angular/common';
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => cleanupProject());
|
||||||
|
|
||||||
it('should test app', () => {
|
it('should test app', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
|
`generate @nrwl/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
checkFilesExist,
|
checkFilesExist,
|
||||||
|
cleanupProject,
|
||||||
createFile,
|
createFile,
|
||||||
killPorts,
|
killPorts,
|
||||||
newProject,
|
newProject,
|
||||||
@ -12,9 +13,13 @@ import {
|
|||||||
|
|
||||||
describe('Cypress E2E Test runner', () => {
|
describe('Cypress E2E Test runner', () => {
|
||||||
const myapp = uniq('myapp');
|
const myapp = uniq('myapp');
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
newProject();
|
newProject();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => cleanupProject());
|
||||||
|
|
||||||
it('should generate an app with the Cypress as e2e test runner', () => {
|
it('should generate an app with the Cypress as e2e test runner', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/react:app ${myapp} --e2eTestRunner=cypress --linter=eslint`
|
`generate @nrwl/react:app ${myapp} --e2eTestRunner=cypress --linter=eslint`
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
uniq,
|
uniq,
|
||||||
updateFile,
|
updateFile,
|
||||||
expectJestTestsToPass,
|
expectJestTestsToPass,
|
||||||
|
cleanupProject,
|
||||||
} from '@nrwl/e2e/utils';
|
} from '@nrwl/e2e/utils';
|
||||||
|
|
||||||
describe('Jest', () => {
|
describe('Jest', () => {
|
||||||
@ -13,6 +14,8 @@ describe('Jest', () => {
|
|||||||
newProject({ name: uniq('proj-jest') });
|
newProject({ name: uniq('proj-jest') });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => cleanupProject());
|
||||||
|
|
||||||
it('should be able test projects using jest', async () => {
|
it('should be able test projects using jest', async () => {
|
||||||
await expectJestTestsToPass('@nrwl/workspace:lib');
|
await expectJestTestsToPass('@nrwl/workspace:lib');
|
||||||
await expectJestTestsToPass('@nrwl/js:lib');
|
await expectJestTestsToPass('@nrwl/js:lib');
|
||||||
@ -50,10 +53,10 @@ describe('Jest', () => {
|
|||||||
stripIndents`
|
stripIndents`
|
||||||
const { registerTsProject } = require('nx/src/utils/register');
|
const { registerTsProject } = require('nx/src/utils/register');
|
||||||
const cleanup = registerTsProject('.', 'tsconfig.base.json');
|
const cleanup = registerTsProject('.', 'tsconfig.base.json');
|
||||||
|
|
||||||
import {setup} from '@global-fun/globals';
|
import {setup} from '@global-fun/globals';
|
||||||
export default async function() {setup();}
|
export default async function() {setup();}
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
@ -63,8 +66,8 @@ describe('Jest', () => {
|
|||||||
stripIndents`
|
stripIndents`
|
||||||
import { registerTsProject } from 'nx/src/utils/register';
|
import { registerTsProject } from 'nx/src/utils/register';
|
||||||
const cleanup = registerTsProject('.', 'tsconfig.base.json');
|
const cleanup = registerTsProject('.', 'tsconfig.base.json');
|
||||||
|
|
||||||
import {teardown} from '@global-fun/globals';
|
import {teardown} from '@global-fun/globals';
|
||||||
export default async function() {teardown();}
|
export default async function() {teardown();}
|
||||||
cleanup();
|
cleanup();
|
||||||
`
|
`
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
cleanupProject,
|
||||||
createFile,
|
createFile,
|
||||||
newProject,
|
newProject,
|
||||||
runCLI,
|
runCLI,
|
||||||
@ -12,6 +13,7 @@ describe('React Cypress Component Tests', () => {
|
|||||||
const appName = uniq('cy-react-app');
|
const appName = uniq('cy-react-app');
|
||||||
const usedInAppLibName = uniq('cy-react-lib');
|
const usedInAppLibName = uniq('cy-react-lib');
|
||||||
const buildableLibName = uniq('cy-react-buildable-lib');
|
const buildableLibName = uniq('cy-react-buildable-lib');
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
projectName = newProject({ name: uniq('cy-react') });
|
projectName = newProject({ name: uniq('cy-react') });
|
||||||
runCLI(`generate @nrwl/react:app ${appName} --no-interactive`);
|
runCLI(`generate @nrwl/react:app ${appName} --no-interactive`);
|
||||||
@ -96,8 +98,8 @@ export interface InputProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Input(props: InputProps) {
|
export function Input(props: InputProps) {
|
||||||
return (
|
return (
|
||||||
<label className="text-green-500">Email:
|
<label className="text-green-500">Email:
|
||||||
<input className="border-blue-500" type="email" readOnly={props.readOnly}/>
|
<input className="border-blue-500" type="email" readOnly={props.readOnly}/>
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
@ -117,6 +119,8 @@ export default Input;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => cleanupProject());
|
||||||
|
|
||||||
it('should test app', () => {
|
it('should test app', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/react:cypress-component-configuration --project=${appName} --generate-tests`
|
`generate @nrwl/react:cypress-component-configuration --project=${appName} --generate-tests`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user