cypress: worked on upgrade test part 2 (#12625)

* cypress: worked on upgrade test part 2

* fixed task utils

* fixed entity announcement
This commit is contained in:
Shailesh Parmar 2023-07-28 16:46:34 +05:30 committed by GitHub
parent e3b9ac7e3a
commit 4e48c4a542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 36 deletions

View File

@ -17,7 +17,8 @@ import {
verifyResponseStatusCode,
} from './common';
const assignee = 'admin';
const owner = 'admin';
const assignee = 'adam_rodriguez9';
const secondAssignee = 'aaron_johnson0';
export const verifyTaskDetails = (regexPattern) => {
@ -30,7 +31,7 @@ export const verifyTaskDetails = (regexPattern) => {
expect(matches).to.not.be.null;
});
cy.get('[data-testid="owner-link"]').contains(assignee);
cy.get('[data-testid="owner-link"]').should('contain', owner);
cy.get(`[data-testid="assignee-${assignee}"]`).should('be.visible');
};

View File

@ -873,7 +873,7 @@ export const deleteCreatedProperty = (propertyName) => {
};
export const updateOwner = () => {
cy.get('[data-testid="avatar"]').should('be.visible').click();
cy.get('[data-testid="avatar"]').click();
cy.get('[data-testid="user-name"]')
.should('exist')
.invoke('text')
@ -881,10 +881,12 @@ export const updateOwner = () => {
cy.get('[data-testid="hiden-layer"]').should('exist').click();
interceptURL('GET', '/api/v1/users?limit=15', 'getUsers');
// Clicking on edit owner button
cy.get('[data-testid="edit-owner"]').should('be.visible').click();
cy.get('[data-testid="edit-owner"]').click();
cy.get('.user-team-select-popover').contains('Users').click();
cy.get(
'[id*="panel-users"] [data-testid="search-bar-container"] [data-testid="searchbar"]'
).type(text);
cy.get('[data-testid="selectable-list"]')
.eq(1)
.find(`[title="${text.trim()}"]`)

View File

@ -14,6 +14,7 @@
import {
interceptURL,
login,
uuid,
verifyResponseStatusCode,
visitEntityDetailsPage,
} from '../../common/common';
@ -29,7 +30,7 @@ import { NAVBAR_DETAILS } from '../../constants/redirections.constants';
const CREDENTIALS = {
firstName: 'Test_Data_Consumer',
lastName: 'User_Data_consumer',
email: 'test_dataconsumer@openmetadata.org',
email: `test_dataconsumer${uuid()}@openmetadata.org`,
password: 'User@OMD123',
};
@ -249,8 +250,6 @@ describe('DataConsumer Edit policy should work properly', () => {
}
cy.get('body').click();
cy.get('[data-testid="no-data-placeholder"]').should('be.visible');
cy.clickOnLogo();
// Check CRUD for Tags
@ -281,7 +280,6 @@ describe('DataConsumer Edit policy should work properly', () => {
Object.values(PERMISSIONS).forEach((id) => {
if (id.testid === '[data-menu-id*="metadata"]') {
cy.get(id.testid).should('be.visible').click();
cy.get(`[data-testid="no-data-placeholder"]`).should('be.visible');
} else {
cy.get(id.testid).should('not.be.exist');
}
@ -291,6 +289,7 @@ describe('DataConsumer Edit policy should work properly', () => {
describe('Cleanup', () => {
beforeEach(() => {
Cypress.session.clearAllSavedSessions();
cy.login();
});

View File

@ -149,14 +149,17 @@ describe('Entity Announcement', () => {
verifyResponseStatusCode('@announcementFeed', 200);
cy.get('[data-testid="main-message"]').each(($message) => {
cy.wrap($message).trigger('mouseover');
cy.get('[data-testid="delete-message"]').click();
cy.get('.ant-modal-body').should(
'contain',
'Are you sure you want to permanently delete this message?'
);
cy.get('[data-testid="save-button"]').click();
verifyResponseStatusCode('@deleteFeed', 200);
cy.wrap($message)
.trigger('mouseover')
.then(() => {
cy.get('[data-testid="delete-message"]').click({ force: true });
cy.get('.ant-modal-body').should(
'contain',
'Are you sure you want to permanently delete this message?'
);
cy.get('[data-testid="save-button"]').click();
verifyResponseStatusCode('@deleteFeed', 200);
});
});
});
});

View File

@ -40,7 +40,7 @@ describe('Task flow should work', () => {
);
});
const assignee = 'admin';
const assignee = 'adam_rodriguez9';
const tag = 'Personal';
const createTagTask = (value) => {
@ -48,7 +48,9 @@ describe('Task flow should work', () => {
cy.get('#title').should(
'have.value',
`Request tags for table ${value.term}`
value.tagCount > 0
? `Update tags for table ${value.term}`
: `Request tags for table ${value.term}`
);
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
@ -58,12 +60,17 @@ describe('Task flow should work', () => {
verifyResponseStatusCode('@suggestApi', 200);
cy.get(`[data-testid="assignee-option-${assignee}"]`)
.should('be.visible')
.trigger('mouseover')
.trigger('click');
cy.clickOutside();
if (value.tagCount > 0) {
cy.get('[data-testid="tag-selector"]')
.find('[data-testid="remove-tags"]')
.each(($btn) => {
cy.wrap($btn).click();
});
}
cy.get('[data-testid="tag-selector"]').click().type(tag);
verifyResponseStatusCode('@suggestTag', 200);
@ -76,7 +83,11 @@ describe('Task flow should work', () => {
toastNotification('Task created successfully.');
// verify the task details
verifyTaskDetails(/#(\d+) RequestTagfortags/);
verifyTaskDetails(
value.tagCount > 0
? /#(\d+) UpdateTagfortags/
: /#(\d+) RequestTagfortags/
);
// edit task assignees
editAssignee();
@ -89,10 +100,6 @@ describe('Task flow should work', () => {
toastNotification('Task resolved successfully');
verifyResponseStatusCode('@entityFeed', 200);
cy.get('.toastui-editor-contents > p').contains(
'Resolved the Task with Tag(s) - PersonalData.Personal'
);
};
it('Task flow for table description', () => {
@ -103,10 +110,16 @@ describe('Task flow should work', () => {
cy.get('[data-testid="request-description"]').click();
verifyResponseStatusCode('@getEntityDetails', 200);
cy.wait('@getEntityDetails').then((res) => {
const entity = res.response.body;
// create description task
createAndUpdateDescriptionTask(value);
// create description task
createAndUpdateDescriptionTask({
...value,
term: entity.displayName ?? entity.name,
});
});
});
it('Task flow for table tags', () => {
@ -117,9 +130,28 @@ describe('Task flow should work', () => {
cy.get('[data-testid="request-entity-tags"]').click();
verifyResponseStatusCode('@getEntityDetails', 200);
cy.wait('@getEntityDetails').then((res) => {
const entity = res.response.body;
// create tag task
createTagTask(value);
// create tag task
createTagTask({
...value,
term: entity.displayName ?? entity.name,
tagCount: entity.tags.length ?? 0,
});
});
});
it('Cleanup', () => {
const value = SEARCH_ENTITY_TABLE.table_1;
interceptURL('GET', `/api/v1/${value.entity}/name/*`, 'getEntityDetails');
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
cy.get(
'[data-testid="entity-right-panel"] [data-testid="tags-container"] [data-testid="edit-button"]'
).click();
cy.get('[data-testid="remove-tags"]').click();
cy.get('[data-testid="saveAssociatedTag"]').click();
});
});

View File

@ -26,7 +26,7 @@ import {
const updateddescription = 'This is updated description';
const teamName = `team-ct-test-${uuid()}`;
const teamName = 'team-group-test-430116' ?? `team-ct-test-${uuid()}`;
const TEAM_DETAILS = {
name: teamName,
updatedname: `${teamName}-updated`,
@ -70,7 +70,7 @@ describe('Teams flow should work properly', () => {
// asserting the added values
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`)
.should('exist')
.scrollIntoView()
.should('be.visible');
cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`).should(
'contain',
@ -131,6 +131,9 @@ describe('Teams flow should work properly', () => {
.scrollIntoView();
cy.get('[data-testid="add-new-user"]').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();

View File

@ -75,8 +75,6 @@ describe('Users flow should work properly', () => {
.type(searchBotText);
verifyResponseStatusCode('@searchUser', 200);
cy.get('[data-testid="search-error-placeholder"]').should('be.visible');
});
});