Skip to content

Commit

Permalink
Merge pull request #8935 from weseek/support/148769-replace-tests-wit…
Browse files Browse the repository at this point in the history
…h-playwright

support: Replace tests with Playwright (20-basic-features/20-basic-features--use-tools)
  • Loading branch information
miya authored Jul 4, 2024
2 parents 2d1f98b + 8b14450 commit 23cb7f8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 220 deletions.
86 changes: 86 additions & 0 deletions apps/app/playwright/20-basic-features/use-tools.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { test, expect, type Page } from '@playwright/test';

const openPageItemControl = async(page: Page): Promise<void> => {
await expect(page.getByTestId('grw-contextual-sub-nav')).toBeVisible();
await page.getByTestId('grw-contextual-sub-nav').getByTestId('open-page-item-control-btn').click();
};

test('Page Deletion and PutBack is executed successfully', async({ page }) => {
await page.goto('/Sandbox/Bootstrap5');

// Delete
await openPageItemControl(page);
await page.getByTestId('open-page-delete-modal-btn').click();
await expect(page.getByTestId('page-delete-modal')).toBeVisible();
await page.getByTestId('delete-page-button').click();

// PutBack
await expect(page.getByTestId('trash-page-alert')).toBeVisible();
await page.getByTestId('put-back-button').click();
await expect(page.getByTestId('put-back-page-modal')).toBeVisible();
await page.getByTestId('put-back-execution-button').click();
await expect(page.getByTestId('trash-page-alert')).not.toBeVisible();
});

test('PageDuplicateModal is shown successfully', async({ page }) => {
await page.goto('/Sandbox');

await openPageItemControl(page);
await page.getByTestId('open-page-duplicate-modal-btn').click();

await expect(page.getByTestId('page-duplicate-modal')).toBeVisible();
});

test('PageMoveRenameModal is shown successfully', async({ page }) => {
await page.goto('/Sandbox');

await openPageItemControl(page);
await page.getByTestId('rename-page-btn').click();

await expect(page.getByTestId('page-rename-modal')).toBeVisible();
});

// TODO: Uncomment after https://redmine.weseek.co.jp/issues/149786
// test('PresentationModal for "/" is shown successfully', async({ page }) => {
// await page.goto('/');

// await openPageItemControl(page);
// await page.getByTestId('open-presentation-modal-btn').click();

// expect(page.getByTestId('page-presentation-modal')).toBeVisible();
// });

test.describe('Page Accessories Modal', () => {
test.beforeEach(async({ page }) => {
await page.goto('/');
await openPageItemControl(page);
});

test('Page History is shown successfully', async({ page }) => {
await page.getByTestId('open-page-accessories-modal-btn-with-history-tab').click();
await expect(page.getByTestId(('page-history'))).toBeVisible();
});

test('Page Attachment Data is shown successfully', async({ page }) => {
await page.getByTestId('open-page-accessories-modal-btn-with-attachment-data-tab').click();
await expect(page.getByTestId('page-attachment')).toBeVisible();
});

test('Share Link Management is shown successfully', async({ page }) => {
await page.getByTestId('open-page-accessories-modal-btn-with-share-link-management-data-tab').click();
await expect(page.getByTestId('share-link-management')).toBeVisible();
});
});

test('Successfully add new tag', async({ page }) => {
const tag = 'we';
await page.goto('/Sandbox/Bootstrap5');

await page.locator('#edit-tags-btn-wrapper-for-tooltip').click();
await expect(page.locator('#edit-tag-modal')).toBeVisible();
await page.locator('.rbt-input-main').fill(tag);
await expect(page.locator('#tag-typeahead-asynctypeahead-item-0')).toBeVisible();
await page.locator('#tag-typeahead-asynctypeahead-item-0').click();
await page.getByTestId('tag-edit-done-btn').click();
await expect(page.getByTestId('grw-tag-labels')).toContainText(tag);
});
2 changes: 1 addition & 1 deletion apps/app/src/client/components/PageTags/TagEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const TagEditModalSubstance: React.FC<TagEditModalSubstanceProps> = (props: TagE
<TagsInput tags={initTags} onTagsUpdated={tags => setTags(tags)} autoFocus />
</ModalBody>
<ModalFooter>
<button type="button" className="btn btn-primary" onClick={handleSubmit}>
<button type="button" data-testid="tag-edit-done-btn" className="btn btn-primary" onClick={handleSubmit}>
{t('tag_edit_modal.done')}
</button>
</ModalFooter>
Expand Down

This file was deleted.

0 comments on commit 23cb7f8

Please sign in to comment.