-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(test-app): move test app out of the packages dir
- Loading branch information
1 parent
a495599
commit 5753e35
Showing
67 changed files
with
668 additions
and
442 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"cypress/no-unnecessary-waiting": "off" | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.cy.{ts,js,tsx,jsx}", "src/**/*.{ts,js,tsx,jsx}"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Changelog | ||
|
||
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). | ||
|
||
## [1.0.6](https://github.com/Hyperkid123/nxtesting/compare/v1.0.5...v1.0.6) (2023-11-28) | ||
|
||
## [1.0.5](https://github.com/Hyperkid123/nxtesting/compare/v1.0.4...v1.0.5) (2023-11-28) | ||
|
||
## [1.0.4](https://github.com/Hyperkid123/nxtesting/compare/v1.0.3...v1.0.4) (2023-11-28) | ||
|
||
## [1.0.3](https://github.com/Hyperkid123/nxtesting/compare/v1.0.2...v1.0.3) (2023-11-28) | ||
|
||
## [1.0.3](https://github.com/Hyperkid123/nxtesting/compare/v1.0.2...v1.0.3) (2023-11-28) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
e2e: nxE2EPreset(__filename, { cypressDir: 'src' }), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "test-app-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "examples/test-app-e2e/src", | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/cypress:cypress", | ||
"options": { | ||
"cypressConfig": "examples/test-app-e2e/cypress.config.ts", | ||
"testingType": "e2e", | ||
"devServerTarget": "test-app:serve", | ||
"baseUrl": "http://localhost:4200" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "test-app:serve:production" | ||
}, | ||
"ci": { | ||
"devServerTarget": "test-app:serve-static" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["examples/test-app-e2e/**/*.{js,ts}"] | ||
} | ||
} | ||
}, | ||
"implicitDependencies": ["test-app"], | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
describe('shell-e2e', () => { | ||
beforeEach(() => cy.visit('/')); | ||
|
||
it('should display welcome message', () => { | ||
cy.contains(/Scalprum testing page/).should('exist'); | ||
}); | ||
}); |
47 changes: 47 additions & 0 deletions
47
examples/test-app-e2e/src/e2e/test-app/module-loading-errors.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
describe('Module error loading handling', () => { | ||
it('should show chunk loading error message', () => { | ||
cy.visit('http://localhost:4200/legacy'); | ||
|
||
// intercept webpack chunk and return 500 response | ||
cy.intercept('GET', '/src_modules_preLoad_tsx.js', { | ||
statusCode: 500, | ||
}); | ||
|
||
cy.on('uncaught:exception', () => { | ||
// exceptions are expected during this test | ||
// returning false here prevents Cypress from failing the test | ||
return false; | ||
}); | ||
|
||
cy.get('#render-preload-module').click(); | ||
cy.wait(1000); | ||
|
||
cy.contains(`Loading chunk src_modules_preLoad_tsx failed.`).should('exist'); | ||
}); | ||
|
||
it('should handle runtime module error', () => { | ||
cy.on('uncaught:exception', () => { | ||
// exceptions are expected during this test | ||
// returning false here prevents Cypress from failing the test | ||
return false; | ||
}); | ||
cy.visit('http://localhost:4200/runtime-error'); | ||
|
||
// the react app is still active | ||
cy.get('h2').contains('Runtime error route').should('exist'); | ||
// error component is rendered | ||
cy.get('p').contains('Synthetic error message').should('exist'); | ||
}); | ||
|
||
it('should render an error with a message is manifest fetch returned 404', () => { | ||
cy.visit('http://localhost:4200/not-found-error'); | ||
cy.on('uncaught:exception', () => { | ||
// exceptions are expected during this test | ||
// returning false here prevents Cypress from failing the test | ||
return false; | ||
}); | ||
|
||
cy.get('h2').contains('Error loading component').should('exist'); | ||
cy.get('p').contains('Unable to load manifest files at /assets/testPath/foo/bar/nonsense.json! 404: Not Found').should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...app/named-export-scalprum-component.cy.js → ...app/named-export-scalprum-component.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...ess/e2e/test-app/sdk-plugin-loading.cy.js → ...src/e2e/test-app/sdk-plugin-loading.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...ess/e2e/test-app/use-module-loading.cy.js → ...src/e2e/test-app/use-module-loading.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
describe('UseModule loading callback', () => { | ||
beforeEach(() => { | ||
cy.handleMetaError(); | ||
}); | ||
it('should display SDK inbox text', () => { | ||
cy.visit('http://localhost:8123/use-module'); | ||
cy.visit('http://localhost:4200/use-module'); | ||
cy.contains('SDK Inbox').should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const getGreeting = () => cy.get('h1'); |
31 changes: 26 additions & 5 deletions
31
cypress/support/commands.js → ...ples/test-app-e2e/src/support/commands.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.