Skip to content

Commit

Permalink
Merge pull request #3841 from thematters/fix/review-e2e-error
Browse files Browse the repository at this point in the history
Fix/review e2e error
  • Loading branch information
wlliaml authored Oct 17, 2023
2 parents 5683df3 + 43bc5d5 commit 8550950
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/helpers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
])
Expand Down
16 changes: 13 additions & 3 deletions tests/helpers/poms/draftDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -164,7 +165,16 @@ export class DraftDetailPage {
async fillContent() {
const content = generateContent({})
await this.contentInput.fill(content)
return 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)

return content + 'abcd'
}

async setTags() {
Expand Down
1 change: 1 addition & 0 deletions tests/mutateArticle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Expand Down

1 comment on commit 8550950

@vercel
Copy link

@vercel vercel bot commented on 8550950 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.