Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: added config file
  • Loading branch information
d4niloArantes committed May 20, 2021
commit f2245c144b9b588e5101d990a83bfdeedd571294
9 changes: 9 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const config = {
baseUrl: process.env.BASE_URL || 'https://playwright.dev',
recordVideos: process.env.PWVIDEO || false,
defaultTimeout: 60 * 1000, // milliseconds
headless: true,
runSlow: 0, // milliseconds
};

export default config;
5 changes: 3 additions & 2 deletions src/support/common-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '../../config';
import { ICustomWorld } from './custom-world';
import { AllPagesObject } from '../pages/all-pages-object';
import { Before, After, BeforeAll, AfterAll, Status, setDefaultTimeout } from '@cucumber/cucumber';
Expand All @@ -20,7 +21,7 @@ declare global {
}
}

setDefaultTimeout(process.env.PWDEBUG ? -1 : 60 * 1000);
setDefaultTimeout(process.env.PWDEBUG ? -1 : config.defaultTimeout);

const browserOptions: LaunchOptions = {
slowMo: 0,
Expand Down Expand Up @@ -57,7 +58,7 @@ Before(async function (this: ICustomWorld, { pickle }: ITestCaseHookParameter) {
// customize the [browser context](https://playwright.dev/docs/next/api/class-browser#browsernewcontextoptions)
this.context = await global.browser.newContext({
acceptDownloads: true,
recordVideo: process.env.PWVIDEO ? { dir: 'screenshots' } : undefined,
recordVideo: config.recordVideos ? { dir: 'screenshots' } : undefined,
});
this.page = await this.context.newPage();
this.pagesObj = new AllPagesObject(this.page, this.context);
Expand Down