diff --git a/.github/workflows/e2e-ci.yml b/.github/workflows/e2e-ci.yml new file mode 100644 index 0000000..d5bb769 --- /dev/null +++ b/.github/workflows/e2e-ci.yml @@ -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 diff --git a/e2e/home.spec.ts b/e2e/home.spec.ts new file mode 100644 index 0000000..7362739 --- /dev/null +++ b/e2e/home.spec.ts @@ -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') +}); + diff --git a/package-lock.json b/package-lock.json index b9f3ad7..ccda812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,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", @@ -1006,6 +1007,22 @@ "node": ">= 8" } }, + "node_modules/@playwright/test": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz", + "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "playwright-core": "1.22.2" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@rushstack/eslint-patch": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz", @@ -5280,6 +5297,18 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/playwright-core": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz", + "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==", + "dev": true, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", @@ -7532,6 +7561,16 @@ "fastq": "^1.6.0" } }, + "@playwright/test": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz", + "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==", + "dev": true, + "requires": { + "@types/node": "*", + "playwright-core": "1.22.2" + } + }, "@rushstack/eslint-patch": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz", @@ -10766,6 +10805,12 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "playwright-core": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz", + "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==", + "dev": true + }, "please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", diff --git a/package.json b/package.json index 667f33c..c77f7a9 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..1a927d3 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,10 @@ +import { PlaywrightTestConfig } from "@playwright/test"; + +const config: PlaywrightTestConfig = { + webServer: { + command: "npm run start", + url: "http://localhost:3000", + } +}; + +export default config; \ No newline at end of file