general.test.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. await expect(galata.theme.getTheme()).resolves.toEqual('JupyterLab Light');
  40. });
  41. test('Move File Browser to right', async () => {
  42. await galata.sidebar.moveTabToRight('filebrowser');
  43. expect(await galata.sidebar.getTabPosition('filebrowser')).toBe('right');
  44. });
  45. test('Open File Browser on right', async () => {
  46. await galata.sidebar.openTab('filebrowser');
  47. expect(await galata.sidebar.isTabOpen('filebrowser')).toBeTruthy();
  48. });
  49. test('Close Sidebar on right', async () => {
  50. await galata.sidebar.close('right');
  51. expect(await galata.sidebar.isOpen('right')).toBeFalsy();
  52. });
  53. test('Open Sidebar on right', async () => {
  54. await galata.sidebar.open('right');
  55. expect(await galata.sidebar.isOpen('right')).toBeTruthy();
  56. });
  57. test('Capture File Browser on right', async () => {
  58. let imageName = 'filebrowser-right';
  59. await galata.capture.screenshot(imageName);
  60. expect(await galata.capture.compareScreenshot(imageName)).toBe('same');
  61. });
  62. test('Move File Browser to left', async () => {
  63. await galata.sidebar.moveTabToLeft('filebrowser');
  64. expect(await galata.sidebar.getTabPosition('filebrowser')).toBe('left');
  65. });
  66. test('Open File Browser on left', async () => {
  67. await galata.sidebar.openTab('filebrowser');
  68. expect(await galata.sidebar.isTabOpen('filebrowser')).toBeTruthy();
  69. });
  70. runMenuOpenTest();
  71. });