little-france-10142
09/19/2022, 7:57 PMlittle-france-10142
09/19/2022, 7:58 PMlet count = 0;
cy.get(".bg-blue-300 > .bg-white")
.should(() => {
count += 1;
})
.and("contain", "Welcome")
.then(() => {
cy.log(`retried **${count}** times`);
})
.then(() => {
cy.get(".overflow-y-auto > .px-8")
.should(() => {
count += 1;
})
.and("contain", "Step 1")
.then(() => {
cy.log(`retried **${count}** times`);
})
.then(() => {
cy.get(":nth-child(2) > .bg-white")
.should(() => {
count += 1;
})
.and("contain", "Publications")
.then(() => {
cy.log(`retried **${count}** times`);
});
});
});little-france-10142
09/19/2022, 8:00 PMlittle-france-10142
09/19/2022, 8:02 PMlet count = 0
const retry = (element) => {
if (tries >= 300) {
return false
}
if (element) {
return true
}
wait(500)
count += 1
return retry(element)
}
const isTrueOrFalse = retry(domElement)
// true || falsebitter-fountain-36713
09/19/2022, 8:27 PMlittle-france-10142
09/20/2022, 1:16 PMcy.get(".h-full", { timeout: 10000 }) // TODO: update `datatest-id` to dashboard or main menu
.should((card) => {
expect(card).to.contain("Welcome");
expect(card).to.contain("Create new");
expect(card).to.contain("Publication");
});
Currently it fails about 1/20, but almost always when it's a cold API start. It's just waiting for the dashboard to load, then checks if a few elements exist. It feels like 10 seconds should be more than enough, but sometimes it isn't. It just needs to run twice though. It will always work on the second retry.little-france-10142
09/20/2022, 1:17 PMbefore block, because it's a signup+login. But I can't trigger retries from a before.little-france-10142
09/20/2022, 1:18 PM