Skip to content

Commit e9c115c

Browse files
committed
fix cypress error
1 parent 5cf4262 commit e9c115c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

cypress/e2e/tests/verificationRequest.cy.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@ describe("Test verification request", () => {
3333
});
3434
};
3535

36+
const waitForVerificationDetail = () => {
37+
cy.url().should("match", regexVerificationRequestPage);
38+
cy.get(locators.verificationRequest.DETAIL_CONTENT)
39+
.should("be.visible");
40+
};
41+
3642
const goToVerificationRequest = () => {
3743
cy.get(locators.menu.SIDE_MENU).click();
3844
cy.get("[data-cy=testVerificationRequestItem]").click();
3945
cy.url().should("contains", "/verification-request");
4046

4147
cy.get(locators.verificationRequest.DETAIL_CARD_CONTENT).click();
4248
cy.get(locators.verificationRequest.SEE_FULL_BUTTON).invoke("removeAttr", "target").click();
43-
cy.url().should("match", regexVerificationRequestPage);
49+
waitForVerificationDetail();
4450
}
4551

4652
describe("lifecycle verification request", () => {
@@ -60,9 +66,9 @@ describe("Test verification request", () => {
6066
cy.get(locators.verificationRequest.FORM_SOURCE).type(`https://${fullVerificationRequest.source}`);
6167
cy.get(locators.verificationRequest.FORM_EMAIL).type(fullVerificationRequest.email);
6268
saveVerificationRequest();
63-
cy.url().should("match", regexVerificationRequestPage);
69+
waitForVerificationDetail()
6470

65-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
71+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
6672
cy.get(locators.verificationRequest.FORM_SOURCE_ADD).click();
6773
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_1).type(`https://${updatedSource}`);
6874
saveVerificationRequest();
@@ -96,12 +102,9 @@ describe("Test verification request", () => {
96102
cy.get(locators.verificationRequest.FORM_CONTENT).type(minimumContent);
97103
selectPublicationDate(today);
98104
saveVerificationRequest();
99-
cy.url().should("match", regexVerificationRequestPage);
100-
cy.get(locators.verificationRequest.DETAIL_PUBLICATION_DATE)
101-
.should("be.visible")
102-
.and("contain", today.format("DD/MM/YYYY"));
105+
waitForVerificationDetail()
103106

104-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
107+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
105108
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_0).type(`https://${fullVerificationRequest.source}`);
106109
selectPublicationDate(getPastDay(1));
107110
saveVerificationRequest();
@@ -132,7 +135,7 @@ describe("Test verification request", () => {
132135

133136
it("should discard unsaved changes when the edition form is canceled", () => {
134137
goToVerificationRequest()
135-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
138+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
136139
cy.get(locators.verificationRequest.FORM_SOURCE_ADD).click();
137140
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_1).type(`https://${updatedSource}`);
138141
selectPublicationDate(getPastDay(10));

0 commit comments

Comments
 (0)