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

#8228: run show sidebar in top-level frame #8299

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Apr 19, 2024

What does this PR do?

Remaining Work

  • Add playwright tests
  • Fix playwright test if focus dialog not reliably showing: @fungairino @mnholtz any ideas what would cause the dialog not to show during Playwright? Did I miswrite the test / or are there other gotchas?

Demo

  • @pixies/test/frame-sidebar-actions: see the "Show Sidebar after Wait" action that it shows the user gesture dialog on the top-level tab
  • Use on the frames-builder demo: https://pbx.vercel.app/

Future Work

  • sidePanelUtils and sidebarController contain some duplicate logic that we might want to clean up/clarify in the future. For example, the isSidePanelOpen method

Checklist

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

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 73.50%. Comparing base (0535e01) to head (51b1816).

Files Patch % Lines
src/contentScript/sidebarController.tsx 61.53% 5 Missing ⚠️
src/utils/sidePanelUtils.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8299      +/-   ##
==========================================
- Coverage   73.50%   73.50%   -0.01%     
==========================================
  Files        1330     1330              
  Lines       41108    41113       +5     
  Branches     7637     7636       -1     
==========================================
+ Hits        30218    30220       +2     
- Misses      10890    10893       +3     

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

@twschiller twschiller marked this pull request as draft April 19, 2024 23:18
@twschiller twschiller changed the title #8228: show sidebar in top-level frame #8228: run show sidebar in top-level frame Apr 19, 2024
@twschiller twschiller added bug Something isn't working runtime labels Apr 19, 2024

const HIDE_SIDEBAR_EVENT_NAME = "pixiebrix:hideSidebar";

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved module variables to top of file

Comment on lines 25 to 26
test.describe("sidebar controller", () => {
test("show sidebar uses top-level frame", async ({ page, extensionId }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: on naming tests, where possible I think we should frame the test from the perspective of the user, so in this case, maybe something like "can show sidebar and displays user interaction modal if needed"?

@twschiller twschiller modified the milestones: 1.8.13, 1.8.14 Apr 23, 2024
Comment on lines +65 to +69
// eslint-disable-next-line playwright/no-wait-for-timeout -- match wait in the mod
await page.waitForTimeout(8000);

// Focus dialog should be visible in the top-level frame
await expect(page.getByRole("button", { name: "OK" })).toBeVisible();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think you should be able to get rid of the waitForTimeout by extending the timeout in the toBeVisible call.

Suggested change
// eslint-disable-next-line playwright/no-wait-for-timeout -- match wait in the mod
await page.waitForTimeout(8000);
// Focus dialog should be visible in the top-level frame
await expect(page.getByRole("button", { name: "OK" })).toBeVisible();
// Focus dialog should be visible in the top-level frame
await expect(page.getByRole("button", { name: "OK" })).toBeVisible({timeout: 8000});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, I prefer the waitForTimeout there's an explicit sleep/wait in the mod. So it's matching that wait/sleep brick

Copy link

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@twschiller twschiller merged commit 9d0a15e into main Apr 25, 2024
29 checks passed
@twschiller twschiller deleted the feature/8228-sidebar-top-level branch April 25, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure MV2/MV3 sidebar controller behavior is consistent
4 participants