Closed Bug 1702371 Opened 3 years ago Closed 3 years ago

Replace BrowserTestUtils.waitForCondition with TestUtils.waitForCondition in browser_aboutDialog_distribution.js

Categories

(Firefox :: General, task, P5)

task

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: prathiksha, Assigned: okoedooc, Mentored)

Details

Attachments

(2 files, 1 obsolete file)

This is a good first bug for newcomers to Firefox development.

BrowserTestUtils.waitForCondition in browser_aboutDialog_distribution.js[0] can be replaced with TestUtils.waitForCondition.

You can run this test with the ./mach test command:
./mach test browser/base/content/test/about/browser_aboutDialog_distribution.js

Feel free to get in touch with me on Matrix if you're stuck.

[0] https://searchfox.org/mozilla-central/rev/a1e81094c7c6dc5e39143caeb39cc46f36980d3e/browser/base/content/test/about/browser_aboutDialog_distribution.js

I will like to take on this task.
Can I know if this should be ran on the mozilla-central or ther mozilla-unified repo on the terminal?

(In reply to Osagie from comment #1)

I will like to take on this task.
Can I know if this should be ran on the mozilla-central or ther mozilla-unified repo on the terminal?

On mozilla-central.

Assignee: nobody → okoedooc
Status: NEW → ASSIGNED

Thank you

I ran the command on my mozilla-central: "'./mach test browser/base/content/test/about/browser_aboutDialog_distribution.js" and this is what I get:

Test configuration changed. Regenerating backend.
No build detected, test metadata may be incomplete.
UNKNOWN TEST: browser/base/content/test/about/browser_aboutDialog_distribution.js
I was unable to find tests from the given argument(s).

You should specify a test directory, filename, test suite name, or
abbreviation.

It's possible my little brain doesn't know about the type of test you are
trying to execute. If you suspect this, please request support by filing
a bug at
https://bugzilla.mozilla.org/enter_bug.cgi?product=Testing&component=General.

(In reply to Osagie from comment #4)

I ran the command on my mozilla-central: "'./mach test browser/base/content/test/about/browser_aboutDialog_distribution.js" and this is what I get:

Test configuration changed. Regenerating backend.
No build detected, test metadata may be incomplete.
UNKNOWN TEST: browser/base/content/test/about/browser_aboutDialog_distribution.js
I was unable to find tests from the given argument(s).

You should specify a test directory, filename, test suite name, or
abbreviation.

It's possible my little brain doesn't know about the type of test you are
trying to execute. If you suspect this, please request support by filing
a bug at
https://bugzilla.mozilla.org/enter_bug.cgi?product=Testing&component=General.

You need to ./mach build at least once before starting on the bug. Please follow the hackmd guide I provided. It explains every step.

After '/mach build, I got this at the end of the operation
............
2:20.61 make[3]: *** [Makefile:126: recurse_artifact] Error 1
2:20.61 make[2]: *** [/home/osagie/mozilla-central/config/recurse.mk:34: artifact] Error 2
2:20.61 make[1]: *** [/home/osagie/mozilla-central/config/rules.mk:355: default] Error 2
2:20.61 make: *** [client.mk:65: build] Error 2
2:20.61 0 compiler warnings present.

Then I ran ./mach test browser/base/content/test/about/browser_aboutDialog_distribution.js,
then I got this report:
Binary expected at /home/osagie/mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/firefox does not exist.

It looks like your program isn't built. You can run |./mach build| to build it.

What could be the problem?

(In reply to Osagie from comment #6)

After '/mach build, I got this at the end of the operation
............
2:20.61 make[3]: *** [Makefile:126: recurse_artifact] Error 1
2:20.61 make[2]: *** [/home/osagie/mozilla-central/config/recurse.mk:34: artifact] Error 2
2:20.61 make[1]: *** [/home/osagie/mozilla-central/config/rules.mk:355: default] Error 2
2:20.61 make: *** [client.mk:65: build] Error 2
2:20.61 0 compiler warnings present.

Then I ran ./mach test browser/base/content/test/about/browser_aboutDialog_distribution.js,
then I got this report:
Binary expected at /home/osagie/mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/firefox does not exist.

It looks like your program isn't built. You can run |./mach build| to build it.

What could be the problem?

Hm not sure, can you ask this question on the #build channel in Matrix? :)

I had a look and saw this error: Error running mach:

['build']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file build| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

Exception: Process executed with non-0 exit code 1: ['/home/osagie/.mozbuild/_virtualenvs/mach/bin/python', '/home/osagie/mozilla-central/configure.py']

File "/home/osagie/mozilla-central/python/mozbuild/mozbuild/build_commands.py", line 151, in build
return driver.build(
File "/home/osagie/mozilla-central/python/mozbuild/mozbuild/controller/building.py", line 1144, in build
config_rc = self.configure(
File "/home/osagie/mozilla-central/python/mozbuild/mozbuild/controller/building.py", line 1529, in configure
status = self._run_command_in_objdir(
File "/home/osagie/mozilla-central/python/mozbuild/mozbuild/base.py", line 897, in _run_command_in_objdir
return self.run_process(cwd=self.topobjdir, **args)
File "/home/osagie/mozilla-central/python/mach/mach/mixin/process.py", line 176, in run_process
raise Exception(

Sentry event ID: 96e67f19fc944e63909d3cba7b980724
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

Hi,
This what I get when I ran:
./mach test browser_aboutDialog_distribution.js
bash: ./mach: No such file or directory

Do I need to run anything else to run this code. I have replaced the text BrowserTestUtils.waitForCondition with TestUtils.waitForCondition in browser_aboutDialog_distribution.js. I created a file called it: browser_aboutDialog_distribution.js in VSC

/* Any copyright is dedicated to the Public Domain.

"use strict";

/* import-globals-from ../../../../../toolkit/mozapps/update/tests/browser/head.js */

Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/toolkit/mozapps/update/tests/browser/head.js",
this
);

add_task(async function verify_distribution_info_hides() {
let defaultBranch = Services.prefs.getDefaultBranch(null);

defaultBranch.setCharPref("distribution.id", "mozilla-test-distribution-id");
defaultBranch.setCharPref("distribution.version", "1.0");

let aboutDialog = await waitForAboutDialog();

await TestUtils.waitForCondition(
() => aboutDialog.document.getElementById("currentChannel").value != "",
"Waiting for init to complete"
);

let distroIdField = aboutDialog.document.getElementById("distributionId");

is(distroIdField.value, "");
isnot(distroIdField.style.display, "block");

let distroField = aboutDialog.document.getElementById("distribution");
isnot(distroField.style.display, "block");

aboutDialog.close();
});

add_task(async function verify_distribution_info_displays() {
let defaultBranch = Services.prefs.getDefaultBranch(null);

defaultBranch.setCharPref("distribution.id", "test-distribution-id");
defaultBranch.setCharPref("distribution.version", "1.0");
defaultBranch.setCharPref("distribution.about", "About Text");

let aboutDialog = await waitForAboutDialog();

await TestUtils.waitForCondition(
() => aboutDialog.document.getElementById("currentChannel").value != "",
"Waiting for init to complete"
);

let distroIdField = aboutDialog.document.getElementById("distributionId");

is(distroIdField.value, "test-distribution-id - 1.0");
is(distroIdField.style.display, "block");

let distroField = aboutDialog.document.getElementById("distribution");
is(distroField.value, "About Text");
is(distroField.style.display, "block");

aboutDialog.close();
});

add_task(async function cleanup() {
let defaultBranch = Services.prefs.getDefaultBranch(null);

// This is the best we can do since we can't remove default prefs
defaultBranch.setCharPref("distribution.id", "");
defaultBranch.setCharPref("distribution.version", "");
defaultBranch.setCharPref("distribution.about", "");
});

I think I got it sorted now

I need another bug please

hg wip returns:
573959:6159d3fc46c6 jgilbert tip central Bug 1697084 - Don't ignore pboOffset for webgl tex uploads. r=lsalzman
~
AND

moz-phab submit is returning:
Failed to find draft commits to submit

No help at this stage

Please review my submission

Attachment #9213387 - Attachment description: Bug 1702371 - Replaced BrowserTestUtils.waitForCondition with TestUtils.waitForCondition r=prathiksha → Bug 1702371 - Replaced BrowserTestUtils.waitForCondition with TestUtils.waitForCondition in browser_aboutDialog_distribution.js r=prathiksha
Attachment #9213759 - Attachment is obsolete: true

Hi Prathiska,
I have made a submission for the bug. Please have a look. Thank you.

Flags: needinfo?(prathikshaprasadsuman)
Pushed by prathikshaprasadsuman@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ee56d253c691
Replaced BrowserTestUtils.waitForCondition with TestUtils.waitForCondition in browser_aboutDialog_distribution.js r=prathiksha
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Flags: needinfo?(prathikshaprasadsuman)
You need to log in before you can comment on or make changes to this bug.