Skip to content

Instantly share code, notes, and snippets.

@MarcusFelling
Created May 9, 2024 14:11
Show Gist options
  • Save MarcusFelling/66356db19ecb20ff798150ddd91900da to your computer and use it in GitHub Desktop.
Save MarcusFelling/66356db19ecb20ff798150ddd91900da to your computer and use it in GitHub Desktop.
import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';
import { AzureReporterOptions } from '@alex_neo/playwright-azure-reporter/dist/playwright-azure-reporter';
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
testDir: './tests',
/* Maximum time one test can run for. */
timeout: 80 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['list'],
['junit', { outputFile: 'playwright-report-junit/e2e-junit-results.xml' }],
[
'@alex_neo/playwright-azure-reporter',
{
orgUrl: 'https://dev.azure.com/marcusfelling',
token: process.env.ADO_TOKEN,
planId: 442,
projectName: 'Playground',
environment: 'QA',
logging: true,
testRunTitle: 'Playwright Test Run',
publishTestResultsMode: 'testRun',
uploadAttachments: true,
attachmentsType: ['screenshot', 'video', 'trace'],
testRunConfig: {
owner: {
displayName: 'Marcus Felling',
},
comment: 'Playwright Test Run',
// the configuration ids of this test run, use
// https://dev.azure.com/{organization}/{project}/_apis/test/configurations to get the ids of your project.
// if multiple configuration ids are used in one run a testPointMapper should be used to pick the correct one,
// otherwise the results are pushed to all.
configurationIds: [ 12 ],
},
} as AzureReporterOptions,
],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'https://cloudtesting.contosotraders.com/',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on',
video: 'on',
screenshot: 'only-on-failure',
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
}
],
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment