Skip to content

Commit

Permalink
make test check if the quarter with aktuell label is actually the cur…
Browse files Browse the repository at this point in the history
…rent quarter
  • Loading branch information
nevio18324 committed Nov 14, 2024
1 parent 29c791f commit ff9e9c1
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions frontend/cypress/e2e/overview.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit ff9e9c1

Please sign in to comment.