Merge branch 'alpha' into fix/alpha/admin-e2e

This commit is contained in:
Jacob Fletcher
2024-04-04 13:45:46 -04:00
41 changed files with 358 additions and 1125 deletions

View File

@@ -131,6 +131,7 @@
"node-mocks-http": "^1.14.1",
"nodemon": "3.0.3",
"open": "^10.1.0",
"p-map": "^7.0.2",
"pino": "8.15.0",
"pino-pretty": "10.2.0",
"playwright": "^1.42.1",
@@ -153,7 +154,7 @@
"tempy": "^1.0.1",
"ts-node": "10.9.1",
"tsx": "^4.7.1",
"turbo": "^1.13.0",
"turbo": "^1.13.2",
"typescript": "5.4.2",
"uuid": "^9.0.1",
"yocto-queue": "^1.0.0"

View File

@@ -3,9 +3,15 @@
"version": "1.0.0",
"license": "MIT",
"type": "module",
"homepage": "https://payloadcms.com",
"bin": {
"create-payload-app": "bin/cli.js"
},
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/create-payload-app"
},
"scripts": {
"build": "pnpm pack-template-files && pnpm typecheck && pnpm build:swc",
"typecheck": "tsc",

View File

@@ -1,8 +1,12 @@
{
"name": "@payloadcms/db-mongodb",
"version": "3.0.0-alpha.49",
"description": "The officially supported MongoDB database adapter for Payload - Update 2",
"repository": "https://github.com/payloadcms/payload",
"description": "The officially supported MongoDB database adapter for Payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/db-mongodb"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"type": "module",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/db-postgres",
"version": "3.0.0-alpha.49",
"description": "The officially supported Postgres database adapter for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/db-postgres"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"type": "module",

View File

@@ -3,6 +3,12 @@
"version": "1.1.1",
"description": "Payload styles for ESLint and Prettier",
"license": "MIT",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/eslint-config-payload"
},
"author": {
"email": "info@payloadcms.com",
"name": "Payload",

View File

@@ -3,6 +3,12 @@
"version": "1.0.0",
"description": "Payload plugins for ESLint",
"license": "MIT",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/eslint-plugin-payload"
},
"author": {
"email": "info@payloadcms.com",
"name": "Payload",

View File

@@ -4,6 +4,12 @@
"main": "./src/index.ts",
"types": "./src/index.d.ts",
"type": "module",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/graphql"
},
"scripts": {
"build": "pnpm build:swc && pnpm build:types",
"build:swc": "swc ./src -d ./dist --config-file .swcrc",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/live-preview-react",
"version": "0.2.0",
"description": "The official live preview React SDK for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/live-preview-react"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"author": "Payload CMS, Inc.",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/live-preview",
"version": "0.2.2",
"description": "The official live preview JavaScript SDK for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/live-preview"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"author": "Payload CMS, Inc.",

View File

@@ -4,6 +4,12 @@
"main": "./src/index.js",
"types": "./src/index.js",
"type": "module",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/next"
},
"bin": {
"@payloadcms/next": "./dist/bin/index.js"
},

View File

@@ -1,51 +0,0 @@
module.exports = {
verbose: true,
git: {
commitMessage: 'chore(release): v${version}',
requireCleanWorkingDir: false,
tagMatch: 'v*', // payload is tagged normally, other packages are tagged with a prefix
},
github: {
release: true,
},
npm: {
skipChecks: true,
},
hooks: {
'before:init': ['pnpm install', 'pnpm clean', 'pnpm build'], // Assume tests have already been run
},
plugins: {
'@release-it/conventional-changelog': {
infile: '../../CHANGELOG.md',
preset: {
name: 'conventionalcommits',
types: [
{ type: 'feat', section: 'Features' },
{ type: 'feature', section: 'Features' },
{ type: 'fix', section: 'Bug Fixes' },
{ type: 'docs', section: 'Documentation' },
],
},
writerOpts: {
commitGroupsSort: (a, b) => {
const groupOrder = ['Features', 'Bug Fixes', 'Documentation']
return groupOrder.indexOf(a.title) - groupOrder.indexOf(b.title)
},
// Scoped commits at the end, alphabetical sort
commitsSort: (a, b) => {
if (a.scope || b.scope) {
if (!a.scope) return -1
if (!b.scope) return 1
return a.scope === b.scope
? a.subject.localeCompare(b.subject)
: a.scope.localeCompare(b.scope)
}
// Alphabetical sort
return a.subject.localeCompare(b.subject)
},
},
},
},
}

View File

@@ -35,10 +35,6 @@
"lint": "eslint \"src/**/*.ts\"",
"prepublishOnly": "pnpm clean && pnpm turbo build",
"pretest": "pnpm build",
"release:beta": "release-it pre --preReleaseId=beta --npm.tag=beta --config .release-it.pre.js",
"release:major": "release-it major",
"release:minor": "release-it minor",
"release:patch": "release-it patch",
"translateNewKeys": "ts-node -T ./scripts/translateNewKeys.ts"
},
"dependencies": {
@@ -75,7 +71,6 @@
"devDependencies": {
"@monaco-editor/react": "4.5.1",
"@payloadcms/eslint-config": "workspace:*",
"@release-it/conventional-changelog": "8.0.1",
"@types/asap": "2.0.0",
"@types/body-parser": "1.19.2",
"@types/compression": "1.7.2",
@@ -113,7 +108,6 @@
"object.assign": "4.1.4",
"object.entries": "1.1.6",
"passport-strategy": "1.0.0",
"release-it": "17.1.1",
"rimraf": "3.0.2",
"serve-static": "1.15.0",
"sharp": "0.32.6",
@@ -185,7 +179,8 @@
],
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git"
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/payload"
},
"bugs": {
"url": "https://github.com/payloadcms/payload"

View File

@@ -6,6 +6,12 @@
"types": "./src/index.ts",
"type": "module",
"license": "MIT",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-cloud-storage"
},
"scripts": {
"build": "pnpm build:swc && pnpm build:types && tsx ../../scripts/exportPointerFiles.ts ../packages/plugin-cloud-storage dist/exports",
"build:swc": "swc ./src -d ./dist --config-file .swcrc",

View File

@@ -6,6 +6,12 @@
"types": "./src/index.ts",
"license": "MIT",
"type": "module",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-cloud"
},
"scripts": {
"build": "pnpm build:swc && pnpm build:types",
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build",

View File

@@ -3,7 +3,11 @@
"description": "Form builder plugin for Payload CMS",
"version": "1.2.1",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-form-builder.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-form-builder"
},
"main": "./src/index.ts",
"types": "./src/index.ts",
"license": "MIT",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-nested-docs",
"version": "3.0.0-alpha.49",
"description": "The official Nested Docs plugin for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-nested-docs"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"author": "Payload CMS, Inc.",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-redirects",
"version": "3.0.0-alpha.49",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-redirects.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-redirects"
},
"description": "Redirects plugin for Payload",
"main": "./src/index.ts",
"types": "./src/index.ts",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-search",
"version": "3.0.0-alpha.49",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-search.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-search"
},
"description": "Search plugin for Payload",
"main": "./src/index.ts",
"types": "./src/index.ts",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-sentry",
"version": "0.0.6",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-sentry.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-sentry"
},
"description": "Sentry plugin for Payload",
"main": "./src/index.ts",
"types": "./src/index.ts",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-seo",
"version": "3.0.0-alpha.49",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-seo.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-seo"
},
"description": "SEO plugin for Payload",
"main": "./src/index.tsx",
"types": "./src/index.tsx",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/plugin-stripe",
"version": "0.0.16",
"homepage:": "https://payloadcms.com",
"repository": "git@github.com:payloadcms/plugin-stripe.git",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/plugin-stripe"
},
"description": "Stripe plugin for Payload",
"main": "./src/index.ts",
"types": "./src/index.ts",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/richtext-lexical",
"version": "3.0.0-alpha.49",
"description": "The officially supported Lexical richtext adapter for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/richtext-lexical"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"author": "Payload CMS, Inc.",

