forked from graphcommerce-org/graphcommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
58 lines (48 loc) · 1.32 KB
/
playwright.config.ts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable import/no-relative-packages */
import type { PlaywrightTestConfig } from '@playwright/test'
import { devices } from '@playwright/test'
import nextConfig from './examples/magento-graphcms/next.config'
// nextConfig.i18n
const baseProjects: PlaywrightTestConfig['projects'] = [
{
name: 'android',
use: { browserName: 'chromium', ...devices['Moto G4'] },
},
{
name: 'iphone',
use: { browserName: 'webkit', ...devices['iPhone 12'] },
},
{
name: 'chrome',
use: { browserName: 'chromium', viewport: { width: 1280, height: 1280 } },
},
]
const locales = nextConfig.i18n?.locales ?? []
const defaultLocale = nextConfig.i18n?.defaultLocale
const projects = [...baseProjects]
if (locales.length > 0) {
locales.forEach((locale) => {
if (defaultLocale === locale) return
baseProjects.forEach((proj) => {
const name = `${proj.name}-${locale}`
projects.push({
name,
use: {
...proj.use,
locale,
baseURL: `http://localhost:3000/${locale}`,
},
})
})
})
}
const config: PlaywrightTestConfig = {
testMatch: ['**/*.playwright.ts'],
projects,
use: {
baseURL: process.env.URL || 'http://localhost:3000',
},
timeout: 2 * 60 * 1000,
}
export default config