chore: use defineConfig (#77)
Co-authored-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Родитель
42dcdc9a16
Коммит
5b924949f3
|
@ -1,11 +1,10 @@
|
|||
// @ts-check
|
||||
const { devices } = require('{{ctPackageName}}');
|
||||
const { defineConfig, devices } = require('{{ctPackageName}}');
|
||||
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
* @type {import('{{ctPackageName}}').PlaywrightTestConfig}
|
||||
*/
|
||||
const config = {
|
||||
module.exports = defineConfig({
|
||||
testDir: './{{testDir}}',
|
||||
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
|
||||
snapshotDir: './__snapshots__',
|
||||
|
@ -34,23 +33,15 @@ const config = {
|
|||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox'],
|
||||
},
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
...devices['Desktop Safari'],
|
||||
},
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import type { PlaywrightTestConfig } from '{{ctPackageName}}';
|
||||
import { devices } from '{{ctPackageName}}';
|
||||
import { defineConfig, devices } from '{{ctPackageName}}';
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
const config: PlaywrightTestConfig = {
|
||||
export default defineConfig({
|
||||
testDir: './{{testDir}}',
|
||||
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
|
||||
snapshotDir: './__snapshots__',
|
||||
|
@ -33,23 +32,15 @@ const config: PlaywrightTestConfig = {
|
|||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox'],
|
||||
},
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
...devices['Desktop Safari'],
|
||||
},
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default config;
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @ts-check
|
||||
const { devices } = require('@playwright/test');
|
||||
const { defineConfig, devices } = require('@playwright/test');
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
|
@ -7,12 +7,10 @@ const { devices } = require('@playwright/test');
|
|||
*/
|
||||
// require('dotenv').config();
|
||||
|
||||
|
||||
/**
|
||||
* @see https://playwright.dev/docs/test-configuration
|
||||
* @type {import('@playwright/test').PlaywrightTestConfig}
|
||||
*/
|
||||
const config = {
|
||||
module.exports = defineConfig({
|
||||
testDir: './{{testDir}}',
|
||||
/* Maximum time one test can run for. */
|
||||
timeout: 30 * 1000,
|
||||
|
@ -49,56 +47,42 @@ const config = {
|
|||
//--begin-chromium
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
//--end-chromium
|
||||
|
||||
//--begin-firefox
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox'],
|
||||
},
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
//--end-firefox
|
||||
|
||||
//--begin-webkit
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
...devices['Desktop Safari'],
|
||||
},
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
//--end-webkit
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: {
|
||||
// ...devices['Pixel 5'],
|
||||
// },
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: {
|
||||
// ...devices['iPhone 12'],
|
||||
// },
|
||||
// use: { ...devices['iPhone 12'] },
|
||||
// },
|
||||
|
||||
/* Test against branded browsers. */
|
||||
// {
|
||||
// name: 'Microsoft Edge',
|
||||
// use: {
|
||||
// channel: 'msedge',
|
||||
// },
|
||||
// use: { channel: 'msedge' },
|
||||
// },
|
||||
// {
|
||||
// name: 'Google Chrome',
|
||||
// use: {
|
||||
// channel: 'chrome',
|
||||
// },
|
||||
// use: { channel: 'chrome' },
|
||||
// },
|
||||
],
|
||||
|
||||
|
@ -110,6 +94,5 @@ const config = {
|
|||
// command: 'npm run start',
|
||||
// port: 3000,
|
||||
// },
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
import { devices } from '@playwright/test';
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
|
@ -10,7 +9,7 @@ import { devices } from '@playwright/test';
|
|||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
const config: PlaywrightTestConfig = {
|
||||
export default defineConfig({
|
||||
testDir: './{{testDir}}',
|
||||
/* Maximum time one test can run for. */
|
||||
timeout: 30 * 1000,
|
||||
|
@ -47,56 +46,42 @@ const config: PlaywrightTestConfig = {
|
|||
//--begin-chromium
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
//--end-chromium
|
||||
|
||||
//--begin-firefox
|
||||
{
|
||||
name: 'firefox',
|
||||
use: {
|
||||
...devices['Desktop Firefox'],
|
||||
},
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
//--end-firefox
|
||||
|
||||
//--begin-webkit
|
||||
{
|
||||
name: 'webkit',
|
||||
use: {
|
||||
...devices['Desktop Safari'],
|
||||
},
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
//--end-webkit
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: {
|
||||
// ...devices['Pixel 5'],
|
||||
// },
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: {
|
||||
// ...devices['iPhone 12'],
|
||||
// },
|
||||
// use: { ...devices['iPhone 12'] },
|
||||
// },
|
||||
|
||||
/* Test against branded browsers. */
|
||||
// {
|
||||
// name: 'Microsoft Edge',
|
||||
// use: {
|
||||
// channel: 'msedge',
|
||||
// },
|
||||
// use: { channel: 'msedge' },
|
||||
// },
|
||||
// {
|
||||
// name: 'Google Chrome',
|
||||
// use: {
|
||||
// channel: 'chrome',
|
||||
// },
|
||||
// use: { channel: 'chrome' },
|
||||
// },
|
||||
],
|
||||
|
||||
|
@ -108,6 +93,4 @@ const config: PlaywrightTestConfig = {
|
|||
// command: 'npm run start',
|
||||
// port: 3000,
|
||||
// },
|
||||
};
|
||||
|
||||
export default config;
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"create-playwright": "index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.27.0",
|
||||
"@playwright/test": "^1.30.0",
|
||||
"@types/node": "^16.11.11",
|
||||
"ansi-colors": "^4.1.1",
|
||||
"enquirer": "^2.3.6",
|
||||
|
@ -24,13 +24,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.0.tgz",
|
||||
"integrity": "sha512-L4BswoJvGkFsEHhEgzVNHBnkFB1FbnBQn3QmvTl7+AouoJQ4a8tLwZKvytdovCsNi7B5cXuRo58yGvfM5PnExw==",
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz",
|
||||
"integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"playwright-core": "1.27.0"
|
||||
"playwright-core": "1.30.0"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
|
@ -422,9 +422,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.0.tgz",
|
||||
"integrity": "sha512-VBKaaFUVKDo3akW+o4DwbK1ZyXh46tcSwQKPK3lruh8IJd5feu55XVZx4vOkbb2uqrNdIF51sgsadYT533SdpA==",
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz",
|
||||
"integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
|
@ -449,13 +449,13 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@playwright/test": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.0.tgz",
|
||||
"integrity": "sha512-L4BswoJvGkFsEHhEgzVNHBnkFB1FbnBQn3QmvTl7+AouoJQ4a8tLwZKvytdovCsNi7B5cXuRo58yGvfM5PnExw==",
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz",
|
||||
"integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*",
|
||||
"playwright-core": "1.27.0"
|
||||
"playwright-core": "1.30.0"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
|
@ -648,9 +648,9 @@
|
|||
"optional": true
|
||||
},
|
||||
"playwright-core": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.0.tgz",
|
||||
"integrity": "sha512-VBKaaFUVKDo3akW+o4DwbK1ZyXh46tcSwQKPK3lruh8IJd5feu55XVZx4vOkbb2uqrNdIF51sgsadYT533SdpA==",
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz",
|
||||
"integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==",
|
||||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"prepublish": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.27.0",
|
||||
"@playwright/test": "^1.30.0",
|
||||
"@types/node": "^16.11.11",
|
||||
"ansi-colors": "^4.1.1",
|
||||
"enquirer": "^2.3.6",
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { PlaywrightTestConfig } from '@playwright/test';
|
||||
import { defineConfig } from '@playwright/test';
|
||||
import type { TestFixtures } from './tests/baseFixtures';
|
||||
|
||||
const config: PlaywrightTestConfig<TestFixtures> = {
|
||||
export default defineConfig<TestFixtures>({
|
||||
timeout: 120 * 1000,
|
||||
testDir: './tests',
|
||||
reporter: 'list',
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
projects: [
|
||||
{
|
||||
name: 'NPM',
|
||||
name: 'npm',
|
||||
use: {
|
||||
packageManager: 'npm'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Yarn',
|
||||
name: 'yarn',
|
||||
use: {
|
||||
packageManager: 'yarn'
|
||||
}
|
||||
|
@ -41,6 +41,4 @@ const config: PlaywrightTestConfig<TestFixtures> = {
|
|||
}
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче