Skip to content

Commit f986bf3

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

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

cypress/e2e/tests/verificationRequest.cy.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@ 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();
48+
cy.intercept("GET", "**/verification-request/**").as("getVerification");
4249
cy.get(locators.verificationRequest.SEE_FULL_BUTTON).invoke("removeAttr", "target").click();
43-
cy.url().should("match", regexVerificationRequestPage);
50+
cy.wait("@getVerification");
51+
waitForVerificationDetail();
4452
}
4553

4654
describe("lifecycle verification request", () => {
@@ -59,10 +67,12 @@ describe("Test verification request", () => {
5967
cy.get(locators.verificationRequest.FORM_HEARD_FROM).type(fullVerificationRequest.heardFrom);
6068
cy.get(locators.verificationRequest.FORM_SOURCE).type(`https://${fullVerificationRequest.source}`);
6169
cy.get(locators.verificationRequest.FORM_EMAIL).type(fullVerificationRequest.email);
70+
cy.intercept("GET", "**/verification-request/**").as("getVerification");
6271
saveVerificationRequest();
63-
cy.url().should("match", regexVerificationRequestPage);
72+
cy.wait("@getVerification");
73+
waitForVerificationDetail()
6474

65-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
75+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
6676
cy.get(locators.verificationRequest.FORM_SOURCE_ADD).click();
6777
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_1).type(`https://${updatedSource}`);
6878
saveVerificationRequest();
@@ -95,13 +105,12 @@ describe("Test verification request", () => {
95105

96106
cy.get(locators.verificationRequest.FORM_CONTENT).type(minimumContent);
97107
selectPublicationDate(today);
108+
cy.intercept("GET", "**/verification-request/**").as("getVerification");
98109
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"));
110+
cy.wait("@getVerification");
111+
waitForVerificationDetail()
103112

104-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
113+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
105114
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_0).type(`https://${fullVerificationRequest.source}`);
106115
selectPublicationDate(getPastDay(1));
107116
saveVerificationRequest();
@@ -132,7 +141,7 @@ describe("Test verification request", () => {
132141

133142
it("should discard unsaved changes when the edition form is canceled", () => {
134143
goToVerificationRequest()
135-
cy.get(locators.verificationRequest.EDIT_BUTTON).click();
144+
cy.get(locators.verificationRequest.EDIT_BUTTON).should("be.visible").click();
136145
cy.get(locators.verificationRequest.FORM_SOURCE_ADD).click();
137146
cy.get(locators.verificationRequest.FORM_SOURCE_ITEM_1).type(`https://${updatedSource}`);
138147
selectPublicationDate(getPastDay(10));

0 commit comments

Comments
 (0)