Skip to content

Commit

Permalink
change byTestId funtion implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 8, 2024
1 parent 69df967 commit 7426ddd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions frontend/cypress/e2e/teammanagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,32 +227,33 @@ describe('Team management tests', () => {
});
});

//Currentyl
it('Navigate to Bobs profile and add him to BBT and LoremIpsum', () => {
cy.intercept('PUT', '**/updateaddteammembership/*').as('updateEsha');

navigateToUser(nameEsha);

// add to team bbt as admin
cy.get('app-member-detail').getByTestId('add-user').click();
cy.get('app-member-detail').getByTestId('select-team-dropdown').click();
cy.get('app-member-detail').findByTestId('add-user').click();
cy.get('app-member-detail').findByTestId('select-team-dropdown').click();
cy.getByTestId('select-team-dropdown-option').contains('/BBT').click();
cy.get('app-member-detail').getByTestId('select-team-role').click();
cy.get('app-member-detail').findByTestId('select-team-role').click();
cy.getByTestId('select-team-role-admin').click();
cy.get('app-member-detail').getByTestId('add-user-to-team-save').click();
cy.get('app-member-detail').findByTestId('add-user-to-team-save').click();

cy.wait('@updateEsha');

// add to team loremipsum as member
cy.get('app-member-detail').getByTestId('add-user').click();
cy.get('app-member-detail').getByTestId('select-team-dropdown').click();
cy.get('app-member-detail').findByTestId('add-user').click();
cy.get('app-member-detail').findByTestId('select-team-dropdown').click();

// team BBT should not be in list anymore
cy.getByTestId('select-team-dropdown-option').should('not.contain', '/BBT');

cy.getByTestId('select-team-dropdown-option').contains('LoremIpsum').click();
cy.get('app-member-detail').getByTestId('select-team-role').click();
cy.get('app-member-detail').findByTestId('select-team-role').click();
cy.getByTestId('select-team-role-member').click();
cy.get('app-member-detail').getByTestId('add-user-to-team-save').click();
cy.get('app-member-detail').findByTestId('add-user-to-team-save').click();

cy.wait('@updateEsha');
// check table
Expand All @@ -279,7 +280,7 @@ describe('Team management tests', () => {
});
});

it('Navigate to user Esha and set as okr champion', () => {
it.only('Navigate to user Esha and set as okr champion', () => {
navigateToUser(nameEsha);
cy.getByTestId('edit-okr-champion-readonly').contains('OKR Champion:');
cy.getByTestId('edit-okr-champion-readonly').contains('Nein');
Expand Down
4 changes: 2 additions & 2 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Cypress.Commands.add('loginAsUser', (user: any) => {

Cypress.Commands.add('getByTestId', (testId: string, text?: string): Cypress.Chainable<JQuery<HTMLElement>> => {
const selector = `[data-testId=${testId}]`;
const element = cy.get(selector).should('exist');
const element = cy.get(selector);
if (text) {
element.contains(text);
}
Expand All @@ -22,7 +22,7 @@ Cypress.Commands.add(
{ prevSubject: true },
(subject: JQuery<HTMLElement>, testId: string, text?: string): Cypress.Chainable<JQuery<HTMLElement>> => {
const selector = `[data-testId=${testId}]`;
const element = cy.wrap(subject).find(selector).should('exist');
const element = cy.wrap(subject).find(selector);
if (text) {
element.contains(text);
}
Expand Down

0 comments on commit 7426ddd

Please sign in to comment.