Bug 1808195: Try to make accessible/tests/browser/states/browser_test_link.js more reliable. r=eeejay

1. Open the link in a new tab instead of a new window. I originally did this to make debugging easier with a screenshot, but it seems to actually make the test more reliable. I don't know why.
2. Suffix the URL so we can be sure it will not have been visited before the test.

Differential Revision: https://phabricator.services.mozilla.com/D171948
This commit is contained in:
James Teh 2023-03-10 03:46:17 +00:00
Родитель 3f036ec6b7
Коммит 89dc63126c
1 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -11,29 +11,33 @@ async function runTests(browser, accDoc) {
testStates(getAcc("link_traversed"), 0, 0, STATE_TRAVERSED);
let onStateChanged = waitForEvent(EVENT_STATE_CHANGE, "link_traversed");
let newWinOpened = BrowserTestUtils.waitForNewWindow();
let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser);
await BrowserTestUtils.synthesizeMouse(
"#link_traversed",
1,
1,
{ shiftKey: true },
{ ctrlKey: !MAC, metaKey: MAC },
browser
);
await onStateChanged;
testStates(getAcc("link_traversed"), STATE_TRAVERSED);
let newWin = await newWinOpened;
await BrowserTestUtils.closeWindow(newWin);
let newTab = await newTabOpened;
gBrowser.removeTab(newTab);
}
/**
* Test caching of accessible object states
*/
addAccessibleTask(
// The URL doesn't really matter, just the fact that it isn't in the history
// initially. We append ms since epoch to the URL so it will never be visited
// initially, regardless of other tests (even this one) that ran before.
`
<a id="link_traversed" href="http://www.example.com" target="_top">
<a id="link_traversed"
href="https://www.example.com/${Date.now()}" target="_top">
example.com
</a>`,
runTests