Skip to content

Commit

Permalink
Fix 409 conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
n313893254 committed Jun 30, 2022
1 parent 6a49cbc commit 883afb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cypress/pageobjects/image.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
});
}

Expand Down

0 comments on commit 883afb1

Please sign in to comment.