Skip to content
Open
Changes from all commits
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
19 changes: 19 additions & 0 deletions samples/get-started/playwright.service.config.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use PLAYWRIGHT_SERVICE_ACCESS_TOKEN instead of PLAYWRIGHT_SERVICE_ACCESS_KEY

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ import dotenv from 'dotenv';

dotenv.config();

// assert MPT Service variables are defined.
if (!process.env.PLAYWRIGHT_SERVICE_ACCESS_KEY) {
throw new Error('PLAYWRIGHT_SERVICE_ACCESS_KEY is not defined');
}
if (!process.env.PLAYWRIGHT_SERVICE_URL) {
throw new Error('PLAYWRIGHT_SERVICE_URL is not defined');
}
// assert @playwright/test version >= 1.37.0
const playwrightTestVersion = require('@playwright/test/package.json').version;
if (playwrightTestVersion < '1.37.0') {
throw new Error(`@playwright/test version ${playwrightTestVersion} is not supported. Please upgrade to 1.37.0 or higher.`);
}

// Name the test run if it's not named yet.
process.env.PLAYWRIGHT_SERVICE_RUN_ID = process.env.PLAYWRIGHT_SERVICE_RUN_ID || new Date().toISOString();

Expand Down Expand Up @@ -48,3 +61,9 @@ export default defineConfig(config, {
}
}
});

// Assert that the serviceConfig has connectOptions defined.
import serviceConfig from './playwright.service.config';
if (!serviceConfig.use || !serviceConfig.use.connectOptions) {
throw new Error('connectOptions are not defined');
}