From 08148b1e1911bf8ce8de367e95df966e012ffd8b Mon Sep 17 00:00:00 2001 From: bluecloud <96812901+pitb2022@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:46:37 +0800 Subject: [PATCH 1/4] fix(e2e): fix auth --- tests/helpers/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/helpers/auth.ts b/tests/helpers/auth.ts index dc0a7a01aa..a0c67e8644 100644 --- a/tests/helpers/auth.ts +++ b/tests/helpers/auth.ts @@ -46,7 +46,7 @@ export const login = async ({ } // Login with email & password - await page.getByRole('button', { name: 'Continue with Email' }).click() + await page.getByRole('button', { name: 'Email', exact: true }).click() // Fill the form await page.getByPlaceholder('Email').fill(email) @@ -58,7 +58,7 @@ export const login = async ({ await Promise.all([ waitForAPIResponse({ page, - path: 'data.userLogin.token', + path: 'data.emailLogin.token', }), waitForNavigation ? page.waitForNavigation() : undefined, ]) From 61269c456e74ca5a297302e04f2f113b50535b14 Mon Sep 17 00:00:00 2001 From: bluecloud <96812901+pitb2022@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:00:06 +0800 Subject: [PATCH 2/4] fix(e2e): fix publish button disable error --- tests/helpers/poms/draftDetail.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/helpers/poms/draftDetail.ts b/tests/helpers/poms/draftDetail.ts index c646f40e7c..0032b756df 100644 --- a/tests/helpers/poms/draftDetail.ts +++ b/tests/helpers/poms/draftDetail.ts @@ -3,6 +3,7 @@ import _sample from 'lodash/sample' import _uniq from 'lodash/uniq' import { PATHS, TEST_ID } from '~/common/enums' +import { sleep } from '~/common/utils/time' import { waitForAPIResponse } from '../api' import { @@ -95,8 +96,8 @@ export class DraftDetailPage { }) // editing - this.titleInput = this.page.getByPlaceholder('Enter title') - this.summaryInput = this.page.getByPlaceholder('Enter summary') + this.titleInput = this.page.getByPlaceholder('Enter title ...') + this.summaryInput = this.page.getByPlaceholder('Enter summary…') this.contentInput = this.page.locator('.tiptap') // dialog @@ -164,7 +165,18 @@ export class DraftDetailPage { async fillContent() { const content = generateContent({}) await this.contentInput.fill(content) - return content + + await this.contentInput.press('KeyA') + await sleep(5 * 1000) + + await this.contentInput.press('KeyB') + + await this.contentInput.press('KeyC') + + await this.contentInput.press('KeyD') + await sleep(5 * 1000) + + return content + 'abcd' } async setTags() { From 6dcdd859a6e91e8bbe0b5aadff53d54700f71de4 Mon Sep 17 00:00:00 2001 From: bluecloud <96812901+pitb2022@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:59:13 +0800 Subject: [PATCH 3/4] fix(e2e): add comment --- tests/helpers/poms/draftDetail.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/helpers/poms/draftDetail.ts b/tests/helpers/poms/draftDetail.ts index 0032b756df..03e3175d3c 100644 --- a/tests/helpers/poms/draftDetail.ts +++ b/tests/helpers/poms/draftDetail.ts @@ -166,13 +166,11 @@ export class DraftDetailPage { const content = generateContent({}) await this.contentInput.fill(content) + // Update the content to make the publish button clickable await this.contentInput.press('KeyA') await sleep(5 * 1000) - await this.contentInput.press('KeyB') - await this.contentInput.press('KeyC') - await this.contentInput.press('KeyD') await sleep(5 * 1000) From 5cf0d8a627279438c34ec97388dbe241d21cffc0 Mon Sep 17 00:00:00 2001 From: bluecloud <96812901+pitb2022@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:48:33 +0800 Subject: [PATCH 4/4] fix(e2e): await new article content update --- tests/mutateArticle.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/mutateArticle.spec.ts b/tests/mutateArticle.spec.ts index fd92bfd99e..e7dfec1e7d 100644 --- a/tests/mutateArticle.spec.ts +++ b/tests/mutateArticle.spec.ts @@ -255,6 +255,7 @@ test.describe('Mutate article', () => { // Goto republished article page await draftDetail.dialogViewRepublishedArticle.click() await alicePage.waitForLoadState('networkidle') + await sleep(3 * 1000) const articleContent = await aliceArticleDetail.content.innerText() expect(stripSpaces(articleContent)).toBe(stripSpaces(newContent)) })