Closed Bug 1316606 Opened 3 years ago Closed 3 years ago

dom/html/test/forms/test_save_restore_radio_groups.html fails to run twice in the same browser session

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox52 --- fixed
firefox53 --- fixed

People

(Reporter: jmaher, Assigned: jmaher)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

in experimenting with a possible new test verification job, I examined existing tests and realized that many do not run >1 time in the same browser session:
./mach mochitest dom/html/test/forms/test_save_restore_radio_groups.html --repeat 1


we get many errors, this is easy to reproduce locally and on try with some hacking of the mochitest harness.

in this case we have a .sjs file which is static and we load/reload it a few times while a counter is incremented inside of the .sjs file.  Here we can reset the counter and allow this test to run over and over again without harm.
:jet, I asked you for review since I could not determine who else owns this test and you are listed as the bug triage for core::dom&html
You should probably ask Boris for review as he reviewed Mounir's initial work on dom/html/test/forms/test_save_restore_radio_groups.html in bug 350022.
Assignee: nobody → jmaher
Comment on attachment 8809440 [details]
Bug 1316606 - fix test_save_restore_radio_groups.html to be run multiple times in the same browser.

Maybe Mounir has time to do a quick review?
Attachment #8809440 - Flags: review?(bugs) → review?(mounir)
Comment on attachment 8809440 [details]
Bug 1316606 - fix test_save_restore_radio_groups.html to be run multiple times in the same browser.

https://reviewboard.mozilla.org/r/92036/#review92548

::: dom/html/test/forms/save_restore_radio_groups.sjs:46
(Diff revision 1)
>    }
> +
> +  // When we finish the test case we need to reset the counter
> +  if (counter == 3) {
> +    counter = -1;
> +  }

Instead of setting `counter` to `-1`, could you call `setState("counter", "0");` when `counter == 3`?
Attachment #8809440 - Flags: review?(mounir)
updated and tested locally, thanks for the great (and should have been obvious) recommendation to fix this.
Attachment #8809440 - Attachment is obsolete: true
Attachment #8810503 - Flags: review?(mounir)
Comment on attachment 8810503 [details] [diff] [review]
use setState() to reset the test to run multiple times

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

r+ with comment applied. Thanks for fixing this :)

::: dom/html/test/forms/save_restore_radio_groups.sjs
@@ +41,5 @@
>    }
> +
> +  // When we finish the test case we need to reset the counter
> +  if (counter == 3) {
> +    setState("counter", "" + 0);

I think you should be able to set to `"0"` instead of `"" + 0`.
Attachment #8810503 - Flags: review?(mounir) → review+
Pushed by jmaher@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/355aec7f1abe
fix test_save_restore_radio_groups.html to be run multiple times in the same browser. r=mounir
https://hg.mozilla.org/mozilla-central/rev/355aec7f1abe
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.