Closed aakashgupt closed 8 months ago
Do I need to do something else apart from adding snippet in playwright config?
@aakashgupt , can you provide more details? What error(s) are you encountering? Can you attach any logs that maybe useful for me to work with?
@ryanrosello-og I am able to print the webhook url thought github masks it as it is a secret. The error I get is "❌ Neither slack webhook url, slackOAuthToken nor process.env.SLACK_BOT_USER_OAUTH_TOKEN were found"
I was using wrong name of secret, sorry
here is my playwright config: `import type { PlaywrightTestConfig } from '@playwright/test'; import { devices } from '@playwright/test'; // import * as dotenv from 'dotenv'; require('custom-env').env(true) /**
See https://playwright.dev/docs/test-configuration. / const config: PlaywrightTestConfig = { testDir: "./tests", / Maximum time one test can run for. / timeout: 150 1000, expect: { /**
await expect(locator).toHaveText();
/ timeout: 30000, toHaveScreenshot: { maxDiffPixelRatio: 0.05 }, }, // testMatch: ["jiraIntegration.spec.ts"], / Fail the build on CI if you accidentally left test.only in the source code. / forbidOnly: !!process.env.CI, / Two retries for each test on CI / retries: process.env.CI ? 2 : undefined, / Opt out of parallel tests on CI. / workers: process.env.CI ? 4 : undefined, / Reporter to use. See https://playwright.dev/docs/test-reporters / reporter: [ ["list"], [ "./node_modules/playwright-slack-report/dist/src/SlackReporter.js", { slackWebHookUrl: process.env.SLACK_WEBHOOK_pe_client_platform_tests, channels: ["pe-automated-tests"], sendResults: "always", maxNumberOfFailuresToShow: 4, slackLogLevel: "ERROR", showInThread: false, }, ], // ['dot'], // ['allure-playwright'], // ['json', { outputFile: 'test-results.json' }], ["html", { open: "never" }], ["junit", { outputFile: "playwright-report/results.xml" }], ], / Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. / use: { / Maximum time each action such asclick()
can take. Defaults to 0 (no limit). / actionTimeout: 0, // baseURL: process.env.BASE_URL, // baseURL: process.env.STAGING === '1' ? 'https://auth.stg.xxx.com/' : 'https://auth.dev.xxx.com/', / Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: process.env.CI ? "off" : "retain-on-failure", screenshot: "on", headless: true, video: process.env.CI ? "retain-on-failure" : "on", // browserName: "chromium", // channel: "chrome" },/ Configure projects for major browsers / projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"], viewport: { width: 1400, height: 900 }, launchOptions: { // slowMo: 200, }, }, },
{ name: "firefox", use: { ...devices["Desktop Firefox"], viewport: { width: 1300, height: 900 }, }, },
{ name: "webkit", use: { ...devices["Desktop Safari"], viewport: { width: 1300, height: 900 }, }, },
/ Test against mobile viewports. / // { // name: 'Mobile-Chrome', // use: { // ...devices['Pixel 5'], // }, // }, // { // name: 'Mobile Safari', // use: { // ...devices['iPhone 12'], // }, // },
/ Test against branded browsers. / // { // name: 'Microsoft Edge', // use: { // channel: 'msedge', // }, // }, // { // name: 'Google Chrome', // use: { // channel: 'chrome', // }, // }, ],
/ Folder for test artifacts such as screenshots, videos, traces, etc. / // outputDir: 'test-results/',
/ Run your local dev server before starting the tests / // webServer: { // command: 'npm run start', // port: 3000, // }, };
export default config; `
let me know if you need something else