Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with audio in macOS 14 on GitHub Actions #30410

Merged
merged 2 commits into from
Apr 18, 2024
Merged

Fix issues with audio in macOS 14 on GitHub Actions #30410

merged 2 commits into from
Apr 18, 2024

Conversation

stephenwade
Copy link
Contributor

@stephenwade stephenwade commented Apr 18, 2024

While investigating a similar issue in my own repository, I noticed that some tests that play audio are failing on macos-14 (e.g. https://github.com/microsoft/playwright/actions/runs/8727564874/job/23945367541). This happens because a microphone permission dialog appears whenever sound is first played.

This PR adds the microphone permission for all apps to the TCC database, preventing the issue from happening.

More info: actions/runner-images#9330

In particular it fixes the following tests which were failing on Firefox and Chromium on newer macOS versions.

@mxschmitt mxschmitt added the CQ1 label Apr 18, 2024

This comment has been minimized.

@mxschmitt
Copy link
Member

mxschmitt commented Apr 18, 2024

Impressive investigation! I tried my luck before in debugging this but was not able to.

Was there a trick you had to see the GUI of the macOS runner?

Copy link
Contributor

Test results for "tests 2"

1 fatal errors, not part of any test
7 failed
❌ [firefox-library] › library/headful.spec.ts:231:3 › should click in OOPIF
❌ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:340:7 › cli codegen › should record open in a new tab with url
❌ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:340:7 › cli codegen › should record open in a new tab with url
❌ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:340:7 › cli codegen › should record open in a new tab with url
❌ [webkit-library] › library/capabilities.spec.ts:67:3 › should play video @smoke
❌ [webkit-library] › library/capabilities.spec.ts:99:3 › should play audio @smoke
❌ [webkit-library] › library/signals.spec.ts:62:7 › signals › should report browser close signal 2

64 flaky ⚠️ [chromium-library] › library/inspector/cli-codegen-1.spec.ts:22:7 › cli codegen › should click
⚠️ [chromium-library] › library/browsercontext-credentials.spec.ts:55:1 › should work with correct credentials @smoke
⚠️ [chromium-library] › library/browsercontext-credentials.spec.ts:55:1 › should work with correct credentials @smoke
⚠️ [chromium-library] › library/inspector/cli-codegen-3.spec.ts:383:7 › cli codegen › should generate getByTestId
⚠️ [chromium-page] › page/page-drag.spec.ts💯5 › Drag and drop › should cancel on escape
⚠️ [chromium-page] › page/page-drag.spec.ts:289:5 › Drag and drop › should work with the helper method
⚠️ [chromium-page] › page/page-mouse.spec.ts:193:3 › should trigger hover state with removed window.Node
⚠️ [chromium-library] › library/browsercontext-credentials.spec.ts:55:1 › should work with correct credentials @smoke
⚠️ [chromium-library] › library/browsercontext-viewport.spec.ts:143:12 › should drag with high dpi
⚠️ [chromium-library] › library/inspector/cli-codegen-1.spec.ts:75:7 › cli codegen › should click after same-document navigation
⚠️ [chromium-page] › page/page-drag.spec.ts💯5 › Drag and drop › should cancel on escape
⚠️ [chromium-page] › page/page-drag.spec.ts:246:5 › Drag and drop › should work if the drag event is captured but not canceled
⚠️ [chromium-library] › library/trace-viewer.spec.ts:893:1 › should display waitForLoadState even if did not wait for it
⚠️ [firefox-library] › library/headful.spec.ts:252:3 › should click bottom row w/ infobar in OOPIF
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-page] › page/page-goto.spec.ts:112:3 › should work with Cross-Origin-Opener-Policy after redirect
⚠️ [firefox-page] › page/elementhandle-wait-for-element-state.spec.ts:117:3 › should wait for stable position
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-page] › page/page-click.spec.ts:445:3 › should wait for stable position
⚠️ [firefox-page] › page/page-click.spec.ts:848:3 › should not hang when frame is detached
⚠️ [firefox-library] › library/capabilities.spec.ts:260:3 › requestFullscreen
⚠️ [firefox-library] › library/video.spec.ts:351:5 › screencast › should capture navigation
⚠️ [firefox-page] › page/elementhandle-wait-for-element-state.spec.ts:117:3 › should wait for stable position
⚠️ [firefox-page] › page/page-add-locator-handler.spec.ts:88:5 › should work with locator.hover()
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-page] › page/page-mouse.spec.ts:166:3 › should trigger hover state
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-library] › library/browsercontext-basic.spec.ts:331:3 › should emulate media in cross-process iframe
⚠️ [firefox-library] › library/browsercontext-route.spec.ts:21:3 › should intercept
⚠️ [firefox-library] › library/browsercontext-route.spec.ts:155:3 › should use Set-Cookie header in future requests
⚠️ [firefox-library] › library/capabilities.spec.ts:53:3 › should respect CSP @smoke
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:520:7 › cli codegen › should uncheck
⚠️ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:69:7 › cli codegen › should contain close page
⚠️ [firefox-library] › library/inspector/cli-codegen-2.spec.ts:138:7 › cli codegen › should upload multiple files
⚠️ [firefox-library] › library/tracing.spec.ts:292:5 › should overwrite existing file
⚠️ [firefox-page] › page/elementhandle-wait-for-element-state.spec.ts:117:3 › should wait for stable position
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-page] › page/page-click.spec.ts:99:3 › should click the 1x1 div
⚠️ [firefox-page] › page/page-dispatchevent.spec.ts:33:3 › should dispatch click svg
⚠️ [firefox-page] › page/page-goto.spec.ts:81:3 › should work with Cross-Origin-Opener-Policy
⚠️ [firefox-page] › page/elementhandle-wait-for-element-state.spec.ts:117:3 › should wait for stable position
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [firefox-page] › page/elementhandle-wait-for-element-state.spec.ts:117:3 › should wait for stable position
⚠️ [chromium-library] › library/browsercontext-credentials.spec.ts:55:1 › should work with correct credentials @smoke
⚠️ [chromium-library] › library/browsercontext-viewport.spec.ts:143:12 › should drag with high dpi
⚠️ [chromium-library] › library/inspector/cli-codegen-3.spec.ts:383:7 › cli codegen › should generate getByTestId
⚠️ [chromium-library] › library/inspector/cli-codegen-3.spec.ts:415:7 › cli codegen › should generate getByPlaceholder
⚠️ [chromium-page] › page/page-drag.spec.ts:70:5 › Drag and drop › should work inside iframe
⚠️ [chromium-page] › page/page-drag.spec.ts:246:5 › Drag and drop › should work if the drag event is captured but not canceled
⚠️ [chromium-page] › page/page-mouse.spec.ts:166:3 › should trigger hover state
⚠️ [chromium-library] › library/emulation-focus.spec.ts:190:12 › should trigger hover state concurrently
⚠️ [firefox-page] › page/frame-goto.spec.ts:46:3 › should continue after client redirect
⚠️ [webkit-page] › page/page-goto.spec.ts:277:3 › should fail when navigating to bad SSL after redirects
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:625:7 › cli codegen › should await popup
⚠️ [webkit-library] › library/inspector/cli-codegen-3.spec.ts:531:7 › cli codegen › should consume pointer events
⚠️ [webkit-library] › library/inspector/cli-codegen-1.spec.ts:482:7 › cli codegen › should check a radio button
⚠️ [webkit-library] › library/browsercontext-viewport.spec.ts:143:12 › should drag with high dpi
⚠️ [webkit-library] › library/emulation-focus.spec.ts:190:12 › should trigger hover state concurrently
⚠️ [webkit-library] › library/inspector/cli-codegen-2.spec.ts:276:7 › cli codegen › should handle dialogs
⚠️ [webkit-library] › library/inspector/cli-codegen-3.spec.ts:383:7 › cli codegen › should generate getByTestId
⚠️ [webkit-library] › library/selector-generator.spec.ts:439:5 › selector generator › should generate label selector
⚠️ [webkit-page] › page/page-mouse.spec.ts:186:3 › should trigger hover state on disabled button
⚠️ [webkit-library] › library/tracing.spec.ts:412:14 › should produce screencast frames fit
⚠️ [webkit-library] › library/tracing.spec.ts:412:14 › should produce screencast frames scale
2 interrupted ⚠️ [firefox-page] › page/page-click-scroll.spec.ts:41:3 › should scroll into view display:contents
⚠️ [firefox-page] › page/page-click-timeout-1.spec.ts:20:3 › should avoid side effects after timeout

