microsoft / playwright-testing-service

MIT License
86 stars 13 forks source link

[BUG]: Including # in PLAYWRIGHT_SERVICE_RUN_ID causes SyntaxError #136

Open aaron-goff opened 1 week ago

aaron-goff commented 1 week ago

Describe the bug When attempting to run tests via Microsoft Playwright Testing, if the PLAYWRIGHT_SERVICE_RUN_ID value contains a #, the tests will fail with a SyntaxError.

 SyntaxError: browserType.connect: The URL contains a fragment identifier
    Call log:
      - <ws connecting> wss:{Playwright Service URL here}

To Reproduce Steps to reproduce the behavior:

  1. Run playwright tests via MPT with a PLAYWRIGHT_SERVICE_RUN_ID value with a # in it PLAYWRIGHT_SERVICE_RUN_ID="my-service#id" npx playwright test {testFiles/Patterns} -c {path-to-service-config} --workers={workerAmt}
  2. Conversely, run the same command WITHOUT a PLAYWRIGHT_SERVICE_RUN_ID value containing a #, and you'll see the tests run. PLAYWRIGHT_SERVICE_RUN_ID="my-service-id" npx playwright test {testFiles/Patterns} -c {path-to-service-config} --workers={workerAmt}

Expected behavior Tests run in MPT without any issues

Screenshots N/A

Setup information (please complete the following information):

Additional context I haven't done extensive testing to see if other reserved characters cause this issue. I encountered it because I was taking the branch name for the PR and using that to form the PLAYWRIGHT_SERVICE_RUN_ID. Some team members include a # in their branch name (annoying but 🤷🏻 ). The team members with branch names like feature/#1234-my-feature would experience this issue. Team members with branch names like feature/4321-my-feature did not experience the issue.

All in all, I'm not totally against restricting things like this if it's a major lift, but it should at least be documented.

vvs11 commented 1 week ago

Thanks for reporting this @aaron-goff We are evaluating this issue and will update with the resolution plan soon.