forked from ZenBrowserMirrors/zen-desktop
test: Added more glance tests, b=(no-bug), c=tests, glance, workspaces
This commit is contained in:
parent
addc318f29
commit
15bd0b2675
5 changed files with 58 additions and 25 deletions
|
@ -80,13 +80,10 @@ add_task(async function test_Glance_New_From_essential() {
|
|||
gZenPinnedTabManager.addToEssentials(selectedTab);
|
||||
await openGlanceOnTab(async (glanceTab) => {
|
||||
await gZenGlanceManager.fullyOpenGlance();
|
||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
|
||||
skipAnimation: true,
|
||||
});
|
||||
Assert.equal(
|
||||
glanceTab,
|
||||
gBrowser.visibleTabs[2],
|
||||
'The glance tab should be the second normal tab (Ignoring empty tabs)'
|
||||
ok(!glanceTab.pinned, 'The glance tab should not be pinned');
|
||||
ok(
|
||||
!glanceTab.parentNode.hasAttribute('container'),
|
||||
'The glance tab should not be in an essentials container'
|
||||
);
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(glanceTab);
|
||||
|
|
|
@ -12,11 +12,7 @@ add_task(async function test_Glance_Next_Tab() {
|
|||
gBrowser.selectedTab = selectedTab;
|
||||
await openGlanceOnTab(async (glanceTab) => {
|
||||
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: 1 });
|
||||
Assert.equal(
|
||||
next,
|
||||
tabToCheck,
|
||||
'The glance tab should be the second normal tab (Ignoring empty tabs)'
|
||||
);
|
||||
Assert.equal(next, tabToCheck, 'Next glance tab should equal');
|
||||
});
|
||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
|
|
@ -3,19 +3,15 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
add_task(async function test_Glance_Next_Tab() {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: 'https://example.com/' }, async (browser) => {
|
||||
const tabToCheck = gBrowser.selectedTab;
|
||||
await openGlanceOnTab(async (glanceTab) => {
|
||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
|
||||
skipAnimation: true,
|
||||
});
|
||||
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: -1 });
|
||||
Assert.equal(
|
||||
next,
|
||||
tabToCheck,
|
||||
'The glance tab should be the second normal tab (Ignoring empty tabs)'
|
||||
);
|
||||
add_task(async function test_Glance_Prev_Tab() {
|
||||
await openGlanceOnTab(async (glanceTab) => {
|
||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
|
||||
skipAnimation: true,
|
||||
});
|
||||
const tabToCheck = gBrowser.selectedTab;
|
||||
gBrowser.selectedTab = glanceTab;
|
||||
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: -1 });
|
||||
Assert.equal(next, tabToCheck, 'Previous glance tab should equal');
|
||||
await BrowserTestUtils.removeTab(tabToCheck);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,3 +6,4 @@ support-files = [
|
|||
["browser_basic_workspaces.js"]
|
||||
["browser_workspace_bookmarks.js"]
|
||||
["browser_double_click_newtab.js"]
|
||||
["browser_overflow_scrollbox.js"]
|
||||
|
|
43
src/zen/tests/workspaces/browser_overflow_scrollbox.js
Normal file
43
src/zen/tests/workspaces/browser_overflow_scrollbox.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
'use strict';
|
||||
|
||||
add_task(async function test_Check_ScrollBox_Overflow() {
|
||||
const scrollbox = gZenWorkspaces.activeScrollbox;
|
||||
scrollbox.smoothScroll = false;
|
||||
const tabsToRemove = [];
|
||||
while (!scrollbox.overflowing) {
|
||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true);
|
||||
tabsToRemove.push(gBrowser.selectedTab);
|
||||
}
|
||||
|
||||
// An extra tab to ensure the scrollbox is overflowing
|
||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true);
|
||||
tabsToRemove.push(gBrowser.selectedTab);
|
||||
|
||||
ok(scrollbox.overflowing, 'The scrollbox should be overflowing after opening enough tabs');
|
||||
|
||||
ok(scrollbox.scrollPosition === 0, 'The scrollbox should be scrolled to the top');
|
||||
|
||||
gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1];
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
Assert.greater(scrollbox.scrollPosition, 0, 'The scrollbox should be scrolled to the bottom');
|
||||
resolve();
|
||||
}, 200);
|
||||
});
|
||||
|
||||
gBrowser.selectedTab = gBrowser.visibleTabs[0];
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
// TODO: Use a real scroll position check instead of a hardcoded value
|
||||
Assert.less(scrollbox.scrollPosition, 60, 'The scrollbox should be scrolled to the top');
|
||||
resolve();
|
||||
}, 200);
|
||||
});
|
||||
|
||||
for (const tab of tabsToRemove) {
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue