forked from BrowserWorks/Waterfox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1538632 - Add a test for the deprecation message in WebIDE;r=daisuke
Depends on D26085 Differential Revision: https://phabricator.services.mozilla.com/D26086 --HG-- extra : moz-landing-system : lando
- Loading branch information
1 parent
7abb2d6
commit 43bf250
Showing
4 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
|
||
<head> | ||
<meta charset="utf8"> | ||
<title></title> | ||
|
||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> | ||
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script> | ||
<script type="application/javascript" src="head.js"></script> | ||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<script type="application/javascript"> | ||
window.onload = function() { | ||
SimpleTest.waitForExplicitFinish(); | ||
|
||
async function testWithMessageDisabled() { | ||
info("Open WebIDE with the showDeprecationMessage preference set to FALSE"); | ||
const win = await openWebIDE({ | ||
showDeprecationMessage: false, | ||
}); | ||
|
||
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser"); | ||
await gDevToolsBrowser.isWebIDEInitialized.promise; | ||
ok(true, "WebIDE was initialized"); | ||
|
||
info("Check if the deprecation message is hidden"); | ||
const nbox = win.UI.deprecationBox; | ||
const deprecationMessage = nbox.getNotificationWithValue("webide:deprecationnotification"); | ||
ok(!deprecationMessage, "The deprecation message is hidden"); | ||
|
||
await closeWebIDE(win); | ||
} | ||
|
||
async function testWithMessageEnabled() { | ||
info("Open WebIDE with the showDeprecationMessage preference set to TRUE"); | ||
const win = await openWebIDE({ | ||
showDeprecationMessage: true, | ||
}); | ||
|
||
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser"); | ||
await gDevToolsBrowser.isWebIDEInitialized.promise; | ||
ok(true, "WebIDE was initialized"); | ||
|
||
info("Check if the deprecation message is displayed"); | ||
const nbox = win.UI.deprecationBox; | ||
const deprecationMessage = nbox.getNotificationWithValue("webide:deprecationnotification"); | ||
ok(!!deprecationMessage, "The deprecation message is displayed"); | ||
|
||
info("Check if a button is displayed in the notification box"); | ||
// Note: `notification-button` is a hardcoded className added by the XUL | ||
// notificationbox widget and we cannot set custom classnames. | ||
const button = nbox.stack.querySelector(".notification-button"); | ||
ok(!!button, "The button to open about:debugging is displayed"); | ||
button.click(); | ||
|
||
info("Wait until the about:debugging tab is selected in the main window"); | ||
const mainWindow = Services.wm.getMostRecentWindow("navigator:browser"); | ||
await waitUntil(() => { | ||
const contentWindow = mainWindow.gBrowser.selectedBrowser.contentWindow; | ||
return contentWindow.location.href.startsWith("about:debugging"); | ||
}); | ||
|
||
info("Remove the about:debugging tab"); | ||
await removeTab(mainWindow.gBrowser.selectedTab, mainWindow); | ||
|
||
await closeWebIDE(win); | ||
} | ||
|
||
(async function() { | ||
await testWithMessageDisabled(); | ||
await testWithMessageEnabled(); | ||
|
||
SimpleTest.finish(); | ||
})(); | ||
}; | ||
</script> | ||
</body> | ||
</html> |