-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): update samples to showcase all options
- Loading branch information
Showing
6 changed files
with
121 additions
and
48 deletions.
There are no files selected for viewing
47 changes: 27 additions & 20 deletions
47
...testing/samples/v1/javascript/customising-service-parameters/playwright.service.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
const { AzureCliCredential } = require("@azure/identity"); | ||
const { getServiceConfig, ServiceOS } = require("@azure/microsoft-playwright-testing"); | ||
const { getServiceConfig, ServiceOS, ServiceAuth } = require("@azure/microsoft-playwright-testing"); | ||
const { defineConfig } = require('@playwright/test'); | ||
const config = require("./playwright.config"); | ||
|
||
export default defineConfig( | ||
config, | ||
getServiceConfig(config, { | ||
os: ServiceOS.WINDOWS, | ||
runId: new Date().toISOString(), | ||
credential: new AzureCliCredential(), | ||
}), | ||
{ | ||
reporter: [ | ||
["list"], | ||
[ | ||
"@azure/microsoft-playwright-testing/reporter", | ||
{ | ||
enableGitHubSummary: false, | ||
}, | ||
], | ||
], | ||
}, | ||
); | ||
const azureCredential = new AzureCliCredential(); | ||
|
||
const serviceAuthType = ServiceAuth.ENTRA_ID; | ||
const os = ServiceOS.LINUX; | ||
|
||
const playwrightServiceAdditionalOptions = { | ||
serviceAuthType: serviceAuthType, // Authentication types supported by Microsoft Playwright Testing | ||
os: os, // Operating system types supported by Microsoft Playwright Testing | ||
runId: new Date().toISOString(), // Run id for the test run | ||
timeout: 30000, // Maximum time in milliseconds to wait for the connection to be established | ||
slowMo: 0, // Slows down Playwright operations by the specified amount of milliseconds | ||
exposeNetwork: "<loopback>", // Exposes network available on the connecting client to the browser being connected to | ||
useCloudHostedBrowsers: true, // Use cloud hosted browsers | ||
credential: azureCredential, // Custom token credential for Entra ID authentication | ||
runName: "JavaScript V1 - Sample Run", // Run name for the test run | ||
}; | ||
|
||
const reporterConfiguration = { | ||
enableGitHubSummary: true, // Enable GitHub Actions annotations to diagnose test failures and deep link to MPT Portal | ||
enableResultPublish: true, // Enable result publishing for the test run. This will upload the test result and artifacts to the MPT Portal | ||
}; | ||
|
||
|
||
export default defineConfig(config, getServiceConfig(config, playwrightServiceAdditionalOptions), { | ||
reporter: [["list"], ["@azure/microsoft-playwright-testing/reporter", reporterConfiguration]], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...g/samples/v1/javascript/set-default-authentication-mechanism/playwright.service.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 34 additions & 20 deletions
54
...testing/samples/v1/typescript/customising-service-parameters/playwright.service.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
import { getServiceConfig, ServiceOS } from "@azure/microsoft-playwright-testing"; | ||
import { | ||
getServiceConfig, | ||
ServiceOS, | ||
PlaywrightServiceAdditionalOptions, | ||
ServiceAuth, | ||
AuthenticationType, | ||
OsType, | ||
MPTReporterConfig, | ||
} from "@azure/microsoft-playwright-testing"; | ||
import { defineConfig } from "@playwright/test"; | ||
import config from "./playwright.config"; | ||
import { AzureCliCredential } from "@azure/identity"; | ||
|
||
export default defineConfig( | ||
config, | ||
getServiceConfig(config, { | ||
os: ServiceOS.WINDOWS, | ||
runId: new Date().toISOString(), | ||
credential: new AzureCliCredential(), | ||
}), | ||
{ | ||
reporter: [ | ||
["list"], | ||
[ | ||
"@azure/microsoft-playwright-testing/reporter", | ||
{ | ||
enableGitHubSummary: false, | ||
}, | ||
], | ||
], | ||
}, | ||
); | ||
const azureCredential = new AzureCliCredential(); | ||
|
||
const serviceAuthType: AuthenticationType = ServiceAuth.ENTRA_ID; | ||
const os: OsType = ServiceOS.LINUX; | ||
|
||
const playwrightServiceAdditionalOptions: PlaywrightServiceAdditionalOptions = { | ||
serviceAuthType: serviceAuthType, // Authentication types supported by Microsoft Playwright Testing | ||
os: os, // Operating system types supported by Microsoft Playwright Testing | ||
runId: new Date().toISOString(), // Run id for the test run | ||
timeout: 30000, // Maximum time in milliseconds to wait for the connection to be established | ||
slowMo: 0, // Slows down Playwright operations by the specified amount of milliseconds | ||
exposeNetwork: "<loopback>", // Exposes network available on the connecting client to the browser being connected to | ||
useCloudHostedBrowsers: true, // Use cloud hosted browsers | ||
credential: azureCredential, // Custom token credential for Entra ID authentication | ||
runName: "Typescript V1 - Sample Run", // Run name for the test run | ||
}; | ||
|
||
const reporterConfiguration: MPTReporterConfig = { | ||
enableGitHubSummary: true, // Enable GitHub Actions annotations to diagnose test failures and deep link to MPT Portal | ||
enableResultPublish: true, // Enable result publishing for the test run. This will upload the test result and artifacts to the MPT Portal | ||
}; | ||
|
||
export default defineConfig(config, getServiceConfig(config, playwrightServiceAdditionalOptions), { | ||
reporter: [["list"], ["@azure/microsoft-playwright-testing/reporter", reporterConfiguration]], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...g/samples/v1/typescript/set-default-authentication-mechanism/playwright.service.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters