Closed Bug 1419925 Opened 7 years ago Closed 7 years ago

fix clipboard tests to be more reliable

Categories

(Testing :: Mochitest, enhancement)

enhancement
Not set
normal

Tracking

(firefox59 fixed)

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: jmaher, Assigned: enndeakin)

Details

Attachments

(1 file)

In bug 1394757 there was a lot of work to get clipboard tests running inside a VM.  While this was solved with disabling the VM clipboard manager, there are updates to the tests which we should land for better stability.
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Attachment #8931365 - Flags: review?(jmaher)
Comment on attachment 8931365 [details] [diff] [review]
Promise-based clipboard setting for tests

Review of attachment 8931365 [details] [diff] [review]:
-----------------------------------------------------------------

just a few small nits I found- overall this looks like a healthy cleanup of these tests!

::: browser/components/customizableui/test/browser_947914_button_cut.js
@@ -56,5 @@
>  });
>  
>  registerCleanupFunction(function cleanup() {
>    CustomizableUI.reset();
> -  Services.clipboard.emptyClipboard(globalClipboard);

do we need to empty the clipboard?

::: dom/base/test/test_copypaste.html
@@ +18,5 @@
>  <pre id="test">
>  <script class="testbody" type="text/javascript">
>  
>  SimpleTest.waitForExplicitFinish();
> +SimpleTest.requestCompleteLog();

can we remove the call for complete log?

::: dom/tests/mochitest/general/test_clipboard_events.html
@@ +66,5 @@
>    return SpecialPowers.getClipboardData("text/unicode");
>  }
>  
> +async function putOnClipboard(expected, operationFn, desc, type)
> +{

the other functions in this file have the { on the definition line, not on a new line- we should keep the style the same.

::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +958,5 @@
>                                         aSuccessFn, aFailureFn, aFlavor, aTimeout, aExpectFailure) {
> +    let promise = SimpleTest.promiseClipboardChange(aExpectedStringOrValidatorFn, aSetupFn,
> +                                                    aFlavor, aTimeout, aExpectFailure);
> +    promise.then(function () { info("SUCCESS!\n"); aSuccessFn(); }).
> +            catch(function () { info("FAILED!\n"); aFailureFn(); });

these info() statements could use a bit more context about what is failing or succeeding
Attachment #8931365 - Flags: review?(jmaher) → review+
Pushed by neil@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8972884c1ac7
implement a promise-oriented version of waitForClipboard, promiseClipboardChange, change a selection of tests to use this instead. Simplify some other clipboard tests that were unreliable before the fix for 1394757. r=jmaher
https://hg.mozilla.org/mozilla-central/rev/8972884c1ac7
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: