use-tools.spec.ts 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { test, expect, type Page } from '@playwright/test';
  2. const openPageItemControl = async(page: Page): Promise<void> => {
  3. const nav = page.getByTestId('grw-contextual-sub-nav');
  4. const button = nav.getByTestId('open-page-item-control-btn');
  5. // Wait for navigation element to be visible and attached
  6. await expect(nav).toBeVisible();
  7. await nav.waitFor({ state: 'visible' });
  8. // Wait for button to be visible, enabled and attached
  9. await expect(button).toBeVisible();
  10. await expect(button).toBeEnabled();
  11. await button.waitFor({ state: 'visible' });
  12. // Add a small delay to ensure the button is fully interactive
  13. await page.waitForTimeout(100);
  14. await button.click();
  15. };
  16. test('PageDeleteModal is shown successfully', async({ page }) => {
  17. await page.goto('/Sandbox');
  18. await openPageItemControl(page);
  19. await page.getByTestId('open-page-delete-modal-btn').click();
  20. await expect(page.getByTestId('page-delete-modal')).toBeVisible();
  21. });
  22. test('PageDuplicateModal is shown successfully', async({ page }) => {
  23. await page.goto('/Sandbox');
  24. await openPageItemControl(page);
  25. await page.getByTestId('open-page-duplicate-modal-btn').click();
  26. await expect(page.getByTestId('page-duplicate-modal')).toBeVisible();
  27. });
  28. test('PageMoveRenameModal is shown successfully', async({ page }) => {
  29. await page.goto('/Sandbox');
  30. await openPageItemControl(page);
  31. await page.getByTestId('rename-page-btn').click();
  32. await expect(page.getByTestId('page-rename-modal')).toBeVisible();
  33. });
  34. // TODO: Uncomment after https://redmine.weseek.co.jp/issues/149786
  35. // test('PresentationModal for "/" is shown successfully', async({ page }) => {
  36. // await page.goto('/');
  37. // await openPageItemControl(page);
  38. // await page.getByTestId('open-presentation-modal-btn').click();
  39. // expect(page.getByTestId('page-presentation-modal')).toBeVisible();
  40. // });
  41. test.describe('Page Accessories Modal', () => {
  42. test.beforeEach(async({ page }) => {
  43. await page.goto('/');
  44. await openPageItemControl(page);
  45. });
  46. test('Page History is shown successfully', async({ page }) => {
  47. await page.getByTestId('open-page-accessories-modal-btn-with-history-tab').click();
  48. await expect(page.getByTestId(('page-history'))).toBeVisible();
  49. });
  50. test('Page Attachment Data is shown successfully', async({ page }) => {
  51. await page.getByTestId('open-page-accessories-modal-btn-with-attachment-data-tab').click();
  52. await expect(page.getByTestId('page-attachment')).toBeVisible();
  53. });
  54. test('Share Link Management is shown successfully', async({ page }) => {
  55. await page.getByTestId('open-page-accessories-modal-btn-with-share-link-management-data-tab').click();
  56. await expect(page.getByTestId('share-link-management')).toBeVisible();
  57. });
  58. });
  59. test('Successfully add new tag', async({ page }) => {
  60. const tag = 'we';
  61. await page.goto('/Sandbox/Bootstrap5');
  62. await page.locator('#edit-tags-btn-wrapper-for-tooltip').click();
  63. await expect(page.locator('#edit-tag-modal')).toBeVisible();
  64. await page.locator('.rbt-input-main').fill(tag);
  65. await expect(page.locator('#tag-typeahead-asynctypeahead-item-0')).toBeVisible();
  66. await page.locator('#tag-typeahead-asynctypeahead-item-0').click();
  67. await page.getByTestId('tag-edit-done-btn').click();
  68. await expect(page.getByTestId('grw-tag-labels')).toContainText(tag);
  69. });