Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 9ada5f2

Browse files
committed
TILA-1217 restore quota tests
1 parent ccd0fab commit 9ada5f2

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

ui/cypress/integration/reservation-unit-single.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,59 @@ describe("Tilavaraus ui reservation unit page (single)", () => {
464464
});
465465
});
466466

467+
describe("with reservation quota notification", () => {
468+
it("should display apt notification if quota is set and full", () => {
469+
cy.window().then(() => {
470+
sessionStorage.setItem(
471+
`oidc.apiToken.${Cypress.env("API_SCOPE")}`,
472+
"foobar"
473+
);
474+
});
475+
476+
cy.visit("/reservation-unit/single/901");
477+
478+
gotoCalendarButton().should("exist");
479+
480+
calendarWrapper().should("exist");
481+
482+
reservationSubmitButton().should("not.exist");
483+
484+
reservationQuotaNotification()
485+
.invoke("text")
486+
.should(
487+
"match",
488+
/^Sinulla on jo \d+ varausta tähän tilaan. Et voi tehdä uusia varauksia.$/
489+
);
490+
491+
cy.window().then(() => {
492+
sessionStorage.removeItem(`oidc.apiToken.${Cypress.env("API_SCOPE")}`);
493+
});
494+
});
495+
496+
it("should display apt notification if quota is set but not full", () => {
497+
cy.window().then(() => {
498+
sessionStorage.setItem(
499+
`oidc.apiToken.${Cypress.env("API_SCOPE")}`,
500+
"foobar"
501+
);
502+
});
503+
504+
cy.visit("/reservation-unit/single/902");
505+
506+
gotoCalendarButton().should("exist");
507+
508+
calendarWrapper().should("exist");
509+
510+
reservationQuotaNotification()
511+
.invoke("text")
512+
.should("match", /^Sinulla on jo \d+\/\d+ varausta tähän tilaan.$/);
513+
514+
cy.window().then(() => {
515+
sessionStorage.removeItem(`oidc.apiToken.${Cypress.env("API_SCOPE")}`);
516+
});
517+
});
518+
});
519+
467520
describe("with metadataset", () => {
468521
Cypress.config("defaultCommandTimeout", 20000);
469522
beforeEach(() => {

0 commit comments

Comments
 (0)