diff --git a/frontend/cypress/e2e/overview.cy.ts b/frontend/cypress/e2e/overview.cy.ts index 54ea0bae43..d396ad11bc 100644 --- a/frontend/cypress/e2e/overview.cy.ts +++ b/frontend/cypress/e2e/overview.cy.ts @@ -5,8 +5,27 @@ describe('OKR Overview', () => { cy.loginAsUser(users.gl); }); - it('should have the current quarter with label Aktuell', () => { - cy.getByTestId('quarterFilter').contains('Aktuell'); + it.only('should have the current quarter with label Aktuell', () => { + cy.getByTestId('quarterFilter') + .contains('Aktuell') + .invoke('text') + .then((text) => { + //Checks if the current quarter is displayed with the label Aktuell not sure if this is needed + const currentDate = new Date(); + const currentMonth = currentDate.getMonth(); + let quarter = Math.ceil((currentMonth + 1) / 3 + 1); + + if (quarter > 4) { + quarter -= 4; + } + + const businessYearStart = quarter > 2 ? currentDate.getFullYear() - 2001 : currentDate.getFullYear() - 2000; + const businessYearEnd = businessYearStart + 1; + + const expectedText = `GJ ${businessYearStart}/${businessYearEnd}-Q${quarter} Aktuell`; + + expect(text).to.contain(expectedText); + }); }); it('Check order of teams', () => {