2022-08-17 19:08:35 +05:30
|
|
|
/*
|
2022-12-27 12:37:58 +05:30
|
|
|
* Copyright 2022 Collate.
|
2022-08-17 19:08:35 +05:30
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
import {
|
2023-01-15 18:24:10 +05:30
|
|
|
addTeam,
|
|
|
|
descriptionBox,
|
|
|
|
interceptURL,
|
|
|
|
toastNotification,
|
|
|
|
updateOwner,
|
|
|
|
uuid,
|
|
|
|
verifyResponseStatusCode,
|
2022-11-14 18:09:38 +05:30
|
|
|
} from '../../common/common';
|
2022-09-23 16:05:54 +05:30
|
|
|
|
2022-08-17 19:08:35 +05:30
|
|
|
const updateddescription = 'This is updated description';
|
|
|
|
|
|
|
|
const teamName = `team-ct-test-${uuid()}`;
|
|
|
|
const TEAM_DETAILS = {
|
|
|
|
name: teamName,
|
|
|
|
updatedname: `${teamName}-updated`,
|
2022-09-26 19:43:34 +05:30
|
|
|
teamType: 'Department',
|
2022-08-17 19:08:35 +05:30
|
|
|
description: `This is ${teamName} description`,
|
2022-12-23 11:07:07 +05:30
|
|
|
username: 'Aaron Johnson',
|
2022-08-17 19:08:35 +05:30
|
|
|
assetname: 'dim_address',
|
|
|
|
};
|
2022-10-08 00:07:24 +05:30
|
|
|
const hardDeleteTeamName = `team-ct-test-${uuid()}`;
|
|
|
|
const HARD_DELETE_TEAM_DETAILS = {
|
|
|
|
name: hardDeleteTeamName,
|
|
|
|
displayName: hardDeleteTeamName,
|
|
|
|
teamType: 'Department',
|
|
|
|
description: `This is ${hardDeleteTeamName} description`,
|
|
|
|
};
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
describe('Teams flow should work properly', () => {
|
2022-09-29 15:21:33 +05:30
|
|
|
beforeEach(() => {
|
2022-10-08 00:07:24 +05:30
|
|
|
interceptURL('GET', `/api/v1/users?fields=*`, 'getUserDetails');
|
2022-11-16 13:21:23 +05:30
|
|
|
cy.login();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
2022-09-29 15:21:33 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on teams
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="settings-left-panel"]')
|
2022-08-17 19:08:35 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
});
|
|
|
|
|
2022-08-19 19:34:01 +05:30
|
|
|
it('Add new team', () => {
|
2022-09-26 19:43:34 +05:30
|
|
|
addTeam(TEAM_DETAILS);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
cy.reload();
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// asserting the added values
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`).should(
|
|
|
|
'contain',
|
|
|
|
TEAM_DETAILS.description
|
|
|
|
);
|
2022-08-17 19:08:35 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Add owner to created team', () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2023-01-18 19:14:35 +05:30
|
|
|
updateOwner(true);
|
2022-08-17 19:08:35 +05:30
|
|
|
});
|
|
|
|
|
2023-01-19 13:07:47 +05:30
|
|
|
// Todo:- Enable this once the issue is fixed -> https://github.com/open-metadata/OpenMetadata/issues/9801
|
|
|
|
it.skip('Add user to created team', () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/users?fields=teams,roles&team=${TEAM_DETAILS.name}&limit=15`,
|
|
|
|
'getUsers'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}?*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
|
|
|
// Click on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.wait('@getSelectedTeam').then(() => {
|
|
|
|
cy.get('[data-testid="team-heading"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.and('contain', TEAM_DETAILS.name);
|
2022-12-02 15:43:12 +05:30
|
|
|
});
|
2022-12-01 09:42:21 +05:30
|
|
|
verifyResponseStatusCode('@getUsers', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on users tab
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="Users"]')
|
|
|
|
.should('exist')
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.trigger('click');
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-10-21 10:31:33 +05:30
|
|
|
interceptURL('GET', '/api/v1/users?limit=15', 'addUser');
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL('GET', '/api/v1/users/*', 'getUsers');
|
2022-09-07 18:50:29 +05:30
|
|
|
cy.get('[data-testid="add-user"]')
|
|
|
|
.scrollIntoView()
|
2022-08-17 19:08:35 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@addUser', 200);
|
|
|
|
verifyResponseStatusCode('@getUsers', 200);
|
2022-12-23 11:07:07 +05:30
|
|
|
cy.get('[data-testid="searchbar"]').type(TEAM_DETAILS.username);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
cy.wait(500);
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get('[data-testid="data-container"]').should(
|
|
|
|
'contain',
|
2022-12-23 11:07:07 +05:30
|
|
|
TEAM_DETAILS.username
|
2022-09-14 19:19:42 +05:30
|
|
|
);
|
|
|
|
cy.get('[data-testid="checkboxAddUser"]')
|
|
|
|
.first()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Saving the added user
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/teams/*', 'saveUser');
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'api/v1/teams/name/Organization?fields=parents&include=all',
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
2022-10-21 10:31:33 +05:30
|
|
|
cy.get('[id="save-button"]').should('be.visible').click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@saveUser', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
|
|
|
// Asseting the added user
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="Users"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-12-23 11:07:07 +05:30
|
|
|
cy.get('.ant-table-row').should('contain', TEAM_DETAILS.username);
|
|
|
|
});
|
|
|
|
|
2023-01-19 13:07:47 +05:30
|
|
|
// Todo:- Enable this once the issue is fixed -> https://github.com/open-metadata/OpenMetadata/issues/9801
|
|
|
|
it.skip('Remove added user from created team', () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/users?fields=*&team=${TEAM_DETAILS.name}&limit=15`,
|
|
|
|
'getUsers'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}?*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
|
|
|
// Click on created team
|
2022-12-23 11:07:07 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.wait('@getSelectedTeam').then(() => {
|
|
|
|
cy.get('[data-testid="team-heading"]')
|
2022-12-23 11:07:07 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.within(() => {
|
|
|
|
cy.contains(TEAM_DETAILS.name).should('be.visible');
|
2023-01-15 18:24:10 +05:30
|
|
|
});
|
2022-12-23 11:07:07 +05:30
|
|
|
});
|
|
|
|
verifyResponseStatusCode('@getUsers', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on users tab
|
2022-12-23 11:07:07 +05:30
|
|
|
cy.get('[data-testid="Users"]')
|
|
|
|
.should('exist')
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.trigger('click');
|
2022-12-23 11:07:07 +05:30
|
|
|
|
|
|
|
cy.get('.ant-table-row').should('contain', TEAM_DETAILS.username);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-12-23 11:07:07 +05:30
|
|
|
cy.get('[data-testid="remove-user-btn"]')
|
2022-08-26 14:14:22 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Validating the user added
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="body-text"]').should(
|
|
|
|
'contain',
|
2022-12-23 11:07:07 +05:30
|
|
|
`Are you sure you want to Remove ${TEAM_DETAILS.username}`
|
2022-08-17 19:08:35 +05:30
|
|
|
);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/teams/*', 'deleteUser');
|
|
|
|
// Click on confirm button
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="save-button"]').should('be.visible').click();
|
2022-08-26 14:14:22 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.wait(['@deleteUser', '@getSelectedTeam', '@getUsers']);
|
|
|
|
|
|
|
|
// Verify if user is removed
|
2022-09-07 18:50:29 +05:30
|
|
|
cy.get('[data-testid="Users"]')
|
|
|
|
.should('exist')
|
2022-08-17 19:08:35 +05:30
|
|
|
.should('be.visible')
|
2022-09-07 18:50:29 +05:30
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('table').should('not.exist');
|
2022-12-23 11:07:07 +05:30
|
|
|
|
|
|
|
cy.get('body').should('not.contain', TEAM_DETAILS.username);
|
2023-01-15 18:24:10 +05:30
|
|
|
});
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
it('Join team should work properly', () => {
|
2022-10-04 11:42:39 +05:30
|
|
|
interceptURL('GET', '/api/v1/users*', 'getUsers');
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-10-04 11:42:39 +05:30
|
|
|
verifyResponseStatusCode('@getUsers', 200);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on join teams button
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="join-teams"]').should('be.visible').click();
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verify toast notification
|
2022-08-17 19:08:35 +05:30
|
|
|
toastNotification('Team joined successfully!');
|
|
|
|
|
|
|
|
cy.get('body').find('[data-testid="leave-team-button"]').should('exist');
|
|
|
|
});
|
|
|
|
|
2022-10-08 00:07:24 +05:30
|
|
|
it('Update display name for created team', () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
2022-10-08 00:07:24 +05:30
|
|
|
interceptURL('PATCH', `/api/v1/teams/*`, 'patchTeam');
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team name
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
2022-10-08 00:07:24 +05:30
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on edit display name
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="edit-synonyms"]').should('be.visible').click();
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Enter the updated team name
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="synonyms"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.clear()
|
|
|
|
.type(TEAM_DETAILS.updatedname);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Save the updated display name
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-20 19:57:13 +05:30
|
|
|
|
2022-10-08 00:07:24 +05:30
|
|
|
verifyResponseStatusCode('@patchTeam', 200);
|
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
// Validate the updated display name
|
2022-10-08 00:07:24 +05:30
|
|
|
cy.get('[data-testid="team-heading"]').then(($el) => {
|
|
|
|
cy.wrap($el).should('have.text', TEAM_DETAILS.updatedname);
|
|
|
|
});
|
|
|
|
|
|
|
|
cy.get('[data-testid="inactive-link"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.should('contain', TEAM_DETAILS.updatedname);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Update description for created team', () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
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');
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team name
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
2022-10-08 00:07:24 +05:30
|
|
|
.click();
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Validate the updated display name
|
|
|
|
cy.get('[data-testid="team-heading"]').should(
|
|
|
|
'contain',
|
|
|
|
`${TEAM_DETAILS.updatedname}`
|
|
|
|
);
|
2022-10-04 22:49:36 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="inactive-link"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.should('contain', TEAM_DETAILS.updatedname);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on edit description button
|
2022-10-04 22:49:36 +05:30
|
|
|
cy.get('[data-testid="edit-description"]')
|
2022-10-08 00:07:24 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.click({ force: true });
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Entering updated description
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get(descriptionBox).clear().type(updateddescription);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="save"]').should('be.visible').click();
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@patchDescription', 200);
|
|
|
|
|
|
|
|
// Validating the updated description
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="description"] p').should(
|
|
|
|
'contain',
|
|
|
|
updateddescription
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Leave team flow should work properly', () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
2022-10-08 00:07:24 +05:30
|
|
|
cy.get('[data-testid="team-heading"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(TEAM_DETAILS.name);
|
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
// //Click on Leave team
|
|
|
|
cy.get('[data-testid="leave-team-button"]').should('be.visible').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');
|
|
|
|
});
|
|
|
|
|
2022-09-26 19:43:34 +05:30
|
|
|
it('Permanently deleting soft deleted team should work properly', () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
|
|
|
|
.contains(TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
2022-10-08 00:07:24 +05:30
|
|
|
cy.get('[data-testid="team-heading"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(TEAM_DETAILS.updatedname);
|
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="manage-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get('[data-menu-id*="delete-button"]').should('be.visible');
|
|
|
|
|
2022-09-03 12:17:35 +05:30
|
|
|
cy.get('[data-testid="delete-button-title"]')
|
2022-08-26 14:14:22 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-09-26 19:43:34 +05:30
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.disabled');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on soft delete option
|
2022-09-26 19:43:34 +05:30
|
|
|
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);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verify the toast message
|
2022-09-26 19:43:34 +05:30
|
|
|
toastNotification('Team deleted successfully!');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Check if soft deleted team is shown when 'Deleted Teams' switch is on
|
2022-09-26 19:43:34 +05:30
|
|
|
cy.get('table').should('not.contain', TEAM_DETAILS.name);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="teams-dropdown"]').should('exist').click();
|
2022-12-02 18:23:53 +05:30
|
|
|
|
|
|
|
cy.get('[data-testid="deleted-menu-item-switch"').should('exist').click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/teams/name/${TEAM_DETAILS.name}*`,
|
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
|
|
|
|
|
|
|
cy.get('table').should('contain', TEAM_DETAILS.name).click();
|
|
|
|
|
|
|
|
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
2022-10-08 00:07:24 +05:30
|
|
|
cy.get('[data-testid="team-heading"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(TEAM_DETAILS.updatedname);
|
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
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();
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Check if soft delete option is not present
|
2022-09-26 19:43:34 +05:30
|
|
|
cy.get('[data-testid="soft-delete-option"]').should('not.exist');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on permanent delete option
|
2022-09-26 19:43:34 +05:30
|
|
|
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);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verify the toast message
|
2022-09-26 19:43:34 +05:30
|
|
|
toastNotification('Team deleted successfully!');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Validating the deleted team
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
cy.get('table').should('not.contain', TEAM_DETAILS.name);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Permanently deleting a team without soft deleting should work properly', () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Add a new team
|
2022-10-08 00:07:24 +05:30
|
|
|
addTeam(HARD_DELETE_TEAM_DETAILS);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2022-10-08 00:07:24 +05:30
|
|
|
`/api/v1/teams/name/${HARD_DELETE_TEAM_DETAILS.name}*`,
|
2022-09-26 19:43:34 +05:30
|
|
|
'getSelectedTeam'
|
|
|
|
);
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on created team
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get(`[data-row-key="${HARD_DELETE_TEAM_DETAILS.name}"]`)
|
2022-10-08 00:07:24 +05:30
|
|
|
.contains(HARD_DELETE_TEAM_DETAILS.name)
|
|
|
|
.click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getSelectedTeam', 200);
|
2022-10-08 00:07:24 +05:30
|
|
|
verifyResponseStatusCode('@getUserDetails', 200);
|
2022-09-26 19:43:34 +05:30
|
|
|
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');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Check if soft delete option is present
|
2022-09-26 19:43:34 +05:30
|
|
|
cy.get('[data-testid="soft-delete-option"]')
|
2022-10-08 00:07:24 +05:30
|
|
|
.should('contain', HARD_DELETE_TEAM_DETAILS.name)
|
2022-09-26 19:43:34 +05:30
|
|
|
.should('be.visible');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on permanent delete option
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="hard-delete-option"]')
|
2022-10-08 00:07:24 +05:30
|
|
|
.should('contain', HARD_DELETE_TEAM_DETAILS.name)
|
2022-08-17 19:08:35 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
interceptURL('DELETE', '/api/v1/teams/*', 'deleteTeam');
|
2022-08-17 19:08:35 +05:30
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@deleteTeam', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verify the toast message
|
2022-08-17 19:08:35 +05:30
|
|
|
toastNotification('Team deleted successfully!');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Validating the deleted team
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2022-10-08 00:07:24 +05:30
|
|
|
cy.get('table').should('not.contain', HARD_DELETE_TEAM_DETAILS.name);
|
2022-08-17 19:08:35 +05:30
|
|
|
});
|
|
|
|
});
|