30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe("Notification arrived", () => {
|
|
it("should work", () => {
|
|
cy.ayLogin("accounting");
|
|
|
|
|
|
cy.get("[data-cy=notification]").click();
|
|
cy.url().should("include", "/home-notifications");
|
|
// the server delivers notifications about once a minute (release build) and this page does not
|
|
// refresh itself, so reload until the contract notification from 0500 has arrived
|
|
waitForNotification(15);
|
|
cy.contains("Object created");
|
|
//Going to assume this is a virgin run so test contract text should be there but not going to assume it's due to current run so not checking for cyid
|
|
//cy.contains(`${Cypress.config("cyid")}-test-contract`);
|
|
cy.contains('-test-contract');
|
|
});
|
|
});
|
|
|
|
// check 5 seconds after each (re)load, up to the given number of times, until "Object created" shows
|
|
function waitForNotification(triesLeft) {
|
|
cy.wait(5000);
|
|
cy.get("body").then(($body) => {
|
|
if ($body.text().includes("Object created") || triesLeft <= 0) {
|
|
return;
|
|
}
|
|
cy.reload();
|
|
waitForNotification(triesLeft - 1);
|
|
});
|
|
}
|