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

#8206: playwright tests for MS Edge sidebar links #8216

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Apr 10, 2024

What does this PR do?

Remaining Work

  • @fregante on main and 1.8.13-alpha.1 build the gear icon isn't doing anything for me in MS Edge. It doesn't change style on hover and isn't responding to clicks when I test manually (but seems like it might be working on CI?, but closing the sidepanel): seems to be fine for me on local builds on MS Edge. Seems like my extension got into a bad state
  • @fregante On MV3 it looks like clicking a link causes the sidebar to be closed on the current tab. So the tests I originally wrote aren't passing. Was that the intended behavior in your PR? 3e1a159#r140843795
  • Fix MV3 tests on Chrome/Edge

Discussion

  • Given that MS Edge has a different sidepanel behavior, we'll need to adjust the test to ensure the sidepanel is open for each step. @fungairino @mnholtz - do we have a best practice for writing browser-specific tests or checks?
  • event.composedPath has different behavior for open/closed Shadow DOM. Is this a problem? I think it would be a source of seeing different results on CI vs. manual testing: cc @grahamlangford @fregante

Potential Improvements

  • Assert that a new page is opened when clicking the links

Future Work

Checklist

  • Add jest or playwright tests and/or storybook stories
  • Designate a primary reviewer: @fungairino

Comment on lines 44 to 46

await sideBarPage.getByRole("link", { name: "Markdown Text Link" }).click();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also assert that the expected page was opened. See: https://playwright.dev/docs/pages#handling-popups

@twschiller twschiller added this to the 1.8.13 milestone Apr 10, 2024
@twschiller twschiller removed their assignment Apr 10, 2024
@twschiller twschiller changed the title #8206: add playwright tests for sidebar links #8206: [WIP] add playwright tests for sidebar links Apr 10, 2024
@twschiller twschiller marked this pull request as draft April 10, 2024 20:52
@twschiller twschiller changed the title #8206: [WIP] add playwright tests for sidebar links #8206: fix link behavior for iframe and add playwright tests for sidebar links Apr 10, 2024
// await expect(mainFrame.getByText("Alpha")).toBeVisible();
//
// const srcdocFrame = mainFrame.frameLocator("iframe").first();
// await srcdocFrame.getByRole("link", { name: "IFrame Link" }).click();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During manual testing in MS Edge on Mac the browser crashes when clicking link in the iframe. (Because our interception logic does not intercept it)

@twschiller twschiller changed the title #8206: fix link behavior for iframe and add playwright tests for sidebar links #8206: fix links in Sidebar for MSEdge iframe and add playwright tests for sidebar links Apr 10, 2024
@twschiller twschiller changed the title #8206: fix links in Sidebar for MSEdge iframe and add playwright tests for sidebar links #8206: fix links in Sidebar for MSEdge and add playwright tests Apr 10, 2024
@twschiller twschiller changed the title #8206: fix links in Sidebar for MSEdge and add playwright tests #8206: [WIP fix links in Sidebar for MSEdge and add playwright tests Apr 10, 2024
@twschiller twschiller changed the title #8206: [WIP fix links in Sidebar for MSEdge and add playwright tests #8206: [WIP[ fix links in Sidebar for MSEdge and add playwright tests Apr 10, 2024
@twschiller twschiller changed the title #8206: [WIP[ fix links in Sidebar for MSEdge and add playwright tests #8206: [WIP] fix links in Sidebar for MSEdge and add playwright tests Apr 10, 2024
@twschiller twschiller removed this from the 1.8.13 milestone Apr 18, 2024
@twschiller twschiller added this to the 1.8.14 milestone Apr 30, 2024
Copy link

codecov bot commented May 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.42%. Comparing base (6d95047) to head (a1b896a).
Report is 38 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8216      +/-   ##
==========================================
- Coverage   73.47%   73.42%   -0.05%     
==========================================
  Files        1334     1352      +18     
  Lines       41259    41523     +264     
  Branches     7686     7778      +92     
==========================================
+ Hits        30316    30490     +174     
- Misses      10943    11033      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented May 9, 2024

Playwright test results - MV2

failed  1 failed
passed  41 passed
flaky  2 flaky
skipped  8 skipped

Details

report  Open report ↗︎
stats  52 tests across 19 suites
duration  11 minutes, 54 seconds
commit  a1b896a

Failed tests

edge › tests/regressions/sidebarLinks.spec.ts › #8206: clicking links doesn't crash browser

Flaky tests

chrome › tests/extensionConsoleActivation.spec.ts › can activate a mod with a database
edge › tests/extensionConsoleActivation.spec.ts › can activate a mod with a database

Skipped tests

chrome › tests/extensionConsoleActivation.spec.ts › can activate a mod with built-in integration
edge › tests/extensionConsoleActivation.spec.ts › can activate a mod with built-in integration
chrome › tests/runtime/sidebarController.spec.ts › sidebar controller › shows focus dialog in top-level frame
edge › tests/runtime/sidebarController.spec.ts › sidebar controller › shows focus dialog in top-level frame
chrome › tests/runtime/sidebarNavigation.spec.ts › sidebar mod panels are persistent during navigation
chrome › tests/runtime/sidebarNavigation.spec.ts › sidebar form and temporary panels are unavailable after navigation
edge › tests/runtime/sidebarNavigation.spec.ts › sidebar mod panels are persistent during navigation
edge › tests/runtime/sidebarNavigation.spec.ts › sidebar form and temporary panels are unavailable after navigation

Copy link

github-actions bot commented May 9, 2024

Playwright test results - MV3

failed  1 failed
passed  49 passed
flaky  2 flaky

Details

report  Open report ↗︎
stats  52 tests across 19 suites
duration  17 minutes, 55 seconds
commit  a1b896a

Failed tests

chrome › tests/regressions/sidebarLinks.spec.ts › #8206: clicking links doesn't crash browser

Flaky tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
edge › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor

@mnholtz
Copy link
Collaborator

mnholtz commented May 9, 2024

do we have a best practice for writing browser-specific tests or checks?

@twschiller You can use test.skip with a conditional, either at the top of the spec file or inside the individual test you want to denote. See an example here:
https://github.com/pixiebrix/pixiebrix-extension/pull/8276/files#diff-c39e8844cde0c8522636aedf8b8076926691d1f804b13ff1035445b45c065fe5R8-R11

In your case you'll want to compare the browser type, e.g. in Playwright's example:

import { test, expect } from '@playwright/test';

test('Safari-only test', async ({ page, browserName }) => {
  test.skip(browserName !== 'webkit', 'This feature is Safari-only');
  // ...
});

@fungairino fungairino marked this pull request as ready for review May 9, 2024 21:54
Comment on lines 106 to 107
aria-label="Open Extension Console"
title="Open Extension Console"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why title and aria-label?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've always been a bit confused as to the accessibility best practices for icon buttons. In a couple of places I've seen recommendations to not use title, or use both title and aria-label. It seems however that we should be able to just use title and getByRole("link", {name: "text"})

https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-get-by-title.md
https://dequeuniversity.com/rules/axe/4.1/button-name

@fungairino fungairino changed the title #8206: [WIP] playwright tests for MS Edge sidebar links #8206: playwright tests for MS Edge sidebar links May 10, 2024
@grahamlangford grahamlangford removed this from the 1.8.14 milestone May 10, 2024
@twschiller twschiller added this to the 2.0.0 milestone May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MS Edge: clicking a link in a sidebar mod crashes MS Edge
5 participants