├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── meta.json ├── renovate.json └── workflows │ └── nodejs.yml ├── .gitignore ├── LICENSE ├── README.md ├── __tests__ └── sandbox.spec.ts ├── jest.config.js ├── jest.setup.js ├── package-lock.json ├── package.json ├── tsconfig.json └── tslint.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | - 'https://www.buymeacoffee.com/xgirma' 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "cron": "40 6 1-31/2 * *" 3 | } 4 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ], 5 | "automerge": true, 6 | "major": { 7 | "automerge": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: playwright-typescript-ts-jest-jest-expect 2 | 'on': 3 | push: null 4 | schedule: 5 | - cron: 40 6 1-31/2 * * 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: node 12 | uses: actions/setup-node@v1 13 | with: 14 | node-version: 12.x 15 | - name: 'install:linux:dep' 16 | run: > 17 | sudo apt-get update 18 | 19 | sudo apt-get install libwoff1 libopus0 libwebp6 libwebpdemux2 20 | libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 21 | libgdk-pixbuf2.0-0 libegl1 libgles2 libevent-dev libnotify4 libxslt1.1 22 | 23 | sudo apt-get install xvfb 24 | - name: 'npm:install' 25 | run: npm install 26 | env: 27 | CI: true 28 | - name: lint 29 | run: npm run lint --if-present 30 | - name: build 31 | run: npm run build --if-present 32 | - name: test 33 | run: npm run test 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | .idea/ 64 | 65 | .DS_Store 66 | 67 | /build 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 e2e Boilerplates 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub Actions status | e2e-boilerplate/playwright-typescript-ts-jest-jest-expect](https://github.com/e2e-boilerplate/playwright-typescript-ts-jest-jest-expect/workflows/playwright-typescript-ts-jest-jest-expect/badge.svg)](https://github.com/e2e-boilerplate/playwright-typescript-ts-jest-jest-expect/actions?workflow=playwright-typescript-ts-jest-jest-expect) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Buy Me A Coffee](https://img.shields.io/badge/buy-me%20coffee-orange)](https://www.buymeacoffee.com/xgirma) 2 | 3 | # Playwright Boilerplate 4 | 5 | Playwright end-to-end test automation boilerplate, Using [TypeScript](https://www.typescriptlang.org), [ts-jest](https://github.com/kulshekhar/ts-jest), [Jest](https://jestjs.io) and Expect. Clone or fork this repository. 6 | 7 | ## Getting Started 8 | 1. git clone git@github.com:e2e-boilerplate/playwright-typescript-ts-jest-jest-expect.git 9 | 2. cd playwright-typescript-ts-jest-jest-expect 10 | 3. npm install 11 | 4. npm run test 12 | 13 | 14 | For more boilerplate click [here](https://github.com/e2e-boilerplate/utils/blob/master/docs/implemented.md) -------------------------------------------------------------------------------- /__tests__/sandbox.spec.ts: -------------------------------------------------------------------------------- 1 | import { chromium } from "playwright"; 2 | 3 | let page: any; 4 | let browser: any; 5 | 6 | describe("Sandbox", () => { 7 | beforeAll(async () => { 8 | browser = process.env.GITHUB_ACTIONS 9 | ? await chromium.launch() 10 | : await chromium.launch({ headless: false }); 11 | page = await browser.newPage(); 12 | 13 | await page 14 | .goto("https://e2e-boilerplate.github.io/sandbox/", { 15 | waitUntil: "networkidle0", 16 | }) 17 | // tslint:disable-next-line:no-empty 18 | .catch(() => {}); 19 | }); 20 | 21 | afterAll(() => { 22 | if (!page.isClosed()) { 23 | browser.close(); 24 | } 25 | }); 26 | 27 | test("should be on the sandbox", async () => { 28 | await page.waitForSelector("h1"); 29 | const title = await page.$eval( 30 | "h1", 31 | (el: { textContent: any }) => el.textContent 32 | ); 33 | 34 | expect(await page.title()).toEqual("Sandbox"); 35 | expect(title).toEqual("Sandbox"); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | testEnvironment: "node", 3 | testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[tj]s?(x)"], 4 | testPathIgnorePatterns: ["/node_modules/"], 5 | setupFilesAfterEnv: ["./jest.setup.js"], 6 | transform: { 7 | "^.+\\.tsx?$": "ts-jest" 8 | } 9 | }; -------------------------------------------------------------------------------- /jest.setup.js: -------------------------------------------------------------------------------- 1 | jest.setTimeout(50000); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Girma Nigusse ", 3 | "bugs": { 4 | "url": "https://github.com/e2e-boilerplate/playwright-typescript-ts-jest-jest-expect/issues" 5 | }, 6 | "dependencies": { 7 | "chromedriver": "90.0.1", 8 | "jest": "26.6.3", 9 | "playwright": "1.25.2", 10 | "ts-jest": "26.5.6", 11 | "typescript": "4.9.3" 12 | }, 13 | "description": "Playwright end-to-end test automation boilerplate. Using TypeScript, ts-jest, Jest and Expect.", 14 | "devDependencies": { 15 | "@types/jest": "26.0.24", 16 | "@types/node": "13.13.52", 17 | "husky": "6.0.0", 18 | "lint-staged": "10.5.4", 19 | "prettier": "2.7.1", 20 | "tslint": "6.1.3", 21 | "tslint-config-prettier": "1.18.0", 22 | "tslint-plugin-prettier": "2.3.0" 23 | }, 24 | "homepage": "https://github.com/e2e-boilerplate/playwright-typescript-ts-jest-jest-expect#readme", 25 | "husky": { 26 | "hooks": { 27 | "pre-commit": "lint-staged --allow-empty" 28 | } 29 | }, 30 | "keywords": [ 31 | "expect", 32 | "jest", 33 | "playwright", 34 | "playwright automation", 35 | "playwright boilerplate", 36 | "playwright example", 37 | "ts-jest", 38 | "typescript", 39 | "e2e", 40 | "e2e tests", 41 | "boilerplate", 42 | "integration test", 43 | "test automation", 44 | "javascript" 45 | ], 46 | "license": "MIT", 47 | "lint-staged": { 48 | "*.{js,ts,json,md}": [ 49 | "tslint --fix", 50 | "prettier --write" 51 | ] 52 | }, 53 | "name": "playwright-typescript-ts-jest-jest-expect", 54 | "repository": { 55 | "type": "git", 56 | "url": "git+https://github.com/e2e-boilerplate/playwright-typescript-ts-jest-jest-expect.git" 57 | }, 58 | "scripts": { 59 | "lint": "npx tslint -c tslint.json './__tests__/*.ts'", 60 | "pretty": "npx prettier --no-config './__tests__/*.ts' --write", 61 | "test": "npx jest" 62 | }, 63 | "version": "1.0.0" 64 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "moduleResolution": "node", 5 | "resolveJsonModule": true, 6 | "types": [ 7 | "node", 8 | "jest" 9 | ], 10 | "typeRoots": [ 11 | "node_modules/@types" 12 | ], 13 | "outDir": "build", 14 | "target": "es5" 15 | } 16 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "tslint:latest", 4 | "tslint-plugin-prettier", 5 | "tslint-config-prettier" 6 | ], 7 | "rules": { 8 | "prettier": true 9 | }, 10 | "linterOptions": { 11 | "exclude": [ 12 | "*.json", 13 | "**/*.json" 14 | ] 15 | } 16 | } --------------------------------------------------------------------------------