Skip to content

Commit

Permalink
Add e2e test for duplicating scoring objective
Browse files Browse the repository at this point in the history
  • Loading branch information
lkleisa committed Dec 4, 2023
1 parent da6a1b8 commit 6de2a88
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions frontend/cypress/e2e/duplicated-scoring.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import * as users from '../fixtures/users.json';
import { onlyOn } from '@cypress/skip-test';

describe('e2e test for scoring adjustment on objective duplicate', () => {
beforeEach(() => {
cy.loginAsUser(users.gl);
onlyOn('chrome');
cy.visit('/?quarter=2');
});

it('Create ordinal checkin and validate value of scoring component', () => {
cy.createOrdinalKeyresult('stretch keyresult for testing', null);
cy.getByTestId('keyresult').get(':contains("stretch keyresult for testing")').last().click();
cy.getByTestId('add-check-in').click();
cy.getByTestId(`stretch-radio`).click();
cy.getByTestId('confidence-slider').click();
cy.realPress('{rightarrow}').realPress('{rightarrow}').realPress('{rightarrow}');
cy.getByTestId('changeInfo').click().type('Testveränderungen');
cy.getByTestId('initiatives').click().type('Testmassnahmen');
cy.getByTestId('submit-check-in').click();
cy.getByTestId('close-drawer').click({ force: true });

cy.get('.objective').first().getByTestId('three-dot-menu').click();
cy.get('.mat-mdc-menu-content').contains('Objective duplizieren').click();
cy.fillOutObjective('A duplicated Objective for this tool', 'safe', '3');
cy.visit('/?quarter=3');

let scoringBlock1 = cy
.getByTestId('objective')
.first()
.getByTestId('key-result')
.first()
.getByTestId('scoring-component')
.first();

scoringBlock1.getByTestId('fail').first().should('not.have.css', 'score-red');
scoringBlock1.getByTestId('fail').first().should('not.have.css', 'score-yellow');
scoringBlock1.getByTestId('fail').first().should('not.have.css', 'score-green');
scoringBlock1.getByTestId('fail').first().should('not.have.css', 'score-stretch');

let scoringBlock2 = cy
.getByTestId('objective')
.first()
.getByTestId('key-result')
.last()
.getByTestId('scoring-component')
.last();

scoringBlock2.getByTestId('fail').first().should('not.have.css', 'score-red');
scoringBlock2.getByTestId('fail').first().should('not.have.css', 'score-yellow');
scoringBlock2.getByTestId('fail').first().should('not.have.css', 'score-green');
scoringBlock2.getByTestId('fail').first().should('not.have.css', 'score-stretch');
});
});
2 changes: 1 addition & 1 deletion frontend/src/app/keyresult/keyresult.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
tabindex="0"
>
<div class="text-start linebreak mb-2">{{ keyResult.title }}</div>
<app-scoring [keyResult]="keyResult" [isDetail]="false"></app-scoring>
<app-scoring [keyResult]="keyResult" [isDetail]="false" [attr.data-testId]="'scoring-component'"></app-scoring>
<div class="d-flex justify-content-between mt-1">
<div class="d-flex justify-content-center">
<span class="d-flex align-items-center flex-wrap sub-title-keyresult">
Expand Down

0 comments on commit 6de2a88

Please sign in to comment.