ci: fix run e2e command (#10779)

This commit is contained in:
Alessio Gravili
2025-01-23 20:47:49 -07:00
committed by GitHub
parent b9d3250117
commit 344b23139e
12 changed files with 8780 additions and 3100 deletions

View File

@@ -361,6 +361,12 @@ jobs:
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true' if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps chromium run: pnpm exec playwright install-deps chromium
- name: E2E Tests
run: PLAYWRIGHT_JSON_OUTPUT_NAME=results_${{ matrix.suite }}.json pnpm test:e2e:prod:ci ${{ matrix.suite }}
env:
PLAYWRIGHT_JSON_OUTPUT_NAME: results_${{ matrix.suite }}.json
NEXT_TELEMETRY_DISABLED: 1
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:

View File

@@ -122,7 +122,7 @@
"@payloadcms/eslint-config": "workspace:*", "@payloadcms/eslint-config": "workspace:*",
"@payloadcms/eslint-plugin": "workspace:*", "@payloadcms/eslint-plugin": "workspace:*",
"@payloadcms/live-preview-react": "workspace:*", "@payloadcms/live-preview-react": "workspace:*",
"@playwright/test": "1.49.1", "@playwright/test": "1.50.0",
"@sentry/nextjs": "^8.33.1", "@sentry/nextjs": "^8.33.1",
"@sentry/node": "^8.33.1", "@sentry/node": "^8.33.1",
"@swc-node/register": "1.10.9", "@swc-node/register": "1.10.9",
@@ -156,8 +156,8 @@
"next": "15.1.5", "next": "15.1.5",
"open": "^10.1.0", "open": "^10.1.0",
"p-limit": "^5.0.0", "p-limit": "^5.0.0",
"playwright": "1.49.1", "playwright": "1.50.0",
"playwright-core": "1.49.1", "playwright-core": "1.50.0",
"prettier": "3.3.3", "prettier": "3.3.3",
"react": "19.0.0", "react": "19.0.0",
"react-dom": "19.0.0", "react-dom": "19.0.0",

View File

@@ -298,8 +298,8 @@ export const addFieldStatePromise = async (args: AddFieldStatePromiseArgs): Prom
const collapsed = (() => { const collapsed = (() => {
// First, check if `previousFormState` has a matching row // First, check if `previousFormState` has a matching row
const previousRow = previousRows.find((prevRow) => prevRow.id === row.id) const previousRow = previousRows.find((prevRow) => prevRow.id === row.id)
if (previousRow?.collapsed !== undefined) { if (previousRow) {
return previousRow.collapsed return previousRow.collapsed ?? false
} }
// If previousFormState is undefined, check preferences // If previousFormState is undefined, check preferences

11825
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -273,7 +273,7 @@ describe('Relationship Field', () => {
await expect(field).toHaveText(relationOneDoc.id) await expect(field).toHaveText(relationOneDoc.id)
}) })
async function runFilterOptionsTest(fieldName: string) { async function runFilterOptionsTest(fieldName: string, fieldLabel: string) {
await page.reload() await page.reload()
await page.goto(url.edit(docWithExistingRelations.id)) await page.goto(url.edit(docWithExistingRelations.id))
const field = page.locator('#field-relationship') const field = page.locator('#field-relationship')
@@ -293,7 +293,9 @@ describe('Relationship Field', () => {
await expect(field).toContainText(anotherRelationOneDoc.id) await expect(field).toContainText(anotherRelationOneDoc.id)
await wait(2000) // Need to wait form state to come back before clicking save await wait(2000) // Need to wait form state to come back before clicking save
await page.locator('#action-save').click() await page.locator('#action-save').click()
await expect(page.locator('.payload-toast-container')).toContainText(`is invalid: ${fieldName}`) await expect(page.locator('.payload-toast-container')).toContainText(
`is invalid: ${fieldLabel}`,
)
filteredField = page.locator(`#field-${fieldName} .react-select`) filteredField = page.locator(`#field-${fieldName} .react-select`)
await filteredField.click({ delay: 100 }) await filteredField.click({ delay: 100 })
filteredOptions = filteredField.locator('.rs__option') filteredOptions = filteredField.locator('.rs__option')
@@ -305,12 +307,12 @@ describe('Relationship Field', () => {
// TODO: Flaky test. Fix this! (This is an actual issue not just an e2e flake) // TODO: Flaky test. Fix this! (This is an actual issue not just an e2e flake)
test('should allow dynamic filterOptions', async () => { test('should allow dynamic filterOptions', async () => {
await runFilterOptionsTest('relationshipFiltered') await runFilterOptionsTest('relationshipFiltered', 'Relationship Filtered')
}) })
// TODO: Flaky test. Fix this! (This is an actual issue not just an e2e flake) // TODO: Flaky test. Fix this! (This is an actual issue not just an e2e flake)
test('should allow dynamic async filterOptions', async () => { test('should allow dynamic async filterOptions', async () => {
await runFilterOptionsTest('relationshipFilteredAsync') await runFilterOptionsTest('relationshipFilteredAsync', 'Relationship Filtered Async')
}) })
test('should allow usage of relationTo in filterOptions', async () => { test('should allow usage of relationTo in filterOptions', async () => {

View File

@@ -124,7 +124,7 @@ describe('Array', () => {
await page.click('#action-save', { delay: 100 }) await page.click('#action-save', { delay: 100 })
await expect(page.locator('.payload-toast-container')).toContainText( await expect(page.locator('.payload-toast-container')).toContainText(
'The following field is invalid: arrayWithMinRows', 'The following field is invalid: Array With Min Rows',
) )
}) })

View File

@@ -81,7 +81,9 @@ describe('Block fields', () => {
// ensure the block was appended to the rows // ensure the block was appended to the rows
const addedRow = page.locator('#field-blocks .blocks-field__row').last() const addedRow = page.locator('#field-blocks .blocks-field__row').last()
await expect(addedRow).toBeVisible() await expect(addedRow).toBeVisible()
await expect(addedRow.locator('.blocks-field__block-pill-content')).toContainText('Content') await expect(addedRow.locator('.blocks-field__block-header')).toHaveText(
'Custom Block Label: Content 04',
)
}) })
test('should open blocks drawer from block row and add below', async () => { test('should open blocks drawer from block row and add below', async () => {
@@ -108,7 +110,9 @@ describe('Block fields', () => {
// ensure the block was inserted beneath the first in the rows // ensure the block was inserted beneath the first in the rows
const addedRow = page.locator('#field-blocks #blocks-row-1') const addedRow = page.locator('#field-blocks #blocks-row-1')
await expect(addedRow).toBeVisible() await expect(addedRow).toBeVisible()
await expect(addedRow.locator('.blocks-field__block-pill-content')).toContainText('Content') // went from `Number` to `Content` await expect(addedRow.locator('.blocks-field__block-header')).toHaveText(
'Custom Block Label: Content 02',
) // went from `Number` to `Content`
}) })
test('should duplicate block', async () => { test('should duplicate block', async () => {
@@ -257,7 +261,7 @@ describe('Block fields', () => {
await page.click('#action-save', { delay: 100 }) await page.click('#action-save', { delay: 100 })
await expect(page.locator('.payload-toast-container')).toContainText( await expect(page.locator('.payload-toast-container')).toContainText(
'The following field is invalid: blocksWithMinRows', 'The following field is invalid: Blocks With Min Rows',
) )
}) })

View File

@@ -131,7 +131,7 @@ describe('Number', () => {
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
await page.click('#action-save', { delay: 100 }) await page.click('#action-save', { delay: 100 })
await expect(page.locator('.payload-toast-container')).toContainText( await expect(page.locator('.payload-toast-container')).toContainText(
'The following field is invalid: withMinRows', 'The following field is invalid: With Min Rows',
) )
}) })

View File

@@ -565,7 +565,7 @@ describe('relationship', () => {
await page.click('#action-save', { delay: 100 }) await page.click('#action-save', { delay: 100 })
await expect(page.locator('.payload-toast-container')).toContainText( await expect(page.locator('.payload-toast-container')).toContainText(
'The following field is invalid: relationshipWithMinRows', 'The following field is invalid: Relationship With Min Rows',
) )
}) })

View File

@@ -60,7 +60,7 @@ describe('Rich Text', () => {
async function navigateToRichTextFields() { async function navigateToRichTextFields() {
const url: AdminUrlUtil = new AdminUrlUtil(serverURL, 'rich-text-fields') const url: AdminUrlUtil = new AdminUrlUtil(serverURL, 'rich-text-fields')
await page.goto(url.list) await page.goto(url.list)
await page.waitForURL(url.list) await page.waitForURL('**' + url.list + '**')
const linkToDoc = page.locator('.row-1 .cell-title a').first() const linkToDoc = page.locator('.row-1 .cell-title a').first()
await expect(() => expect(linkToDoc).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT }) await expect(() => expect(linkToDoc).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })

View File

@@ -31,7 +31,7 @@ test.describe('Join Field', () => {
let categoriesURL: AdminUrlUtil let categoriesURL: AdminUrlUtil
let uploadsURL: AdminUrlUtil let uploadsURL: AdminUrlUtil
let categoriesJoinRestrictedURL: AdminUrlUtil let categoriesJoinRestrictedURL: AdminUrlUtil
let categoryID let categoryID: string | number
test.beforeAll(async ({ browser }, testInfo) => { test.beforeAll(async ({ browser }, testInfo) => {
testInfo.setTimeout(TEST_TIMEOUT_LONG) testInfo.setTimeout(TEST_TIMEOUT_LONG)
@@ -50,6 +50,10 @@ test.describe('Join Field', () => {
}, },
}) })
if (!docs[0]) {
throw new Error('No category found with the name "example"')
}
;({ id: categoryID } = docs[0]) ;({ id: categoryID } = docs[0])
const context = await browser.newContext() const context = await browser.newContext()
@@ -87,6 +91,9 @@ test.describe('Join Field', () => {
limit: 1, limit: 1,
}) })
const category = result.docs[0] const category = result.docs[0]
if (!category) {
throw new Error('No category found')
}
// seed additional posts to test defaultLimit (5) // seed additional posts to test defaultLimit (5)
await payload.create({ await payload.create({
collection: postsSlug, collection: postsSlug,

View File

@@ -66,7 +66,7 @@
"create-payload-app": "workspace:*", "create-payload-app": "workspace:*",
"dotenv": "16.4.7", "dotenv": "16.4.7",
"drizzle-kit": "0.28.0", "drizzle-kit": "0.28.0",
"eslint-plugin-playwright": "2.1.0", "eslint-plugin-playwright": "2.2.0",
"execa": "5.1.1", "execa": "5.1.1",
"file-type": "19.3.0", "file-type": "19.3.0",
"http-status": "2.1.0", "http-status": "2.1.0",