From 883afb187122e9b5c3638b89a9e0d606a4abfbeb Mon Sep 17 00:00:00 2001 From: n313893254 Date: Thu, 30 Jun 2022 18:11:16 +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..22618ab59 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: depth + 1}) + } else { + expect(res.response?.statusCode, `Check save success`).to.equal( edit ? 200 : 201 ); + } }); }