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);
|
gZenPinnedTabManager.addToEssentials(selectedTab);
|
||||||
await openGlanceOnTab(async (glanceTab) => {
|
await openGlanceOnTab(async (glanceTab) => {
|
||||||
await gZenGlanceManager.fullyOpenGlance();
|
await gZenGlanceManager.fullyOpenGlance();
|
||||||
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
|
ok(!glanceTab.pinned, 'The glance tab should not be pinned');
|
||||||
skipAnimation: true,
|
ok(
|
||||||
});
|
!glanceTab.parentNode.hasAttribute('container'),
|
||||||
Assert.equal(
|
'The glance tab should not be in an essentials container'
|
||||||
glanceTab,
|
|
||||||
gBrowser.visibleTabs[2],
|
|
||||||
'The glance tab should be the second normal tab (Ignoring empty tabs)'
|
|
||||||
);
|
);
|
||||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||||
BrowserTestUtils.removeTab(glanceTab);
|
BrowserTestUtils.removeTab(glanceTab);
|
||||||
|
|
|
@ -12,11 +12,7 @@ add_task(async function test_Glance_Next_Tab() {
|
||||||
gBrowser.selectedTab = selectedTab;
|
gBrowser.selectedTab = selectedTab;
|
||||||
await openGlanceOnTab(async (glanceTab) => {
|
await openGlanceOnTab(async (glanceTab) => {
|
||||||
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: 1 });
|
const next = gBrowser.tabContainer.findNextTab(glanceTab, { direction: 1 });
|
||||||
Assert.equal(
|
Assert.equal(next, tabToCheck, 'Next glance tab should equal');
|
||||||
next,
|
|
||||||
tabToCheck,
|
|
||||||
'The glance tab should be the second normal tab (Ignoring empty tabs)'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,19 +3,15 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
add_task(async function test_Glance_Next_Tab() {
|
add_task(async function test_Glance_Prev_Tab() {
|
||||||
await BrowserTestUtils.withNewTab({ gBrowser, url: 'https://example.com/' }, async (browser) => {
|
await openGlanceOnTab(async (glanceTab) => {
|
||||||
const tabToCheck = gBrowser.selectedTab;
|
await BrowserTestUtils.openNewForegroundTab(window.gBrowser, 'https://example.com/', true, {
|
||||||
await openGlanceOnTab(async (glanceTab) => {
|
skipAnimation: true,
|
||||||
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)'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
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_basic_workspaces.js"]
|
||||||
["browser_workspace_bookmarks.js"]
|
["browser_workspace_bookmarks.js"]
|
||||||
["browser_double_click_newtab.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