From bbb00d60e6ab12044ae94ca6c60eacea1bcc5014 Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 17 Oct 2023 23:10:08 +0200 Subject: [PATCH] feat(doc): move modal --- .../modal}/.eslintrc.json | 2 +- apps/{testing-modal => test/modal}/README.md | 2 +- .../modal}/cypress.config.ts | 0 .../modal}/cypress/fixtures/example.json | 0 .../modal}/cypress/support/commands.ts | 0 .../cypress/support/component-index.html | 12 ++++++ .../modal}/cypress/support/component.ts | 0 .../modal}/cypress/tsconfig.json | 0 .../modal}/jest.config.ts | 4 +- .../modal}/project.json | 36 +++++++++--------- .../modal}/src/app/app.component.cy.ts | 0 .../modal}/src/app/app.component.spec.ts | 0 .../modal}/src/app/app.component.ts | 0 .../modal}/src/app/app.config.ts | 0 .../modal}/src/app/error.dialog.ts | 0 .../src/app/profil-confirmation.dialog.ts | 0 .../modal}/src/assets/.gitkeep | 0 .../modal}/src/favicon.ico | Bin .../modal}/src/index.html | 0 .../{testing-modal => test/modal}/src/main.ts | 0 .../modal}/src/styles.scss | 0 .../modal}/src/test-setup.ts | 0 .../modal}/tailwind.config.js | 0 .../modal}/tsconfig.app.json | 2 +- .../modal}/tsconfig.editor.json | 0 .../modal}/tsconfig.json | 2 +- .../modal}/tsconfig.spec.json | 2 +- .../cypress/support/component-index.html | 13 ------- .../docs/challenges/testing/20-modal.md | 8 ++-- 29 files changed, 41 insertions(+), 42 deletions(-) rename apps/{testing-modal => test/modal}/.eslintrc.json (94%) rename apps/{testing-modal => test/modal}/README.md (88%) rename apps/{testing-modal => test/modal}/cypress.config.ts (100%) rename apps/{testing-modal => test/modal}/cypress/fixtures/example.json (100%) rename apps/{testing-modal => test/modal}/cypress/support/commands.ts (100%) create mode 100644 apps/test/modal/cypress/support/component-index.html rename apps/{testing-modal => test/modal}/cypress/support/component.ts (100%) rename apps/{testing-modal => test/modal}/cypress/tsconfig.json (100%) rename apps/{testing-modal => test/modal}/jest.config.ts (89%) rename apps/{testing-modal => test/modal}/project.json (70%) rename apps/{testing-modal => test/modal}/src/app/app.component.cy.ts (100%) rename apps/{testing-modal => test/modal}/src/app/app.component.spec.ts (100%) rename apps/{testing-modal => test/modal}/src/app/app.component.ts (100%) rename apps/{testing-modal => test/modal}/src/app/app.config.ts (100%) rename apps/{testing-modal => test/modal}/src/app/error.dialog.ts (100%) rename apps/{testing-modal => test/modal}/src/app/profil-confirmation.dialog.ts (100%) rename apps/{testing-modal => test/modal}/src/assets/.gitkeep (100%) rename apps/{testing-modal => test/modal}/src/favicon.ico (100%) rename apps/{testing-modal => test/modal}/src/index.html (100%) rename apps/{testing-modal => test/modal}/src/main.ts (100%) rename apps/{testing-modal => test/modal}/src/styles.scss (100%) rename apps/{testing-modal => test/modal}/src/test-setup.ts (100%) rename apps/{testing-modal => test/modal}/tailwind.config.js (100%) rename apps/{testing-modal => test/modal}/tsconfig.app.json (89%) rename apps/{testing-modal => test/modal}/tsconfig.editor.json (100%) rename apps/{testing-modal => test/modal}/tsconfig.json (94%) rename apps/{testing-modal => test/modal}/tsconfig.spec.json (88%) delete mode 100644 apps/testing-modal/cypress/support/component-index.html diff --git a/apps/testing-modal/.eslintrc.json b/apps/test/modal/.eslintrc.json similarity index 94% rename from apps/testing-modal/.eslintrc.json rename to apps/test/modal/.eslintrc.json index b428c22..bf8df14 100644 --- a/apps/testing-modal/.eslintrc.json +++ b/apps/test/modal/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["../../.eslintrc.json"], + "extends": ["../../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { diff --git a/apps/testing-modal/README.md b/apps/test/modal/README.md similarity index 88% rename from apps/testing-modal/README.md rename to apps/test/modal/README.md index 01cc159..c55f0f8 100644 --- a/apps/testing-modal/README.md +++ b/apps/test/modal/README.md @@ -5,7 +5,7 @@ ### Run Application ```bash -npx nx serve testing-modal +npx nx serve test-modal ``` ### Documentation and Instruction diff --git a/apps/testing-modal/cypress.config.ts b/apps/test/modal/cypress.config.ts similarity index 100% rename from apps/testing-modal/cypress.config.ts rename to apps/test/modal/cypress.config.ts diff --git a/apps/testing-modal/cypress/fixtures/example.json b/apps/test/modal/cypress/fixtures/example.json similarity index 100% rename from apps/testing-modal/cypress/fixtures/example.json rename to apps/test/modal/cypress/fixtures/example.json diff --git a/apps/testing-modal/cypress/support/commands.ts b/apps/test/modal/cypress/support/commands.ts similarity index 100% rename from apps/testing-modal/cypress/support/commands.ts rename to apps/test/modal/cypress/support/commands.ts diff --git a/apps/test/modal/cypress/support/component-index.html b/apps/test/modal/cypress/support/component-index.html new file mode 100644 index 0000000..539b1d2 --- /dev/null +++ b/apps/test/modal/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + testing-modal Components App + + +
+ + diff --git a/apps/testing-modal/cypress/support/component.ts b/apps/test/modal/cypress/support/component.ts similarity index 100% rename from apps/testing-modal/cypress/support/component.ts rename to apps/test/modal/cypress/support/component.ts diff --git a/apps/testing-modal/cypress/tsconfig.json b/apps/test/modal/cypress/tsconfig.json similarity index 100% rename from apps/testing-modal/cypress/tsconfig.json rename to apps/test/modal/cypress/tsconfig.json diff --git a/apps/testing-modal/jest.config.ts b/apps/test/modal/jest.config.ts similarity index 89% rename from apps/testing-modal/jest.config.ts rename to apps/test/modal/jest.config.ts index d895133..ad308f8 100644 --- a/apps/testing-modal/jest.config.ts +++ b/apps/test/modal/jest.config.ts @@ -1,7 +1,7 @@ /* eslint-disable */ export default { - displayName: 'testing-modal', - preset: '../../jest.preset.js', + displayName: 'test-modal', + preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/apps/testing-modal/project.json b/apps/test/modal/project.json similarity index 70% rename from apps/testing-modal/project.json rename to apps/test/modal/project.json index 306fb9b..1bd266a 100644 --- a/apps/testing-modal/project.json +++ b/apps/test/modal/project.json @@ -1,26 +1,26 @@ { - "name": "testing-modal", - "$schema": "../node_modules/nx/schemas/project-schema.json", + "name": "test-modal", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", "projectType": "application", - "sourceRoot": "apps/testing-modal/src", + "sourceRoot": "apps/test/modal/src", "prefix": "app", "targets": { "build": { "executor": "@angular-devkit/build-angular:browser", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/testing-modal", - "index": "apps/testing-modal/src/index.html", - "main": "apps/testing-modal/src/main.ts", + "outputPath": "dist/apps/test/modal", + "index": "apps/test/modal/src/index.html", + "main": "apps/test/modal/src/main.ts", "polyfills": ["zone.js"], - "tsConfig": "apps/testing-modal/tsconfig.app.json", + "tsConfig": "apps/test/modal/tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ - "apps/testing-modal/src/favicon.ico", - "apps/testing-modal/src/assets" + "apps/test/modal/src/favicon.ico", + "apps/test/modal/src/assets" ], "styles": [ - "apps/testing-modal/src/styles.scss", + "apps/test/modal/src/styles.scss", "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css" ], "scripts": [] @@ -56,10 +56,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "testing-modal:build:production" + "browserTarget": "test-modal:build:production" }, "development": { - "browserTarget": "testing-modal:build:development" + "browserTarget": "test-modal:build:development" } }, "defaultConfiguration": "development" @@ -67,7 +67,7 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "testing-modal:build" + "browserTarget": "test-modal:build" } }, "lint": { @@ -75,8 +75,8 @@ "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ - "apps/testing-modal/**/*.ts", - "apps/testing-modal/**/*.html" + "apps/test/modal/**/*.ts", + "apps/test/modal/**/*.html" ] } }, @@ -84,7 +84,7 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/testing-modal/jest.config.ts", + "jestConfig": "apps/test/modal/jest.config.ts", "passWithNoTests": true }, "configurations": { @@ -97,10 +97,10 @@ "component-test": { "executor": "@nx/cypress:cypress", "options": { - "cypressConfig": "apps/testing-modal/cypress.config.ts", + "cypressConfig": "apps/test/modal/cypress.config.ts", "testingType": "component", "skipServe": true, - "devServerTarget": "testing-modal:build" + "devServerTarget": "test-modal:build" } } }, diff --git a/apps/testing-modal/src/app/app.component.cy.ts b/apps/test/modal/src/app/app.component.cy.ts similarity index 100% rename from apps/testing-modal/src/app/app.component.cy.ts rename to apps/test/modal/src/app/app.component.cy.ts diff --git a/apps/testing-modal/src/app/app.component.spec.ts b/apps/test/modal/src/app/app.component.spec.ts similarity index 100% rename from apps/testing-modal/src/app/app.component.spec.ts rename to apps/test/modal/src/app/app.component.spec.ts diff --git a/apps/testing-modal/src/app/app.component.ts b/apps/test/modal/src/app/app.component.ts similarity index 100% rename from apps/testing-modal/src/app/app.component.ts rename to apps/test/modal/src/app/app.component.ts diff --git a/apps/testing-modal/src/app/app.config.ts b/apps/test/modal/src/app/app.config.ts similarity index 100% rename from apps/testing-modal/src/app/app.config.ts rename to apps/test/modal/src/app/app.config.ts diff --git a/apps/testing-modal/src/app/error.dialog.ts b/apps/test/modal/src/app/error.dialog.ts similarity index 100% rename from apps/testing-modal/src/app/error.dialog.ts rename to apps/test/modal/src/app/error.dialog.ts diff --git a/apps/testing-modal/src/app/profil-confirmation.dialog.ts b/apps/test/modal/src/app/profil-confirmation.dialog.ts similarity index 100% rename from apps/testing-modal/src/app/profil-confirmation.dialog.ts rename to apps/test/modal/src/app/profil-confirmation.dialog.ts diff --git a/apps/testing-modal/src/assets/.gitkeep b/apps/test/modal/src/assets/.gitkeep similarity index 100% rename from apps/testing-modal/src/assets/.gitkeep rename to apps/test/modal/src/assets/.gitkeep diff --git a/apps/testing-modal/src/favicon.ico b/apps/test/modal/src/favicon.ico similarity index 100% rename from apps/testing-modal/src/favicon.ico rename to apps/test/modal/src/favicon.ico diff --git a/apps/testing-modal/src/index.html b/apps/test/modal/src/index.html similarity index 100% rename from apps/testing-modal/src/index.html rename to apps/test/modal/src/index.html diff --git a/apps/testing-modal/src/main.ts b/apps/test/modal/src/main.ts similarity index 100% rename from apps/testing-modal/src/main.ts rename to apps/test/modal/src/main.ts diff --git a/apps/testing-modal/src/styles.scss b/apps/test/modal/src/styles.scss similarity index 100% rename from apps/testing-modal/src/styles.scss rename to apps/test/modal/src/styles.scss diff --git a/apps/testing-modal/src/test-setup.ts b/apps/test/modal/src/test-setup.ts similarity index 100% rename from apps/testing-modal/src/test-setup.ts rename to apps/test/modal/src/test-setup.ts diff --git a/apps/testing-modal/tailwind.config.js b/apps/test/modal/tailwind.config.js similarity index 100% rename from apps/testing-modal/tailwind.config.js rename to apps/test/modal/tailwind.config.js diff --git a/apps/testing-modal/tsconfig.app.json b/apps/test/modal/tsconfig.app.json similarity index 89% rename from apps/testing-modal/tsconfig.app.json rename to apps/test/modal/tsconfig.app.json index e46d4fc..01a02ed 100644 --- a/apps/testing-modal/tsconfig.app.json +++ b/apps/test/modal/tsconfig.app.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "types": [] }, "files": ["src/main.ts"], diff --git a/apps/testing-modal/tsconfig.editor.json b/apps/test/modal/tsconfig.editor.json similarity index 100% rename from apps/testing-modal/tsconfig.editor.json rename to apps/test/modal/tsconfig.editor.json diff --git a/apps/testing-modal/tsconfig.json b/apps/test/modal/tsconfig.json similarity index 94% rename from apps/testing-modal/tsconfig.json rename to apps/test/modal/tsconfig.json index 28546c4..3879b94 100644 --- a/apps/testing-modal/tsconfig.json +++ b/apps/test/modal/tsconfig.json @@ -25,7 +25,7 @@ "path": "./cypress/tsconfig.json" } ], - "extends": "../../tsconfig.base.json", + "extends": "../../../tsconfig.base.json", "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, diff --git a/apps/testing-modal/tsconfig.spec.json b/apps/test/modal/tsconfig.spec.json similarity index 88% rename from apps/testing-modal/tsconfig.spec.json rename to apps/test/modal/tsconfig.spec.json index 1a4817a..c0c092e 100644 --- a/apps/testing-modal/tsconfig.spec.json +++ b/apps/test/modal/tsconfig.spec.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "module": "commonjs", "types": ["jest", "node", "@testing-library/jest-dom"] }, diff --git a/apps/testing-modal/cypress/support/component-index.html b/apps/testing-modal/cypress/support/component-index.html deleted file mode 100644 index e8135e7..0000000 --- a/apps/testing-modal/cypress/support/component-index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - testing-modal Components App - - - -
- - diff --git a/docs/src/content/docs/challenges/testing/20-modal.md b/docs/src/content/docs/challenges/testing/20-modal.md index cddedd1..524ed88 100644 --- a/docs/src/content/docs/challenges/testing/20-modal.md +++ b/docs/src/content/docs/challenges/testing/20-modal.md @@ -3,7 +3,7 @@ title: 🟠 Modal description: Challenge 20 is about testing modals author: Thomas Laforge challengeNumber: 20 -command: testing-modal +command: test-modal sidebar: order: 111 --- @@ -16,11 +16,11 @@ In the confirmation modal, if you click the **Confirm** button, a message confir The goal of this challenge is to test the dialogs inside your application. To do so, we will test the full application like an end-to-end test will do. This means, we will test the `AppComponent` as a black box and react to events on the page. No internal details should be tested. The difference between an e2e test and integration test is that we will mock all API calls. _(All http requests are faked inside this application, but this would not be the case in a real entreprice application.)_ -You can play with it by running : `npx nx serve testing-modal`. +You can play with it by running : `npx nx serve test-modal`. -The file named `app.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-modal`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks. +The file named `app.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test test-modal`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks. -For testing cypress, you will execute your test inside the `app.component.cy.ts` and run `npx nx component-test testing-modal` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. +For testing cypress, you will execute your test inside the `app.component.cy.ts` and run `npx nx component-test test-modal` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. # Statement