182756 passed, 8031 skipped, 1288 did not run
✔️✔️✔️

Merge workflow run.

Signed-off-by: Max Schmitt <[email protected]>
Copy link
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-page] › page/page-event-request.spec.ts:110:3 › should report navigation requests and responses handled by service worker
⚠️ [firefox-page] › page/page-click-timeout-4.spec.ts:20:3 › should timeout waiting for stable position
⚠️ [webkit-page] › page/workers.spec.ts:243:3 › should support offline

27365 passed, 671 skipped
✔️✔️✔️

Merge workflow run.

@stephenwade
Copy link
Contributor Author

stephenwade commented Apr 18, 2024

@mxschmitt I found it in the linked issue actions/runner-images#9330. Looks like you can use screencapture to get a screenshot.

Actual behavior

The task hangs in macos-14, and then pops up a microphone permission dialog box.

Repro steps

Add the following in a GitHub Actions yaml:

jobs:
  macos:
    runs-on: ${{ matrix.runner }}

    strategy:
      fail-fast: false
      matrix:
        runner: [macos-latest, macos-13, macos-14]

    steps:
      - name: Play a sound
        timeout-minutes: 3
        run: |
          (sleep 10; screencapture debugscreen_${{ matrix.runner }}.png) &
          afplay /System/Library/Sounds/Funk.aiff
          sleep 20

      - name: Publish debug screenshot
        if: success() || failure()
        uses: actions/upload-artifact@v4
        with:
          name: debugscreen_${{ matrix.runner }}.png
          path: debugscreen_${{ matrix.runner }}.png

afplay is supposed to play a sound file and complete. The screencapture is there to take a screenshot only to debug the issue.

@mxschmitt mxschmitt merged commit fb3bcc8 into microsoft:main Apr 18, 2024
30 checks passed
@stephenwade stephenwade deleted the ci-macos-14 branch April 19, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants