-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gha): add end-to-end testing framework
This change integrates Playwright Automation tool into the CI process. It also, as part of this change, introduce a small GitHub Actions workflows refactoring that does the following: - Rename workflow files & job names to better capture their intention - Merge PR push-triggered & comment-triggered deployment workflows
- Loading branch information
Showing
12 changed files
with
656 additions
and
52 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,54 @@ | ||
name: Deploy | ||
|
||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
- edited | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
concurrency: | ||
group: deployment | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
|
||
deploy: | ||
name: Deploy | ||
uses: arikkfir/delivery/.github/workflows/deploy-to-environment.yml@main | ||
if: github.event_name == 'pull_request' || (github.event.issue.pull_request && github.event.comment.body == '/deploy') | ||
with: | ||
branch: ${{ github.head_ref }} | ||
images: |- | ||
ghcr.io/${{ github.repository }}/backend: ${{ github.event.pull_request.head.sha }} | ||
ghcr.io/${{ github.repository }}/frontend: ${{ github.event.pull_request.head.sha }} | ||
ghcr.io/${{ github.repository }}/migrations: ${{ github.event.pull_request.head.sha }} | ||
ghcr.io/${{ github.repository }}/neo4j: ${{ github.event.pull_request.head.sha }} | ||
secrets: inherit | ||
|
||
e2e-tests: | ||
name: End-to-end Tests | ||
needs: deploy | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
cache: npm | ||
cache-dependency-path: e2e/package-lock.json | ||
- run: npm ci | ||
working-directory: e2e | ||
- run: npx playwright install --with-deps | ||
working-directory: e2e | ||
- run: npx playwright test | ||
working-directory: e2e | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: e2e/playwright-report/ | ||
retention-days: 30 |
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
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,4 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,13 @@ | ||
{ | ||
"name": "greenstar-e2e", | ||
"version": "0.0.0", | ||
"description": "End-to-end tests for Greenstar", | ||
"main": "index.js", | ||
"scripts": {}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@playwright/test": "^1.37.1" | ||
} | ||
} |
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,62 @@ | ||
import {defineConfig, devices} from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
timeout: 30 * 1000, | ||
expect: { | ||
timeout: 5000 | ||
}, | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, | ||
retries: 0, | ||
workers: 1, | ||
reporter: process.env.CI ? 'github' : [ | ||
['list', {printSteps: true}], | ||
['html', {open: 'never'}], | ||
], | ||
use: { | ||
actionTimeout: 0, | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
// baseURL: 'http://127.0.0.1:3000', | ||
trace: 'on', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: {...devices['Desktop Chrome']}, | ||
}, | ||
// { | ||
// name: 'firefox', | ||
// use: { ...devices['Desktop Firefox'] }, | ||
// }, | ||
// { | ||
// name: 'webkit', | ||
// use: { ...devices['Desktop Safari'] }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 7'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 13'] }, | ||
// }, | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
], | ||
}); |
Oops, something went wrong.