Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zewa666/au-puppeteer-example
A sample showing how an Aurelia app can be tested with Puppeteer
https://github.com/zewa666/au-puppeteer-example
aurelia e2e-tests jest puppeteer typescript
Last synced: 25 days ago
JSON representation
A sample showing how an Aurelia app can be tested with Puppeteer
- Host: GitHub
- URL: https://github.com/zewa666/au-puppeteer-example
- Owner: zewa666
- Created: 2020-05-06T08:49:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-31T13:16:06.000Z (5 months ago)
- Last Synced: 2024-11-15T08:28:16.895Z (3 months ago)
- Topics: aurelia, e2e-tests, jest, puppeteer, typescript
- Language: TypeScript
- Size: 314 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Aurelia with Puppeteer
This is a sample repository showing the basic navigation example skeleton scaffolded with the Aurelia CLI and using Typescript, Puppeteer and Jest for E2E testing.
During scaffold, no E2E option was selected and Jest for unit testing.## Setting up your project for Puppeteer
In order to get started follow these steps:
1. install these dependencies: `npm install --save-dev cross-env puppeteer @types/puppeteer`
2. In the folder `test` create a file `jest-puppeteer.config.json` with this content
```javascript
{
"modulePaths": [
"/src",
"/node_modules"
],
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"testMatch": [
"/e2e/**/*.spec.ts"
],
"testEnvironment": "node",
"collectCoverage": false
}
```
3. create a folder `test/e2e`
4. create your test files ending with `YOURTESTNAME.spec.ts`
> see `test/e2e/demo.spec.ts` for a sample with additional comments
5. create the following npm scripts in your `package.json`
```json
{
...
"scripts": {
...
"puppeteer": "jest --config=test/jest-puppeteer.config.json",
"puppeteer-headless": "cross-env HEADLESS=true jest --config=test/jest-puppeteer.config.json"
}
...
}
```
6. start the app in a terminal `npm start`
7. in another terminal run
* tests with browser visible via `npm run puppeteer`
* run tests with a headless browser window via `npm run puppeteer-headless`