Closed Bug 1523290 Opened 10 months ago Closed 9 months ago

Test for JSTerm menu in Browser Console

Categories

(DevTools :: Console, enhancement, P3)

enhancement

Tracking

(firefox67 fixed)

RESOLVED FIXED
Firefox 67
Tracking Status
firefox67 --- fixed

People

(Reporter: Honza, Assigned: ns19041997, Mentored)

References

Details

(Keywords: good-first-bug)

Attachments

(1 file, 1 obsolete file)

This is a follow up for bug 1521049

We should introduce a test that covers the context menu in Browser Console.

Honza

Depends on: 1521049
Priority: -- → P3
Mentor: nchevobbe
Keywords: good-first-bug

I would like to work on this.
Can it be assigned to me?
Thanks!

(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #0)

This is a follow up for bug 1521049

We should introduce a test that covers the context menu in Browser Console.

Honza

Hello, I am an Outreachy applicant and would like the opportunity to resolve this bug. Can I please be assigned this bug? Thank you.

(In reply to Neha from comment #1)

I would like to work on this.
Can it be assigned to me?
Thanks!

Hello Neha, i'm going to assign the bug to you.

You can read http://docs.firefox-dev.tools/getting-started/ to setup the work environment. Make sure to choose "Artifact builds" when asked to as it's much faster.
Please feel free to ask any question, either here or on Slack.


For this bug, I think we can extend this test devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js

You can run the test with ./mach test devtools/client/webconsole/test/mochitest/browser_console_context_menu_entries.js.

So here, we need to make sure that doing a right-click in the console input, in the Browser Console does show a context menu.

In the test, you can spot these lines:

  menuPopup = await openContextMenu(hud, hud.jsterm.node || hud.jsterm.inputNode);

  expectedContextMenu = [
    "#editmenu-undo (editmenu-undo) [disabled]",
    "#editmenu-cut (editmenu-cut)",
    "#editmenu-copy (editmenu-copy)",
    "#editmenu-paste (editmenu-paste)",
    "#editmenu-delete (editmenu-delete) [disabled]",
    "#editmenu-selectAll (editmenu-select-all) [disabled]",
  ];
  is(getL10NContextMenu(menuPopup).join("\n"), expectedContextMenu.join("\n"),
    "The context menu has the correct edit menu items");

Here we open the context menu (openContextMenu) by clicking on a node (hud.jsterm.node || hud.jsterm.inputNode).
The fix in Bug 1521049 was made to make sure that clicking a parent of those node works fine.

So here, we need to pick the parent to click on, for example jsterm-input-container. We can do that using the closest method of element (https://developer.mozilla.org/en-US/docs/Web/API/Element/closest).
Once we have this parent element, we can get the menuPopup again using openContextMenu with the new node. And then we need to check that the menu popup has everything we expect, which we can copy from what's in the test already (expectedContextMenu is already built, we should check our menuPopup has the correct elements).

I hope everything is clear enough, if not, don't hesitate to ask questions :)

Assignee: nobody → ns19041997
Status: NEW → ASSIGNED

Added Test for JSTerm menu

Attachment #9047450 - Attachment description: Bug 1523290 - Test for JSTerm menu in Browser Console → Bug 1523290 - Test for JSTerm menu in Browser Console; r=nchevobbe
Attachment #9047450 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f362c19c1963
Test for JSTerm menu in Browser Console r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
You need to log in before you can comment on or make changes to this bug.