Skip to content

Commit

Permalink
test: add e2e infra with playwright and a sample test (#235)
Browse files Browse the repository at this point in the history
* test: add e2e infra with playwright and a sample test

* test: add github action for e2e test

* test: add config for framework spin-up
  • Loading branch information
lirantal authored Jul 2, 2022
1 parent 5e9ea19 commit 365afa6
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/e2e-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Tests: E2E"
on: [pull_request]
jobs:
tests_e2e:
name: Run end-to-end tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: install dependencies
run: npm ci
- name: install playwright browsers
run: npx playwright install --with-deps
- name: npm run test:e2e
run: npm run test:e2e
8 changes: 8 additions & 0 deletions e2e/home.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test'

test('page should have title of "קהילת Pull Request"', async ({page}) => {
await page.goto('http://localhost:3000/')
const title = await page.title()
expect(title).toBe('קהילת Pull Request')
});

45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"dev": "npm run open-browser && next dev",
"open-browser": "node ./scripts/open-browser.js",
"build": "next build",
"start": "next start",
"start": "npm run build && next start",
"prepare": "husky install",
"lint": "next lint"
"lint": "next lint",
"test:e2e": "playwright test"
},
"dependencies": {
"@mdi/js": "^5.6.55",
Expand All @@ -22,6 +23,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@playwright/test": "^1.22.2",
"@types/node": "^14.11.2",
"@types/react": "^16.9.50",
"eslint": "^7.32.0",
Expand Down
10 changes: 10 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
webServer: {
command: "npm run start",
url: "http://localhost:3000",
}
};

export default config;

0 comments on commit 365afa6

Please sign in to comment.