microsoft / playwright-testing-service

MIT License
88 stars 13 forks source link

[BUG]:"Reporting service url not found" when running playwright testing service. The tests pass, but they show up as ignored in the dashboard. #149

Open perezdev-ish opened 2 days ago

perezdev-ish commented 2 days ago

Describe the bug

"Reporting service url not found" when running playwright testing service. The tests pass, but they show up as ignored in the dashboard.

To Reproduce Steps to reproduce the behavior:

I am adding the test service to an existing project. I set the service URL and access token via pwoershell. I generated a playwright.service.config.ts some time back that looks Like this:

import { defineConfig } from '@playwright/test';
import config from './playwright.config';
import dotenv from 'dotenv';

dotenv.config();

// 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();

// Can be 'linux' or 'windows'.
const os = process.env.PLAYWRIGHT_SERVICE_OS || 'linux';

export default defineConfig(config, {
  workers: 20,

  ignoreSnapshots: false,
  snapshotPathTemplate: `{testDir}/__screenshots__/{testFilePath}/${os}/{arg}{ext}`,

  use: {
    // Specify the service endpoint.
    connectOptions: {
      wsEndpoint: `${process.env.PLAYWRIGHT_SERVICE_URL}?cap=${JSON.stringify({
        // Can be 'linux' or 'windows'.
        os,
        runId: process.env.PLAYWRIGHT_SERVICE_RUN_ID
      })}`,
      timeout: 30000,
      headers: {
        'x-mpt-access-key': process.env.PLAYWRIGHT_SERVICE_ACCESS_TOKEN!
      },
      // Allow service to access the localhost.
      exposeNetwork: '<loopback>'
    }
  },
  // Tenmp workaround for config merge bug in OSS https://github.com/microsoft/playwright/pull/28224
  projects: config.projects? config.projects : [{}]
});
puagarwa commented 2 days ago

HI @perezdev-ish , This seems old config when we didnt had reporting. We have updated our onboarding guidance which uses package and simply onboarding further. please check https://learn.microsoft.com/en-us/azure/playwright-testing/quickstart-run-end-to-end-tests?tabs=playwrightcli&pivots=playwright-test-runner. While, you can still use above config but reporting wont work with it.

PS: we have also added more secure auth mechanism along with existing AccessToken auth. New one leverage EntraId auth and this is default auth when onboarded with package, so if you want to continue using AccessToken, make sure to look at variable serviceAuthType and change its value to ACCESS_TOKEN. However, we strongly suggest using more secure auth type.

Let us know if you need any help.