-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathplaywright.setup.js
More file actions
28 lines (26 loc) · 951 Bytes
/
playwright.setup.js
File metadata and controls
28 lines (26 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { chromium } from '@playwright/test'
async function globalSetup(config) {
const { baseURL, storageState } = config.projects[0].use
const browser = await chromium.launch()
const context = await browser.newContext()
const page = await browser.newPage()
try {
await context.tracing.start({ screenshots: true, snapshots: true })
await page.goto(baseURL)
await page.getByLabel('Enter store password').click()
await page.getByLabel('Enter store password').fill(process.env.SHOPIFY_STORE_PASSWORD)
await page.getByLabel('Enter store password').press('Enter')
await page.context().storageState({ path: storageState })
await context.tracing.stop({
path: './test-results/setup-trace.zip'
})
await browser.close()
} catch (error) {
await context.tracing.stop({
path: './test-results/failed-setup-trace.zip'
})
await browser.close()
throw error
}
}
export default globalSetup