|
| 1 | +// Copyright (c) Jupyter Development Team. |
| 2 | +// Distributed under the terms of the Modified BSD License. |
| 3 | + |
| 4 | +import { galata, describe, test } from '@jupyterlab/galata'; |
| 5 | +import { runMenuOpenTest, runSidebarOpenTest } from './util'; |
| 6 | + |
| 7 | +jest.setTimeout(60000); |
| 8 | + |
| 9 | +describe('General Tests', () => { |
| 10 | + beforeAll(async () => { |
| 11 | + await galata.resetUI(); |
| 12 | + galata.context.capturePrefix = 'general'; |
| 13 | + }); |
| 14 | + |
| 15 | + afterAll(async () => { |
| 16 | + galata.context.capturePrefix = ''; |
| 17 | + }); |
| 18 | + |
| 19 | + test('Launch Screen', async () => { |
| 20 | + const imageName = 'launch'; |
| 21 | + await galata.capture.screenshot(imageName); |
| 22 | + expect(await galata.capture.compareScreenshot(imageName)).toBe('same'); |
| 23 | + }); |
| 24 | + |
| 25 | + runSidebarOpenTest(); |
| 26 | + |
| 27 | + test('Enter Simple Mode', async () => { |
| 28 | + await galata.toggleSimpleMode(true); |
| 29 | + expect(await galata.isInSimpleMode()).toBeTruthy(); |
| 30 | + |
| 31 | + const imageName = 'simple-mode'; |
| 32 | + await galata.capture.screenshot(imageName); |
| 33 | + expect(await galata.capture.compareScreenshot(imageName)).toBe('same'); |
| 34 | + }); |
| 35 | + |
| 36 | + test('Leave Simple Mode', async () => { |
| 37 | + await galata.toggleSimpleMode(false); |
| 38 | + expect(await galata.isInSimpleMode()).toBeFalsy(); |
| 39 | + }); |
| 40 | + |
| 41 | + test('Toggle Dark theme', async () => { |
| 42 | + await galata.theme.setDarkTheme(); |
| 43 | + const imageName = 'dark-theme'; |
| 44 | + await galata.capture.screenshot(imageName); |
| 45 | + expect(await galata.capture.compareScreenshot(imageName)).toBe('same'); |
| 46 | + }); |
| 47 | + |
| 48 | + test('Toggle Light theme', async () => { |
| 49 | + await galata.theme.setLightTheme(); |
| 50 | + }); |
| 51 | + |
| 52 | + test('Move File Browser to right', async () => { |
| 53 | + await galata.sidebar.moveTabToRight('filebrowser'); |
| 54 | + expect(await galata.sidebar.getTabPosition('filebrowser')).toBe('right'); |
| 55 | + }); |
| 56 | + |
| 57 | + test('Open File Browser on right', async () => { |
| 58 | + await galata.sidebar.openTab('filebrowser'); |
| 59 | + expect(await galata.sidebar.isTabOpen('filebrowser')).toBeTruthy(); |
| 60 | + }); |
| 61 | + |
| 62 | + test('Close Sidebar on right', async () => { |
| 63 | + await galata.sidebar.close('right'); |
| 64 | + expect(await galata.sidebar.isOpen('right')).toBeFalsy(); |
| 65 | + }); |
| 66 | + |
| 67 | + test('Open Sidebar on right', async () => { |
| 68 | + await galata.sidebar.open('right'); |
| 69 | + expect(await galata.sidebar.isOpen('right')).toBeTruthy(); |
| 70 | + }); |
| 71 | + |
| 72 | + test('Capture File Browser on right', async () => { |
| 73 | + let imageName = 'filebrowser-right'; |
| 74 | + await galata.capture.screenshot(imageName); |
| 75 | + expect(await galata.capture.compareScreenshot(imageName)).toBe('same'); |
| 76 | + }); |
| 77 | + |
| 78 | + test('Move File Browser to left', async () => { |
| 79 | + await galata.sidebar.moveTabToLeft('filebrowser'); |
| 80 | + expect(await galata.sidebar.getTabPosition('filebrowser')).toBe('left'); |
| 81 | + }); |
| 82 | + |
| 83 | + test('Open File Browser on left', async () => { |
| 84 | + await galata.sidebar.openTab('filebrowser'); |
| 85 | + expect(await galata.sidebar.isTabOpen('filebrowser')).toBeTruthy(); |
| 86 | + }); |
| 87 | + |
| 88 | + runMenuOpenTest(); |
| 89 | +}); |
0 commit comments