Skip to content

Commit dae0ce6

Browse files
committed
QA to E2E: app basic flow from scratch (no extensions)
1 parent 920b4e0 commit dae0ce6

11 files changed

Lines changed: 617 additions & 305 deletions

File tree

.github/workflows/tests-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ jobs:
317317
E2E_ACCOUNT_PASSWORD: ${{ secrets.E2E_ACCOUNT_PASSWORD }}
318318
E2E_STORE_FQDN: ${{ secrets.E2E_STORE_FQDN }}
319319
E2E_SECONDARY_CLIENT_ID: ${{ secrets.E2E_SECONDARY_CLIENT_ID }}
320+
E2E_ORG_ID: ${{ secrets.E2E_ORG_ID }}
320321
run: npx playwright test
321322
- name: Upload Playwright report
322323
uses: actions/upload-artifact@v4

packages/e2e/helpers/load-env.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* eslint-disable no-restricted-imports */
2+
import * as fs from 'fs'
3+
import * as path from 'path'
4+
import {fileURLToPath} from 'url'
5+
6+
/**
7+
* Load a .env file into process.env (without overwriting existing values).
8+
* Handles quotes and inline comments (e.g. "VALUE # comment" → "VALUE").
9+
*/
10+
export function loadEnv(dirOrUrl: string): void {
11+
const dir = dirOrUrl.startsWith('file://') ? path.dirname(fileURLToPath(dirOrUrl)) : dirOrUrl
12+
const envPath = path.join(dir, '.env')
13+
if (!fs.existsSync(envPath)) return
14+
15+
for (const line of fs.readFileSync(envPath, 'utf-8').split('\n')) {
16+
const trimmed = line.trim()
17+
if (!trimmed || trimmed.startsWith('#')) continue
18+
const eqIdx = trimmed.indexOf('=')
19+
if (eqIdx === -1) continue
20+
const key = trimmed.slice(0, eqIdx).trim()
21+
let value = trimmed.slice(eqIdx + 1).trim()
22+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
23+
value = value.slice(1, -1)
24+
} else {
25+
const commentIdx = value.indexOf(' #')
26+
if (commentIdx !== -1) value = value.slice(0, commentIdx).trim()
27+
}
28+
process.env[key] ??= value
29+
}
30+
}

packages/e2e/playwright.config.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
/* eslint-disable line-comment-position */
2-
/* eslint-disable no-restricted-imports */
2+
import {loadEnv} from './helpers/load-env.js'
33
import {defineConfig} from '@playwright/test'
4-
import * as fs from 'fs'
5-
import * as path from 'path'
6-
import {fileURLToPath} from 'url'
74

8-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
9-
10-
// Load .env file if present (CI provides env vars directly)
11-
const envPath = path.join(__dirname, '.env')
12-
if (fs.existsSync(envPath)) {
13-
for (const line of fs.readFileSync(envPath, 'utf-8').split('\n')) {
14-
const trimmed = line.trim()
15-
if (!trimmed || trimmed.startsWith('#')) continue
16-
const eqIdx = trimmed.indexOf('=')
17-
if (eqIdx === -1) continue
18-
const key = trimmed.slice(0, eqIdx).trim()
19-
const value = trimmed.slice(eqIdx + 1).trim()
20-
process.env[key] ??= value
21-
}
22-
}
5+
loadEnv(import.meta.url)
236

247
const isCI = Boolean(process.env.CI)
258

@@ -33,6 +16,8 @@ export default defineConfig({
3316
reporter: isCI ? [['html', {open: 'never'}], ['list']] : [['list']],
3417
timeout: 3 * 60 * 1000, // 3 minutes per test
3518
globalTimeout: 15 * 60 * 1000, // 15 minutes total
19+
// Runs after all tests (pass or fail) — deletes QA-E2E-1st-*/QA-E2E-2nd-* test apps
20+
globalTeardown: './setup/global-teardown.ts',
3621

3722
use: {
3823
trace: isCI ? 'on' : 'off',

0 commit comments

Comments
 (0)