490 lines
15 KiB
JavaScript
Raw Normal View History

/*
* Copyright 2022 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line spaced-comment
/// <reference types="Cypress" />
import {
addTeam,
descriptionBox,
interceptURL,
toastNotification,
updateOwner,
uuid,
verifyResponseStatusCode,
} from '../../common/common';
const updatedDescription = 'This is updated description';
const teamName = `team-ct-test-${uuid()}`;
const TEAM_DETAILS = {
name: teamName,
updatedName: `${teamName}-updated`,
teamType: 'Group',
description: `This is ${teamName} description`,
2022-12-23 11:07:07 +05:30
username: 'Aaron Johnson',
userId: 'aaron_johnson0',
assetname: 'dim_address',
email: 'team1@gmail.com',
updatedEmail: 'updatedemail@gmail.com',
};
const hardDeleteTeamName = `team-ct-test-${uuid()}`;
const HARD_DELETE_TEAM_DETAILS = {
name: hardDeleteTeamName,
displayName: hardDeleteTeamName,
teamType: 'Department',
description: `This is ${hardDeleteTeamName} description`,
email: 'team@gmail.com',
};
describe('Teams flow should work properly', () => {
beforeEach(() => {
interceptURL('GET', `/api/v1/users?fields=*`, 'getUserDetails');
interceptURL('GET', `/api/v1/permissions/team/name/*`, 'permissions');
cy.login();
cy.get('[data-testid="app-bar-item-settings"]')
.should('be.visible')
.click();
// Clicking on teams
cy.get('[data-testid="settings-left-panel"]')
.should('exist')
.should('be.visible')
UI - design update for new UI/UX (#12000) * chore(ui): revamp table details page Re-design table details header with schema tab * misc fixes for ui and tests * update * fix edit description * chore(ui): update the app left panel icons * chore(ui): update left panel icon stroke color * fix: explore page layout change * fix: highlight issues * updated right panel for explore page * fix: explore layout changes * separate out header component * added activity feed tab * fix: highlight issue * fix: highlight card for explore page * support all widget fix spacing issue * fix: show reactions * fix: update reactions for tasks tab * fix: make use of appstate to avoid repetitive calls * fix activity feed layout * fix: landing page and explore feedbacks * fix: missing localization * update activityFeedProvider with drawer * fix description v1 component icons * fix: update styles * minor fix on icons and entity table * Revamp Tag UI for TableDetailPage * fix: update css * Remove color in TagV1 component and minor file improvement * added frequantly joint table basic structure * fix: update kpi chart styles * supported request tags in table detail page * fix request description redirect issue * fix: update styles for my data page * added scroll to frequently joint table * removing unnaccessary code * fix: explore page feedbacks * fix: explore feedbacks * fixed signup page issue * chore(ui): only apply the text transform on heading * chore(ui): update table header styling * chore(ui): update table text color and border radius * fix: explore quick filters * update header for topic and dashboard * chore: update table body styling * supported glossary term hierarchy * updating spacing for all the page * chore(ui): update descriptionV1 component styling * chore: update add-chat viewbox * fix: left sidebar console errors * update all the entity headers * chore: update table name to name * update description component * clear console errors * revamp entity topbar manage area * fix: entity popover similar to explore card * updated navbar as per new UI mock * fix: feedbacks * updated announcement style as per mock * fix: explore feedbacks * implemented single box shadow wherever its needed and worked on feedback * worked on feedbacks * update feed tab on activityFeedTab component * updated glossary card, no owner icon * fix glossary hierarchy issue of repeating same glossary * fix: update resizable panel pages * updated navbar, align profiler picture in navbar with other element * fix: remove page layout component * fix: add missing layout in rule pages * fix: jest tests * fix: jest tests * replace old activity feed component with new one * fix: jest unit tests * initial DQ page setup * translation sync * fix: unit tests * supported subtab route for entities pages * fix: feedbacks * fix: update tasks pages * supported api for activity feeds for entity * added tabs component in entity table component * worked on test-suite tab * added quality page path in left bar * added action button for test suite * updated redirect path for data-quality * revert to old re-direction for add-test suite * update activity feed task tab * hide action for activity feed tab * fix: task action issue on descriptionV1 * supported new ui for data modal detail page * fix: feedbacks * fix: add missing localization * fix: breadcrumbs * data quality feedbacks * fix: feedbacks * fix: add missing localization * fix: feedbacks * supported activity feed in container and tags of all entities * update task relates changes * remove inline css for entity tag component * feat: update blue as primary color * feat: update svgs to use new primary color * updated DQ page with feedback, and add quality page flow change * translation-sync * fix assignee for tasks * updated api data for test suite pipeline creation * fix: primary color changes * fix: feedbacks * fix count issues * fix scrolling issue for activity feed * address feedbacks * combine open task with heading buttons * data quality changes * fix close with comment * removed delete functionality * clear CLI error, and changes as per JSON schema * update scroll issue on details page * added new badge, and api integration * chore: update data quality tab page styling * cleanup * fix settings page scroll issue * fix scroll issue on service page * chore: update summary cards * update graph color * DQ test case test as per mock * support edit and suggest * integrated API for status update * translation sync * fix cypress tests * integrated API call for test summary * mydata and following page change in user profile page * fix tag cypress tests * updated success % via api data for test suite * fix user component unit test * integrated API for test summary * updated data quality tab as per new mock * revert commented code fir testcaseForm.tsx * fix cypress tests * change user page activity feed with new ui * chore: fix console errors related to activity feed tab component * chore: update setting button style * chore: fix spacing * added pipeline tab * chore: update the colum profiler table * fix: test indicator styling * fetch test suite details * fix: lineage redesign * fix: missing localization * chore: add support for showing single column profile in page itself * chore: add column dropdown for column profiler * fix cypress for entity tags add and remove * supported more parameter in entity dashboard header * chore: add default tab for data quality * removed unneccessary code, and updated testsuite details page with new style * fixed DQ test * translation sync * fix cypress * added functionality to link test case with logical test suite * chore: remove fixed right from status column in column profile tab * fix: purple color issues * fix the count issue in user profile page and breaking of task page * fix: feedbacks * fix: feedbacks * ui improvements * fix cypress for owner and tier * change announcement card color and deleted old assest to it * remove old activity feed files * fix unit test * fix various cypress * fix cypress failues --------- Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com> Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io>
2023-06-21 12:59:20 +05:30
.contains('Teams')
.click();
});
it('Add new team', () => {
addTeam(TEAM_DETAILS);
cy.reload();
// asserting the added values
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.scrollIntoView()
.should('be.visible');
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`).should(
'contain',
TEAM_DETAILS.description
);
});
it('Add owner to created team', () => {
// Clicking on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
updateOwner();
});
it('Update email of created team', () => {
interceptURL('PATCH', '/api/v1/teams/*', 'updateEmail');
interceptURL('GET', '/api/v1/teams/name/*', 'getTeam');
// Clicking on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getTeam', 200);
cy.get('[data-testid="edit-email"]').should('be.visible').scrollIntoView();
cy.get('[data-testid="edit-email"]').click();
cy.get('[data-testid="email-input"]')
.should('be.visible')
.clear()
.type(TEAM_DETAILS.updatedEmail);
cy.get('[data-testid="save-edit-email"]').should('be.visible').click();
verifyResponseStatusCode('@updateEmail', 200);
cy.reload();
// check for updated email
cy.get('[data-testid="email-value"]')
.should('be.visible')
.contains(TEAM_DETAILS.updatedEmail);
});
it('Add user to created team', () => {
interceptURL('GET', '/api/v1/users?limit=25&isBot=false', 'getUsers');
interceptURL('PATCH', '/api/v1/teams/*', 'updateTeam');
// Clicking on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@permissions', 200);
cy.get('[data-testid="users"]').click();
cy.get('[data-testid="add-new-user"]').scrollIntoView().click();
verifyResponseStatusCode('@getUsers', 200);
cy.get('[data-testid="selectable-list"] [data-testid="searchbar"]').type(
TEAM_DETAILS.username
);
cy.get('[data-testid="selectable-list"]')
.find(`[title="${TEAM_DETAILS.username}"]`)
.click();
cy.get('[data-testid="selectable-list"]')
.find(`[title="${TEAM_DETAILS.username}"] input[type='checkbox']`)
.should('be.checked');
cy.get('[data-testid="selectable-list-update-btn"]')
.should('be.visible')
.click();
verifyResponseStatusCode('@updateTeam', 200);
cy.get(`[data-testid="${TEAM_DETAILS.userId}"]`).should('be.visible');
2022-12-23 11:07:07 +05:30
});
it('Remove added user from created team', () => {
interceptURL('GET', '/api/v1/users?limit=25&isBot=false', 'getUsers');
interceptURL('PATCH', '/api/v1/teams/*', 'updateTeam');
// Clicking on created team
2022-12-23 11:07:07 +05:30
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
cy.get('[data-testid="users"]').click();
verifyResponseStatusCode('@getUserDetails', 200);
verifyResponseStatusCode('@permissions', 200);
cy.get('[data-testid="add-new-user"]').should('be.visible').click();
2022-12-23 11:07:07 +05:30
verifyResponseStatusCode('@getUsers', 200);
cy.get('[data-testid="selectable-list"]')
.find(`[title="${TEAM_DETAILS.username}"]`)
.click();
cy.get('[data-testid="selectable-list-update-btn"]')
.should('be.visible')
.click();
verifyResponseStatusCode('@updateTeam', 200);
verifyResponseStatusCode('@getUserDetails', 200);
cy.get(`[data-testid="${TEAM_DETAILS.userId}"]`).should('not.exist');
});
it('Join team should work properly', () => {
interceptURL('GET', '/api/v1/users*', 'getUsers');
// Click on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
cy.get('[data-testid="users"]').click();
verifyResponseStatusCode('@getUsers', 200);
// Click on join teams button
cy.get('[data-testid="join-teams"]')
.scrollIntoView()
.should('be.visible')
.click();
// Verify toast notification
toastNotification('Team joined successfully!');
cy.get('body').find('[data-testid="leave-team-button"]').should('exist');
});
it('Update display name for created team', () => {
interceptURL(
'GET',
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
'getSelectedTeam'
);
interceptURL('PATCH', `/api/v1/teams/*`, 'patchTeam');
// Click on created team name
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getSelectedTeam', 200);
// Click on edit display name
cy.get('[data-testid="edit-team-name"]').should('be.visible').click();
// Enter the updated team name
cy.get('[data-testid="team-name-input"]')
.should('exist')
.should('be.visible')
.clear()
.type(TEAM_DETAILS.updatedName);
// Save the updated display name
cy.get('[data-testid="saveAssociatedTag"]')
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@patchTeam', 200);
verifyResponseStatusCode('@getSelectedTeam', 200);
// Validate the updated display name
cy.get('[data-testid="team-heading"]').then(($el) => {
cy.wrap($el).should('have.text', TEAM_DETAILS.updatedName);
});
cy.get('[data-testid="inactive-link"]')
.scrollIntoView()
.should('contain', TEAM_DETAILS.updatedName);
});
it('Update description for created team', () => {
interceptURL(
'GET',
`/api/v1/teams/name/${TEAM_DETAILS.name}?fields=*&include=all`,
'getSelectedTeam'
);
2022-12-23 11:07:07 +05:30
interceptURL('PATCH', '/api/v1/teams/*', 'patchDescription');
// Click on created team name
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getSelectedTeam', 200);
// Validate the updated display name
cy.get('[data-testid="team-heading"]').should(
'contain',
`${TEAM_DETAILS.updatedName}`
);
cy.get('[data-testid="inactive-link"]')
.should('be.visible')
.should('contain', TEAM_DETAILS.updatedName);
cy.get('[role="tablist"] [data-icon="right"]').click();
// Click on edit description button
cy.get('[data-testid="edit-description"]')
.should('be.visible')
.click({ force: true });
// Entering updated description
cy.get(descriptionBox).clear().type(updatedDescription);
cy.get('[data-testid="save"]').should('be.visible').click();
verifyResponseStatusCode('@patchDescription', 200);
// Validating the updated description
cy.get('[data-testid="description"] p').should(
'contain',
updatedDescription
);
});
it('Leave team flow should work properly', () => {
interceptURL(
'GET',
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
'getSelectedTeam'
);
// Click on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getSelectedTeam', 200);
cy.get('[data-testid="team-heading"]')
.should('be.visible')
.contains(TEAM_DETAILS.name);
// //Click on Leave team
cy.get('[data-testid="leave-team-button"]').click();
// //Click on confirm button
cy.get('[data-testid="save-button"]').should('be.visible').click();
toastNotification('Left the team successfully');
cy.get('body').find('[data-testid="join-teams"]').should('exist');
});
it('Permanently deleting soft deleted team should work properly', () => {
interceptURL(
'GET',
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
'getSelectedTeam'
);
// Click on created team
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.contains(TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getSelectedTeam', 200);
cy.get('[data-testid="team-heading"]')
.should('be.visible')
.contains(TEAM_DETAILS.updatedName);
cy.get('[data-testid="manage-button"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-menu-id*="delete-button"]').should('be.visible');
cy.get('[data-testid="delete-button-title"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="confirm-button"]')
.should('exist')
.should('be.disabled');
// Click on soft delete option
cy.get('[data-testid="soft-delete-option"]')
.should('contain', TEAM_DETAILS.name)
.should('be.visible')
.click();
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
interceptURL('DELETE', '/api/v1/teams/*', 'softDeleteTeam');
cy.get('[data-testid="confirm-button"]')
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@softDeleteTeam', 200);
// Verify the toast message
toastNotification('Team deleted successfully!');
// Check if soft deleted team is shown when 'Deleted Teams' switch is on
cy.get('table').should('not.contain', TEAM_DETAILS.name);
cy.get('[data-testid="show-deleted"').should('exist').click();
interceptURL(
'GET',
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
'getSelectedTeam'
);
interceptURL(
'GET',
`/api/v1/teams?limit=100000&parentTeam=${TEAM_DETAILS.name}&include=all`,
'getTeamParent'
);
interceptURL(
'GET',
`/api/v1/teams?fields=userCount%2CchildrenCount%2Cowns%2Cparents&limit=100000&parentTeam=${TEAM_DETAILS.name}&include=all`,
'getChildrenCount'
);
cy.get('table').should('contain', TEAM_DETAILS.name).click();
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
verifyResponseStatusCode('@getSelectedTeam', 200);
verifyResponseStatusCode('@getTeamParent', 200);
verifyResponseStatusCode('@getChildrenCount', 200);
cy.get('[data-testid="team-heading"]')
.should('be.visible')
.contains(TEAM_DETAILS.updatedName);
cy.get('[data-testid="manage-button"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-menu-id*="delete-button"]').should('be.visible');
cy.get('[data-testid="delete-button-title"]')
.should('exist')
.should('be.visible')
.click();
// Check if soft delete option is not present
cy.get('[data-testid="soft-delete-option"]').should('not.exist');
// Click on permanent delete option
cy.get('[data-testid="hard-delete-option"]')
.should('contain', TEAM_DETAILS.name)
.should('be.visible')
.click();
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
interceptURL('DELETE', '/api/v1/teams/*', 'deleteTeam');
cy.get('[data-testid="confirm-button"]')
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@deleteTeam', 200);
// Verify the toast message
toastNotification('Team deleted successfully!');
// Validating the deleted team
cy.get('table').should('not.contain', TEAM_DETAILS.name);
});
it('Permanently deleting a team without soft deleting should work properly', () => {
// Add a new team
addTeam(HARD_DELETE_TEAM_DETAILS);
interceptURL(
'GET',
`/api/v1/teams/name/${HARD_DELETE_TEAM_DETAILS.name}*`,
'getSelectedTeam'
);
// Click on created team
cy.get(`[data-row-key="${HARD_DELETE_TEAM_DETAILS.name}"]`)
.contains(HARD_DELETE_TEAM_DETAILS.name)
.click();
verifyResponseStatusCode('@getSelectedTeam', 200);
cy.get('[data-testid="manage-button"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-menu-id*="delete-button"]').should('be.visible');
cy.get('[data-testid="delete-button-title"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="confirm-button"]')
.should('exist')
.should('be.disabled');
// Check if soft delete option is present
cy.get('[data-testid="soft-delete-option"]')
.should('contain', HARD_DELETE_TEAM_DETAILS.name)
.should('be.visible');
// Click on permanent delete option
cy.get('[data-testid="hard-delete-option"]')
.should('contain', HARD_DELETE_TEAM_DETAILS.name)
.should('be.visible')
.click();
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
interceptURL('DELETE', '/api/v1/teams/*', 'deleteTeam');
cy.get('[data-testid="confirm-button"]')
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@deleteTeam', 200);
// Verify the toast message
toastNotification('Team deleted successfully!');
// Validating the deleted team
cy.get('table').should('not.contain', HARD_DELETE_TEAM_DETAILS.name);
});
});