use-tools.spec.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import { expect, type Page, test } 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
  48. .getByTestId('open-page-accessories-modal-btn-with-history-tab')
  49. .click();
  50. await expect(page.getByTestId('page-history')).toBeVisible();
  51. });
  52. test('Page Attachment Data is shown successfully', async ({ page }) => {
  53. await page
  54. .getByTestId('open-page-accessories-modal-btn-with-attachment-data-tab')
  55. .click();
  56. await expect(page.getByTestId('page-attachment')).toBeVisible();
  57. });
  58. test('Share Link Management is shown successfully', async ({ page }) => {
  59. await page
  60. .getByTestId(
  61. 'open-page-accessories-modal-btn-with-share-link-management-data-tab',
  62. )
  63. .click();
  64. await expect(page.getByTestId('share-link-management')).toBeVisible();
  65. });
  66. });
  67. test('Successfully add new tag', async ({ page }) => {
  68. const tag = 'we';
  69. await page.goto('/Sandbox/Bootstrap5');
  70. await page.locator('#edit-tags-btn-wrapper-for-tooltip').click();
  71. await expect(page.locator('#edit-tag-modal')).toBeVisible();
  72. await page.locator('.rbt-input-main').fill(tag);
  73. await expect(
  74. page.locator('#tag-typeahead-asynctypeahead-item-0'),
  75. ).toBeVisible();
  76. await page.locator('#tag-typeahead-asynctypeahead-item-0').click();
  77. await page.getByTestId('tag-edit-done-btn').click();
  78. await expect(page.getByTestId('grw-tag-labels')).toContainText(tag);
  79. });