View File

@@ -2,7 +2,11 @@
"name": "@payloadcms/richtext-slate",
"version": "3.0.0-alpha.49",
"description": "The officially supported Slate richtext adapter for Payload",
"repository": "https://github.com/payloadcms/payload",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/richtext-slate"
},
"license": "MIT",
"homepage": "https://payloadcms.com",
"author": "Payload CMS, Inc.",

View File

@@ -4,6 +4,12 @@
"main": "./src/exports/index.ts",
"types": "./src/types.ts",
"type": "module",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/translations"
},
"scripts": {
"build:types": "tsc --outDir dist",
"build": "pnpm writeFiles && pnpm build:types",

View File

@@ -2,6 +2,12 @@
"name": "@payloadcms/ui",
"version": "3.0.0-alpha.49",
"type": "module",
"homepage": "https://payloadcms.com",
"repository": {
"type": "git",
"url": "https://github.com/payloadcms/payload.git",
"directory": "packages/ui"
},
"scripts": {
"build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
"build:swc": "swc ./src -d ./dist --config-file .swcrc",

1110
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ import execa from 'execa'
import fse from 'fs-extra'
import minimist from 'minimist'
import { fileURLToPath } from 'node:url'
import pMap from 'p-map'
import path from 'path'
import prompts from 'prompts'
import semver from 'semver'
@@ -25,15 +26,19 @@ const packageWhitelist = [
'db-postgres',
'richtext-slate',
'richtext-lexical',
'create-payload-app',
// Plugins
'plugin-cloud',
'plugin-cloud-storage',
'plugin-form-builder',
'plugin-nested-docs',
'plugin-redirects',
'plugin-search',
// 'plugin-sentry',
'plugin-seo',
// 'plugin-stripe',
// 'plugin-sentry',
]
const filename = fileURLToPath(import.meta.url)
@@ -127,7 +132,7 @@ async function main() {
`${packageDetails.map((p) => ` - ${p.name.padEnd(32)} ${p.version} => ${chalk.green(nextReleaseVersion)}`).join('\n')}\n`,
)
const confirmPublish = await confirm('Are you sure your want to create these versions?')
const confirmPublish = await confirm('Are you sure you want to create these versions?')
if (!confirmPublish) {
abort()
@@ -205,8 +210,9 @@ async function main() {
}
// Publish
const results: { name: string; success: boolean; details?: string }[] = await Promise.all(
packageDetails.map(async (pkg) => {
const results: { name: string; success: boolean; details?: string }[] = await pMap(
packageDetails,
async (pkg) => {
try {
console.log(logPrefix, chalk.bold(`🚀 ${pkg.name} publishing...`))
const cmdArgs = ['publish', '-C', pkg.packagePath, '--no-git-checks', '--tag', tag]
@@ -232,11 +238,11 @@ async function main() {
console.error(chalk.bold.red(`\n\n❌ ${pkg.name} ERROR: ${error.message}\n\n`))
return { name: pkg.name, success: false }
}
}),
},
{ concurrency: 5 },
)
console.log(chalk.bold.green(`\n\nResults:\n\n`))
console.log(results.map(({ name, success }) => ` ${success ? '✅' : '❌'} ${name}`).join('\n'))
console.log(chalk.bold.green(`\n\nResults:\n`))
// New results format
console.log(
@@ -248,7 +254,7 @@ async function main() {
}
return summary
})
.join('\n'),
.join('\n') + '\n',
)
// TODO: Push commit and tag

View File

@@ -4,7 +4,7 @@ import { expect, test } from '@playwright/test'
import * as path from 'path'
import { fileURLToPath } from 'url'
import { initPageConsoleErrorCatch } from '../helpers.js'
import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js'
@@ -22,6 +22,7 @@ test.describe('Admin Panel', () => {
const context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('example test', async () => {

View File

@@ -9,6 +9,7 @@ import type { ReadOnlyCollection, RestrictedVersion } from './payload-types.js'
import {
closeNav,
ensureAutoLoginAndCompilationIsDone,
exactText,
initPageConsoleErrorCatch,
openDocControls,
@@ -59,6 +60,7 @@ describe('access control', () => {
const context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('field without read access should not show', async () => {

View File

@@ -11,6 +11,7 @@ import type { Config } from './payload-types.js'
import {
checkBreadcrumb,
checkPageTitle,
ensureAutoLoginAndCompilationIsDone,
exactText,
initPageConsoleErrorCatch,
openDocControls,
@@ -85,6 +86,8 @@ describe('admin', () => {
serverURL,
snapshotKey: 'adminTests',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
describe('navigation', () => {

View File

@@ -4,7 +4,7 @@ import { expect, test } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
import { initPageConsoleErrorCatch } from '../helpers.js'
import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js'
import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js'
const { beforeAll, describe } = test
@@ -20,6 +20,8 @@ describe('field error states', () => {
const context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('Remove row should remove error states from parent fields', async () => {

View File

@@ -14,9 +14,16 @@ import type {
RelationWithTitle,
} from './payload-types.js'
import { initPageConsoleErrorCatch, openDocControls, saveDocAndAssert } from '../helpers.js'
import {
delayNetwork,
ensureAutoLoginAndCompilationIsDone,
initPageConsoleErrorCatch,
openDocControls,
saveDocAndAssert,
} from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js'
import {
relationFalseFilterOptionSlug,
relationOneSlug,
@@ -123,6 +130,8 @@ describe('fields - relationship', () => {
relationshipWithTitle: relationWithTitle.id,
},
})) as any
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('should create relationship', async () => {

View File

@@ -9,6 +9,7 @@ import { fileURLToPath } from 'url'
import type { RelationshipField, TextField } from './payload-types.js'
import {
ensureAutoLoginAndCompilationIsDone,
exactText,
initPageConsoleErrorCatch,
saveDocAndAssert,
@@ -56,6 +57,8 @@ describe('fields', () => {
}
client = new RESTClient(null, { defaultSlug: 'users', serverURL })
await client.login()
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
describe('text', () => {
let url: AdminUrlUtil

View File

@@ -35,6 +35,30 @@ const networkConditions = {
},
}
/**
* Load admin panel and make sure autologin has passed before running tests
* @param page
* @param serverURL
*/
export async function ensureAutoLoginAndCompilationIsDone({
page,
serverURL,
}: {
page: Page
serverURL: string
}): Promise<void> {
const adminURL = `${serverURL}/admin`
await page.goto(adminURL)
await page.waitForURL(adminURL)
await expect(() => expect(page.url()).not.toContain(`/admin/login`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() => expect(page.url()).not.toContain(`/admin/create-first-user`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
}
export async function delayNetwork({
context,
page,

View File

@@ -4,9 +4,15 @@ import { expect, test } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
import { exactText, initPageConsoleErrorCatch, saveDocAndAssert } from '../helpers.js'
import {
ensureAutoLoginAndCompilationIsDone,
exactText,
initPageConsoleErrorCatch,
saveDocAndAssert,
} from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js'
import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js'
import { mobileBreakpoint } from './shared.js'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
@@ -22,7 +28,7 @@ describe('Live Preview', () => {
await page.goto(url.list)
const linkToDoc = page.locator('tbody tr:first-child .cell-id a').first()
await expect(() => expect(linkToDoc).toBeTruthy()).toPass({ timeout: 45000 })
await expect(() => expect(linkToDoc).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })
const linkDocHref = await linkToDoc.getAttribute('href')
await linkToDoc.click()
@@ -48,6 +54,8 @@ describe('Live Preview', () => {
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('collection — has tab', async () => {
@@ -57,13 +65,15 @@ describe('Live Preview', () => {
hasText: exactText('Live Preview'),
})
await expect(() => expect(livePreviewTab).toBeTruthy()).toPass({ timeout: 45000 })
await expect(() => expect(livePreviewTab).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })
const href = await livePreviewTab.locator('a').first().getAttribute('href')
const docURL = page.url()
const pathname = new URL(docURL).pathname
await expect(() => expect(href).toBe(`${pathname}/preview`)).toPass({ timeout: 45000 })
await expect(() => expect(href).toBe(`${pathname}/preview`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
})
test('collection — has route', async () => {
@@ -71,7 +81,9 @@ describe('Live Preview', () => {
const url = page.url()
await goToCollectionPreview(page)
await expect(() => expect(page.url()).toBe(`${url}/preview`)).toPass({ timeout: 45000 })
await expect(() => expect(page.url()).toBe(`${url}/preview`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
})
test('collection — renders iframe', async () => {
@@ -90,13 +102,13 @@ describe('Live Preview', () => {
// Forces the test to wait for the nextjs route to render before we try editing a field
await expect(() => expect(frame.locator('#page-title')).toBeVisible()).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await field.fill(titleValue)
await expect(() => expect(frame.locator('#page-title')).toHaveText(titleValue)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await saveDocAndAssert(page)
@@ -123,17 +135,21 @@ describe('Live Preview', () => {
hasText: exactText('Live Preview'),
})
await expect(() => expect(livePreviewTab).toBeTruthy()).toPass({ timeout: 45000 })
await expect(() => expect(livePreviewTab).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })
const href = await livePreviewTab.locator('a').first().getAttribute('href')
await expect(() => expect(href).toBe(`${pathname}/preview`)).toPass({ timeout: 45000 })
await expect(() => expect(href).toBe(`${pathname}/preview`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
})
test('global — has route', async () => {
const url = page.url()
await goToGlobalPreview(page, 'header')
await expect(() => expect(page.url()).toBe(`${url}/preview`)).toPass({ timeout: 45000 })
await expect(() => expect(page.url()).toBe(`${url}/preview`)).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
})
test('global — renders iframe', async () => {
@@ -160,7 +176,9 @@ describe('Live Preview', () => {
await goToCollectionPreview(page)
await expect(() => expect(page.url()).toContain('/preview')).toPass({ timeout: 45000 })
await expect(() => expect(page.url()).toContain('/preview')).toPass({
timeout: POLL_TOPASS_TIMEOUT,
})
const iframe = page.locator('iframe')
@@ -172,10 +190,10 @@ describe('Live Preview', () => {
const widthInput = page.locator('.live-preview-toolbar input[name="live-preview-width"]')
await expect(() => expect(widthInput).toBeTruthy()).toPass({ timeout: 45000 })
await expect(() => expect(widthInput).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })
const heightInput = page.locator('.live-preview-toolbar input[name="live-preview-height"]')
await expect(() => expect(heightInput).toBeTruthy()).toPass({ timeout: 45000 })
await expect(() => expect(heightInput).toBeTruthy()).toPass({ timeout: POLL_TOPASS_TIMEOUT })
const widthInputValue = await widthInput.getAttribute('value')
const width = parseInt(widthInputValue)
@@ -186,19 +204,19 @@ describe('Live Preview', () => {
const tolerance = 2
await expect(() => expect(iframeWidthInPx).toBeLessThanOrEqual(width + tolerance)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() => expect(iframeWidthInPx).toBeGreaterThanOrEqual(width - tolerance)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() => expect(iframeHeightInPx).toBeLessThanOrEqual(height + tolerance)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() => expect(iframeHeightInPx).toBeGreaterThanOrEqual(height - tolerance)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
})
@@ -211,7 +229,7 @@ describe('Live Preview', () => {
await goToCollectionPreview(page)
await expect(() => expect(page.url()).toContain('/preview')).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
// Check that the breakpoint select is present
@@ -220,7 +238,7 @@ describe('Live Preview', () => {
)
await expect(() => expect(breakpointSelector).toBeTruthy()).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
// Select the mobile breakpoint
@@ -241,7 +259,7 @@ describe('Live Preview', () => {
const iframe = page.locator('iframe')
await expect(() => expect(iframe).toBeTruthy()).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
const iframeSize = await iframe.boundingBox()
const iframeWidthInPx = iframeSize?.width
@@ -251,49 +269,49 @@ describe('Live Preview', () => {
await expect(() =>
expect(iframeWidthInPx).toBeLessThanOrEqual(mobileBreakpoint.width + tolerance),
).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() =>
expect(iframeWidthInPx).toBeGreaterThanOrEqual(mobileBreakpoint.width - tolerance),
).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() =>
expect(iframeHeightInPx).toBeLessThanOrEqual(mobileBreakpoint.height + tolerance),
).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await expect(() =>
expect(iframeHeightInPx).toBeGreaterThanOrEqual(mobileBreakpoint.height - tolerance),
).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
// Check that the inputs have been updated to reflect the new size
const widthInput = page.locator('.live-preview-toolbar input[name="live-preview-width"]')
await expect(() => expect(widthInput).toBeTruthy()).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
const heightInput = page.locator('.live-preview-toolbar input[name="live-preview-height"]')
await expect(() => expect(heightInput).toBeTruthy()).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
const widthInputValue = await widthInput.getAttribute('value')
const width = parseInt(widthInputValue)
await expect(() => expect(width).toBe(mobileBreakpoint.width)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
const heightInputValue = await heightInput.getAttribute('value')
const height = parseInt(heightInputValue)
await expect(() => expect(height).toBe(mobileBreakpoint.height)).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
})
})

View File

@@ -10,6 +10,7 @@ import type { Config, LocalizedPost } from './payload-types.js'
import {
changeLocale,
ensureAutoLoginAndCompilationIsDone,
initPageConsoleErrorCatch,
openDocControls,
saveDocAndAssert,
@@ -60,6 +61,8 @@ describe('Localization', () => {
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
describe('localized text', () => {

View File

@@ -7,7 +7,7 @@ import { fileURLToPath } from 'url'
import type { PayloadTestSDK } from '../helpers/sdk/index.js'
import type { Config } from './payload-types.js'
import { initPageConsoleErrorCatch } from '../helpers.js'
import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2ENoConfig } from '../helpers/initPayloadE2ENoConfig.js'
import { POLL_TOPASS_TIMEOUT } from '../playwright.config.js'
@@ -33,6 +33,8 @@ test.describe('Form Builder', () => {
const context = await browser.newContext()
page = await context.newPage()
initPageConsoleErrorCatch(page)
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test.describe('Forms collection', () => {

View File

@@ -6,7 +6,7 @@ import { fileURLToPath } from 'url'
import type { Page as PayloadPage } from './payload-types.js'
import { initPageConsoleErrorCatch } from '../helpers.js'
import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
@@ -67,6 +67,8 @@ describe('Nested Docs Plugin', () => {
_status: 'draft',
})
draftChildId = draftChildPage.id
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
describe('Core functionality', () => {

View File

@@ -7,7 +7,7 @@ import { fileURLToPath } from 'url'
import type { Page as PayloadPage } from './payload-types.js'
import { initPageConsoleErrorCatch } from '../helpers.js'
import { ensureAutoLoginAndCompilationIsDone, initPageConsoleErrorCatch } from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
import { mediaSlug } from './shared.js'
@@ -53,6 +53,8 @@ describe('SEO Plugin', () => {
},
})) as unknown as PayloadPage
id = createdPage.id
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
describe('Core functionality', () => {

View File

@@ -8,7 +8,11 @@ import { fileURLToPath } from 'url'
import type { Media } from './payload-types.js'
import { initPageConsoleErrorCatch, saveDocAndAssert } from '../helpers.js'
import {
ensureAutoLoginAndCompilationIsDone,
initPageConsoleErrorCatch,
saveDocAndAssert,
} from '../helpers.js'
import { AdminUrlUtil } from '../helpers/adminUrlUtil.js'
import { initPayloadE2E } from '../helpers/initPayloadE2E.js'
import { RESTClient } from '../helpers/rest.js'
@@ -74,6 +78,8 @@ describe('uploads', () => {
})
audioDoc = findAudio.docs[0] as unknown as Media
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
})
test('should see upload filename in relation list', async () => {

View File

@@ -35,6 +35,7 @@ import type { Config } from './payload-types.js'
import { globalSlug } from '../admin/slugs.js'
import {
changeLocale,
ensureAutoLoginAndCompilationIsDone,
exactText,
findTableCell,
initPageConsoleErrorCatch,
@@ -70,7 +71,7 @@ const waitForAutoSaveToComplete = async (page: Page) => {
page.locator('.autosave:has-text("Last saved less than a minute ago")'),
).toBeVisible()
}).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
}
@@ -78,7 +79,7 @@ const waitForAutoSaveToRunAndComplete = async (page: Page) => {
await expect(async () => {
await expect(page.locator('.autosave:has-text("Saving...")')).toBeVisible()
}).toPass({
timeout: 45000,
timeout: POLL_TOPASS_TIMEOUT,
})
await waitForAutoSaveToComplete(page)
@@ -107,6 +108,8 @@ describe('versions', () => {
serverURL,
snapshotKey: 'versionsTest',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL })
//await clearAndSeedEverything(payload)
})