chore: adds retryWrites, fixes a few flakes

This commit is contained in:
James
2024-04-04 19:14:01 -04:00
parent 014786cc5f
commit 3305c65ae6
2 changed files with 9 additions and 4 deletions

View File

@@ -1917,9 +1917,10 @@ describe('fields', () => {
test('should upload using the document drawer', async () => {
await uploadImage()
await wait(500)
// Open the media drawer and create a png upload
await page.locator('.field-type.upload .upload__toggler.doc-drawer__toggler').click()
await wait(500) // TODO: Fix this. Need to wait a bit until the form in the drawer mounted, otherwise values sometimes disappear. This is an issue for all drawers
await wait(1000) // TODO: Fix this. Need to wait a bit until the form in the drawer mounted, otherwise values sometimes disappear. This is an issue for all drawers
await page
.locator('[id^=doc-drawer_uploads_1_] .file-field__upload input[type="file"]')
.setInputFiles(path.resolve(dirname, './uploads/payload.png'))
@@ -1945,8 +1946,8 @@ describe('fields', () => {
test('should clear selected upload', async () => {
await uploadImage()
await wait(1000) // TODO: Fix this. Need to wait a bit until the form in the drawer mounted, otherwise values sometimes disappear. This is an issue for all drawers
await page.locator('.field-type.upload .upload__toggler.doc-drawer__toggler').click()
await wait(500) // TODO: Fix this. Need to wait a bit until the form in the drawer mounted, otherwise values sometimes disappear. This is an issue for all drawers
await page
.locator('[id^=doc-drawer_uploads_1_] .file-field__upload input[type="file"]')

View File

@@ -12,13 +12,17 @@ export default async () => {
(!process.env.PAYLOAD_DATABASE || process.env.PAYLOAD_DATABASE === 'mongodb') &&
!global._mongoMemoryServer
) {
global._mongoMemoryServer = await MongoMemoryReplSet.create({
const db = await MongoMemoryReplSet.create({
replSet: {
count: 3,
dbName: 'payloadmemory',
},
})
process.env.MONGODB_MEMORY_SERVER_URI = global._mongoMemoryServer.getUri()
global._mongoMemoryServer = db
process.env.MONGODB_MEMORY_SERVER_URI = `${global._mongoMemoryServer.getUri()}&retryWrites=true`
console.log(process.env.MONGODB_MEMORY_SERVER_URI)
}
}