Make browser-chrome task function arguments an object
Categories
(Remote Protocol :: Agent, enhancement, P3)
Tracking
(firefox74 fixed)
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: ato, Assigned: kstheking0, Mentored)
References
Details
(Whiteboard: [lang=js])
Attachments
(1 file, 3 obsolete files)
Task functions in browser-chrome tests currently take a pre-defined list of arguments:
add_task(async function testName(client, CDP, tab) {
…
});
whimboo suggested in D57078 that an object would be better because it allows the consumer to pick which arguments she needs, and allows us to more easily introduce additional fixtures for the tests.
Reporter | ||
Comment 1•5 years ago
|
||
Depends on bug 1603451 because it introduces documentation that must be updated.
Comment 2•5 years ago
|
||
My proposal would be:
add_task(async function testName({ client, CDP, tab } = {}) {
const { Page, Runtime } = client;
…
});
To make that change the code in https://searchfox.org/mozilla-central/source/remote/test/browser/head.js needs to be updated, so it passes an object into the test method.
Also all browser chrome tests under https://searchfox.org/mozilla-central/source/remote/test/browser/ would have to be fixed to make use of the above proposed code.
I see this as a great mentored bug but not something which should block our beta MVP.
To get started please check our documentation at https://firefox-source-docs.mozilla.org/remote/.
Assignee | ||
Comment 3•5 years ago
|
||
Hello, I'd like to work on this bug. If allowed, as I'm a beginner in contributing to mozilla code base, I will be really grateful for guidance on how do I go about doing this
Comment 4•5 years ago
|
||
You are welcome to work on this bug. As noted in my last comment please read through the docs and ask questions if something is unclear or not listed. All the information you need is basically there.
Assignee | ||
Comment 5•5 years ago
|
||
Hello, Sorry for commenting so late, I was travelling
I tried changing as described above i.e. I changed the add_task function in head.js so that it passes an object {client, CDP, tab} into the test function
and I also changed files such as browser_cdp.js so that it accepts an object
Now after running tests they start failing at tests inside 'emulation' with errors like
TypeError: Emulation is undefined
which is probably because I am not passing anything other than client, CDP and tab in the task function
Can I get an idea of how do I go about solving this and if I am misinterpreting something
Comment 6•5 years ago
|
||
It would help if you could share the code so that I can check which parts you changed. But I believe you didn't destruct Emulation
from client. It should look like:
add_task(async function raisesWithUnknownTargetId({ client, tab }) {
const {Emulation, Target } = client;
[..]
}
Assignee | ||
Comment 7•5 years ago
|
||
hi, I did as above and all the tests have passed
Should I run moz-phab
and submit a patch for code review, I don't know the exact details if something needs to be done first
Also, I am using git cinnabar
for working with gecko, does it make a difference and should I be using hg directly ?
Reporter | ||
Comment 8•5 years ago
|
||
You can use moz-phab or phlay to submit your patches. Make sure the commit message is well-formatted. It doesn’t matter if you use git or hg. I personally use git.
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 10•5 years ago
|
||
I have submitted the patch, please review it
Comment 11•5 years ago
|
||
Note that there is no need for a needinfo. Phabricator automatically informs me when there are reviews. But thanks for uploading it. I or someone else from our team will have a look at it today.
Assignee | ||
Comment 12•5 years ago
|
||
Oh ok I didn't know that, Thanks
Assignee | ||
Comment 13•5 years ago
|
||
Depends on D59082
Assignee | ||
Comment 14•5 years ago
|
||
Depends on D59255
Assignee | ||
Comment 15•5 years ago
|
||
Depends on D59256
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 16•5 years ago
|
||
Note to all: This commit contains a sizable refactoring of browser-chrome tests under remote/test/browser/**/*.js. If you have work-in-progress patches that make changes you may have to rebase your work.
Assignee | ||
Comment 17•5 years ago
|
||
Hello, I have pulled the default branch and fixed the conflicts, rebased the changes into the previous commit and I can update these changes to the patch
however when I run git rebase -i central'
I get error
fatal: Needed a single revision invalid upstream 'central'
Should I still run git rebase ? and if I should then what should I do to fix the error
Comment 18•5 years ago
|
||
Are you using git or hg? I assumed hg. If it's git Andreas would have to help.
Reporter | ||
Comment 20•5 years ago
•
|
||
I suspect you haven’t set up central
to track the upstream git server’s bookmarks/central
branch.
Try maybe the following:
% git rebase -i bookmarks/central
Hopefully your default origin will be the upstream remote, otherwise you need to also append the remote’s name.
You can list your remotes with git remote -v
.
The relevant subset of my .git/config is:
[remote "mozilla"]
url = hg::https://hg.mozilla.org/mozilla-unified
fetch = +refs/heads/bookmarks/*:refs/remotes/mozilla/*
pushurl = ssh://mime.sny.no/git/gecko.git
pushurl = git@github.com:andreastt/gecko.git
[branch "central"]
remote = mozilla
merge = refs/heads/bookmarks/central
rebase = true
Assignee | ||
Comment 21•5 years ago
|
||
I ran git rebase -i origin/bookmarks/central
and after fixing the conflicts I had about 31 commits ahead of me, certainly running moz-phab would create seperate 31 phabricator instances so I ran git rebase again and squashed them all in one commit and updated the patch
But from the looks of the patch I think I have done something wrong , as it says I modified about 197 files
What should I do ?
Assignee | ||
Comment 22•5 years ago
|
||
Should I manually revert those files (the ones which I wasn't supposed to change) by comparing with the central bookmark
Assignee | ||
Comment 23•5 years ago
|
||
I fixed the above mistake, the patch should be fine now
Comment 24•5 years ago
|
||
Reporter | ||
Comment 25•5 years ago
|
||
Thanks again for the patch, Khushal!
Assignee | ||
Comment 26•5 years ago
|
||
Yes, Thank you for your help and patience !
Comment 27•5 years ago
|
||
bugherder |
Description
•