From fbccf45455eeecf76a446f94a9b6d508b0e56b8a Mon Sep 17 00:00:00 2001 From: n313893254 Date: Thu, 30 Jun 2022 17:22:00 +0800 Subject: [PATCH] Fix 409 conflicts --- cypress/pageobjects/image.po.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/pageobjects/image.po.ts b/cypress/pageobjects/image.po.ts index 31d6a7b1c..f4e553fdd 100644 --- a/cypress/pageobjects/image.po.ts +++ b/cypress/pageobjects/image.po.ts @@ -155,11 +155,15 @@ export class ImagePage { // }); // } - public save( { upload, edit }: { upload?: boolean; edit?: boolean } = {} ) { + public save( { upload, edit, depth }: { upload?: boolean; edit?: boolean; depth?: number } = {} ) { cy.intercept(edit? 'PUT' : 'POST', `/v1/harvester/harvesterhci.io.virtualmachineimages${ upload ? '/*' : edit ? '/*/*' : '' }`).as('createImage'); cy.get('.cru-resource-footer').contains(!edit ? 'Create' : 'Save').click(); cy.wait('@createImage').then(res => { - expect(res.response?.statusCode).to.equal( edit ? 200 : 201 ); + if (edit && res.response?.statusCode === 409 && depth === 0) { + this.save(upload, edit, depth + 1) + } else { + expect(res.response?.statusCode, `${depth > 0 && `Retries: ${depth}; `}Check save success`).to.equal( edit ? 200 : 201 ); + } }); }