-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cc017c
commit abd484f
Showing
12 changed files
with
231 additions
and
28 deletions.
There are no files selected for viewing
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,55 @@ | ||
name: E2E Tests | ||
|
||
on: | ||
deployment: | ||
|
||
jobs: | ||
run-e2es: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
defaults: | ||
run: | ||
working-directory: packages/app-client | ||
|
||
steps: | ||
- name: Log deployment event | ||
run: echo ${{ toJson(github.event.deployment) }} | ||
|
||
# - uses: actions/checkout@v4 | ||
# - uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20 | ||
# corepack: true | ||
# cache: 'pnpm' | ||
|
||
# - name: Get Playwright version | ||
# id: playwright-version | ||
# run: echo "PLAYWRIGHT_VERSION=$(jq -r .dependencies.playwright package.json)" >> "$GITHUB_OUTPUT" | ||
|
||
# - name: Install dependencies | ||
# run: pnpm i | ||
# working-directory: ./ | ||
|
||
# - name: Restore Playwright browsers from cache | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: ~/.cache/ms-playwright | ||
# key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}-${{ hashFiles('**/playwright.config.ts') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}- | ||
# ${{ runner.os }}-playwright- | ||
|
||
# - name: Install Playwright Browsers | ||
# run: pnpm exec playwright install --with-deps | ||
|
||
# - name: Run e2e tests | ||
# run: pnpm test:e2e | ||
# env: | ||
# BASE_URL: ${{ github.event.deployment_status.environment_url }} | ||
|
||
# - uses: actions/upload-artifact@v4 | ||
# if: always() | ||
# with: | ||
# name: playwright-report | ||
# path: playwright-report/ | ||
# retention-days: 15 |
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 |
---|---|---|
|
@@ -27,4 +27,9 @@ gitignore | |
.DS_Store | ||
Thumbs.db | ||
|
||
cache | ||
cache | ||
|
||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
31 changes: 31 additions & 0 deletions
31
packages/app-client/e2e-tests/createand-view-note.e2e.test.ts
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,31 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('Can create and view a note', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await expect(page).toHaveTitle('Enclosed - Send private and secure notes'); | ||
|
||
// Write a note with a password and delete after reading | ||
await page.getByTestId('note-content').fill('Hello, World!'); | ||
await page.getByTestId('note-password').fill('my-cat-is-cute'); | ||
await page.getByTestId('delete-after-reading').click(); | ||
|
||
await page.getByTestId('create-note').click(); | ||
const noteUrl = await page.getByTestId('note-url').inputValue(); | ||
|
||
expect(noteUrl).toBeDefined(); | ||
|
||
await page.goto(noteUrl); | ||
|
||
await page.getByTestId('note-password-prompt').fill('my-cat-is-cute'); | ||
await page.getByTestId('note-password-submit').click(); | ||
|
||
const noteContent = await page.getByTestId('note-content-display').textContent(); | ||
|
||
expect(noteContent).toBe('Hello, World!'); | ||
|
||
// Refresh the page and check if the note is still there | ||
await page.reload(); | ||
|
||
await expect(page.getByText('Note not found')).toBeVisible(); | ||
}); |
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
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,52 @@ | ||
import process from 'node:process'; | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
const baseURL = process.env.BASE_URL ?? 'http://localhost:3000/'; | ||
const isCI = Boolean(process.env.CI); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './e2e-tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: isCI, | ||
/* Retry on CI only */ | ||
retries: isCI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: isCI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL, | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
|
||
testIdAttribute: 'data-test-id', | ||
locale: 'en-GB', | ||
timezoneId: 'Europe/Paris', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
}); |
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
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
Oops, something went wrong.