Fixed failing flaky cypress tests. (#9150)

* Fixed failing flaky cypress tests.

* Fixed flaky cypress tests for glossary

* fixed glossary test
This commit is contained in:
Aniket Katkar 2022-12-06 15:19:52 +05:30 committed by GitHub
parent 1f48666593
commit d2b61d6065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 14 deletions

View File

@ -538,7 +538,7 @@ export const addUser = (username, email) => {
export const softDeleteUser = (username) => {
//Search the created user
interceptURL('GET', '/api/v1/search/query*', 'searchUser');
interceptURL('GET', '/api/v1/search/query?q=**&from=0&size=*&index=*', 'searchUser');
cy.get('[data-testid="searchbar"]')
.should('exist')
.should('be.visible')
@ -619,9 +619,11 @@ export const restoreUser = (username) => {
};
export const deleteSoftDeletedUser = (username) => {
cy.get('.ant-switch-handle').should('exist').should('be.visible').click();
interceptURL('GET', '/api/v1/users?fields=profile,teams,roles&include=*&limit=*', 'getSoftDeletedUser')
cy.wait(1000);
cy.get('.ant-switch-handle').should('exist').should('be.visible').click();
verifyResponseStatusCode('@getSoftDeletedUser', 200);
cy.get(`[data-testid="delete-user-btn-${username}"]`)
.should('exist')
@ -832,7 +834,7 @@ export const addTeam = (TEAM_DETAILS) => {
cy.get('[data-testid="display-name"]')
.should('exist')
.should('be.visible')
.type(TEAM_DETAILS.displayName);
.type(TEAM_DETAILS.name);
cy.get('[data-testid="team-selector"]')
.should('exist')

View File

@ -53,9 +53,11 @@ describe('Add nested teams and test TeamsSelectable', () => {
addTeam(getTeam(teamName));
cy.reload();
interceptURL('GET','/api/v1/search/query?q=*&from=*&size=*&index=*', 'getCreatedTeam')
// asserting the added values
cy.get('table').find('.ant-table-row').contains(teamName).click();
verifyResponseStatusCode('@getCreatedTeam', 200)
});
verifyResponseStatusCode('@getPermissions', 200);

View File

@ -17,7 +17,6 @@ import { SEARCH_ENTITY_TABLE } from '../../constants/constants';
const teamName = `team-group-test-${uuid()}`;
const TEAM_DETAILS = {
name: teamName,
displayName: teamName,
teamType: 'Group',
description: `This is ${teamName} description`,
...SEARCH_ENTITY_TABLE.table_1,
@ -76,10 +75,10 @@ describe('Create a team and add that team as a owner of the entity', () => {
cy.get('[data-testid="searchInputText"]')
.should('be.visible')
.type(TEAM_DETAILS.displayName);
.type(TEAM_DETAILS.name);
//Selecting the team
cy.get(`[title="${TEAM_DETAILS.displayName}"]`)
cy.get(`[title="${TEAM_DETAILS.name}"]`)
.should('exist')
.should('be.visible')
.click();
@ -90,7 +89,7 @@ describe('Create a team and add that team as a owner of the entity', () => {
.scrollIntoView()
.invoke('text')
.then((text) => {
expect(text).equal(TEAM_DETAILS.displayName);
expect(text).equal(TEAM_DETAILS.name);
});
});
});

View File

@ -110,12 +110,19 @@ describe('Glossary page should work properly', () => {
cy.get('[data-testid="governance"]')
.should('exist')
.and('be.visible')
.click({ animationDistanceThreshold: 10 });
//Clicking on Glossary
cy.get('[data-testid="appbar-item-glossary"]')
.click({ animationDistanceThreshold: 20 });
//Clicking on Glossary
cy.get('.ant-dropdown-menu')
.should('exist')
.and('be.visible')
.click();
.then(($el) => {
cy.wrap($el)
.find('[data-testid="appbar-item-glossary"]')
.should('exist')
.and('be.visible')
.click()
});
// Todo: need to remove below uncaught exception once tree-view error resolves
cy.on('uncaught:exception', () => {

View File

@ -25,7 +25,6 @@ const updateddescription = 'This is updated description';
const teamName = `team-ct-test-${uuid()}`;
const TEAM_DETAILS = {
name: teamName,
displayName: teamName,
updatedname: `${teamName}-updated`,
teamType: 'Department',
description: `This is ${teamName} description`,