Shun Miyazawa 1 год назад
Родитель
Сommit
23bb1e944a
1 измененных файлов с 43 добавлено и 0 удалено
  1. 43 0
      apps/app/playwright/20-basic-features/comments.spec.ts

+ 43 - 0
apps/app/playwright/20-basic-features/comments.spec.ts

@@ -0,0 +1,43 @@
+import { test, expect } from '@playwright/test';
+
+
+test('Successfully add comments', async({ page }) => {
+  const commentText = 'add comment';
+  await page.goto('/Sandbox');
+
+  // Add comment
+  await page.getByTestId('page-comment-button').click();
+  await page.getByTestId('open-comment-editor-button').click();
+  await page.locator('.cm-content').fill(commentText);
+  await page.getByTestId('comment-submit-button').first().click();
+
+  await expect(page.locator('.page-comment-body')).toHaveText(commentText);
+  await expect(page.getByTestId('page-comment-button').locator('.grw-count-badge')).toHaveText('1');
+});
+
+test('Successfully reply comments', async({ page }) => {
+  const commentText = 'reply comment';
+  await page.goto('/Sandbox');
+
+  // Reply comment
+  await page.getByTestId('page-comment-button').click();
+  await page.getByTestId('comment-reply-button').click();
+  await page.locator('.cm-content').fill(commentText);
+  await page.getByTestId('comment-submit-button').first().click();
+
+  await expect(page.locator('.page-comment-body').nth(1)).toHaveText(commentText);
+  await expect(page.getByTestId('page-comment-button').locator('.grw-count-badge')).toHaveText('2');
+});
+
+test('Successfully delete comments', async({ page }) => {
+  await page.goto('/Sandbox');
+
+  await page.getByTestId('page-comment-button').click();
+  await page.getByTestId('comment-delete-button').first().click({ force: true });
+  await expect(page.getByTestId('page-comment-delete-modal')).toBeVisible();
+  await page.getByTestId('delete-comment-button').click();
+
+  await expect(page.getByTestId('page-comment-button').locator('.grw-count-badge')).toHaveText('0');
+});
+
+// TODO: https://redmine.weseek.co.jp/issues/139520