access-to-page.spec.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { expect, test } from '@playwright/test';
  2. import { collapseSidebar } from '../utils';
  3. test('/Sandbox is successfully loaded', async ({ page }) => {
  4. await page.goto('/Sandbox');
  5. // Expect a title "to contain" a substring.
  6. await expect(page).toHaveTitle(/Sandbox/);
  7. });
  8. test('/Sandbox/math is successfully loaded', async ({ page }) => {
  9. await page.goto('/Sandbox/Math');
  10. // Check if the math elements are visible
  11. await expect(page.locator('.katex').first()).toBeVisible();
  12. });
  13. test('Access to /me page', async ({ page }) => {
  14. await page.goto('/me');
  15. // Expect to be redirected to /login when accessing /me
  16. await expect(page.getByTestId('login-form')).toBeVisible();
  17. });
  18. test('Access to /trash page', async ({ page }) => {
  19. await page.goto('/trash');
  20. // Expect the trash page specific elements to be present when accessing /trash
  21. await expect(page.getByTestId('trash-page-list')).toBeVisible();
  22. });
  23. test('Access to /tags page', async ({ page }) => {
  24. await page.goto('/');
  25. await collapseSidebar(page, false);
  26. await page.getByTestId('grw-sidebar-nav-primary-tags').click();
  27. await expect(page.getByTestId('grw-sidebar-content-tags')).toBeVisible();
  28. await expect(page.getByTestId('grw-tags-list').first()).toBeVisible();
  29. await expect(page.getByTestId('grw-tags-list').first()).toContainText(
  30. 'You have no tag, You can set tags on pages',
  31. );
  32. await page.getByTestId('check-all-tags-button').click();
  33. await expect(page.getByTestId('tags-page')).toBeVisible();
  34. });