presentation.spec.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { expect, test } from '@playwright/test';
  2. import { appendTextToEditorUntilContains } from '../utils/AppendTextToEditorUntilContains';
  3. test('Presentation', async ({ page }) => {
  4. await page.goto('/');
  5. // show presentation modal
  6. await page
  7. .getByTestId('grw-contextual-sub-nav')
  8. .getByTestId('open-page-item-control-btn')
  9. .click();
  10. await page.getByTestId('open-presentation-modal-btn').click();
  11. // check the content of the h1
  12. await expect(
  13. page.getByRole('application').getByRole('heading', { level: 1 }),
  14. ).toHaveText(/Welcome to GROWI/);
  15. });
  16. test('Slide page (slide: true frontmatter) renders without crashing', async ({
  17. page,
  18. }) => {
  19. await page.goto('/Sandbox/slide-test');
  20. // create slide content
  21. await page.getByTestId('editor-button').click();
  22. await expect(page.getByTestId('grw-editor-navbar-bottom')).toBeVisible();
  23. await appendTextToEditorUntilContains(
  24. page,
  25. '---\nslide: true\n---\n# Slide 1\n---\n# Slide 2',
  26. );
  27. await page.keyboard.press('Control+s');
  28. // verify slide view renders
  29. await page.getByTestId('view-button').click();
  30. await expect(page.locator('.slides')).toBeVisible();
  31. // reload to verify SWR loading path does not crash
  32. await page.reload();
  33. await expect(page.locator('.slides')).toBeVisible();
  34. });