general.test.ts 2.7 KB

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