Skip to content

Commit

Permalink
4243 - E2E: local development command and config (#4244)
Browse files Browse the repository at this point in the history
* 4243 - Prefix tests with number

* 4243 - Playwright: Add local testing command and config

* 4243 - Remove unnecessary comments
  • Loading branch information
sorja authored Jan 24, 2025
1 parent 1863c8e commit 9b02a60
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,11 @@ received-emails/
.vscode

#Test
src/test/e2e/test-results
test-results/

#Playwright
playwright-report/

#DB
db/backup
src/test/e2e/init-db/backup
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"test": "run-s test:integration",
"test:integration": "yarn jest --no-cache --detectOpenHandles --setupFiles dotenv/config",
"test:e2e": "playwright test --config ./src/test/e2e/jest-playwright.config.ts",
"test:e2e:dev": "playwright test --config ./src/test/e2e/jest-playwright.config.local.ts --debug --headed --ui",
"test:e2e:docker": "docker-compose -f src/test/e2e/docker-compose.test.yml up --build --exit-code-from playwright",
"test:watch": "yarn jest --no-cache --detectOpenHandles --watchAll --setupFiles dotenv/config",
"preversion": "git diff --quiet || { echo \"Working directory is dirty\"; exit 1; };",
Expand Down
20 changes: 20 additions & 0 deletions src/test/e2e/jest-playwright.config.local.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PlaywrightTestConfig } from '@playwright/test'

import baseConfig from './jest-playwright.config'

const config: PlaywrightTestConfig = {
...baseConfig,
fullyParallel: true,
retries: 0,
use: {
...baseConfig.use,
headless: false,
baseURL: 'http://localhost:9000',
launchOptions: {
slowMo: 100,
},
trace: 'on-first-retry',
},
}

export default config
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import { expect, test } from '@playwright/test'

/**
* Example of failing test
*/

test.beforeAll(() => {
console.log('beforeall')
})

test('homepage has title and links to intro page', async ({ page }) => {
await page.goto('/')

await expect(page).toHaveTitle(/FRA platform/) // Expect this to fail
// const headerTitle = await page.getByRole('heading', { level: 1, name: 'Global Forest Resources Assessment' })
await expect(page).toHaveTitle(/FRA platform/, { timeout: 10000 })
const headerLogo = await page.getByRole('img', { name: 'FAO' })
await expect(headerLogo).toBeVisible()
const headerTitle = await page.getByText('Global Forest Resources Assessment').first()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { expect, test } from '@playwright/test'

/**
* Example of successful test
*/

test('basic smoke test', async ({ page }) => {
await page.goto('/')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { expect, test } from '@playwright/test'

/**
* Example of login test
*/

test.describe('Login', () => {
test('should login with test user credentials', async ({ page }) => {
await page.goto('/assessments/fra/2025/login')
Expand Down

0 comments on commit 9b02a60

Please sign in to comment.