mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-27 00:31:42 +00:00
cypress: work on e2e cypress part 1 (#12606)
* cypress: work on e2e cypress part 1 * updated Announcement cypress
This commit is contained in:
parent
c71cf0ce35
commit
7be72a13f2
@ -35,45 +35,32 @@ describe('Test Add role and assign it to the user', () => {
|
||||
cy.get('[data-menu-id*="roles"]').should('be.visible').click();
|
||||
verifyResponseStatusCode('@getRoles', 200);
|
||||
|
||||
cy.get('[data-testid="add-role"]')
|
||||
.contains('Add Role')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="add-role"]').contains('Add Role').click();
|
||||
|
||||
// Asserting navigation
|
||||
cy.get('[data-testid="inactive-link"]')
|
||||
.should('contain', 'Add New Role')
|
||||
.should('be.visible');
|
||||
cy.get('[data-testid="inactive-link"]').should('contain', 'Add New Role');
|
||||
|
||||
// Entering name
|
||||
cy.get('#name').should('be.visible').type(roleName);
|
||||
cy.get('#name').type(roleName);
|
||||
// Entering descrription
|
||||
cy.get(descriptionBox).type('description');
|
||||
// Select the policies
|
||||
cy.get('[data-testid="policies"]').should('be.visible').click();
|
||||
cy.get('[data-testid="policies"]').click();
|
||||
|
||||
cy.get('[title="Data Consumer Policy"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[title="Data Consumer Policy"]').scrollIntoView().click();
|
||||
|
||||
cy.get('[title="Data Steward Policy"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[title="Data Steward Policy"]').scrollIntoView().click();
|
||||
// Save the role
|
||||
cy.get('[data-testid="submit-btn"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
||||
|
||||
// Verify the role is added successfully
|
||||
cy.url().should('eq', `${BASE_URL}/settings/access/roles/${roleName}`);
|
||||
cy.get('[data-testid="inactive-link"]').should('contain', roleName);
|
||||
|
||||
// Verify added description
|
||||
cy.get('[data-testid="description"] > [data-testid="viewer-container"]')
|
||||
.should('be.visible')
|
||||
.should('contain', 'description');
|
||||
cy.get(
|
||||
'[data-testid="description"] > [data-testid="viewer-container"]'
|
||||
).should('contain', 'description');
|
||||
});
|
||||
|
||||
it('Create new user and assign new role to him', () => {
|
||||
@ -83,41 +70,23 @@ describe('Test Add role and assign it to the user', () => {
|
||||
|
||||
cy.get('[data-testid="add-user"]').contains('Add User').click();
|
||||
|
||||
cy.get('[data-testid="email"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type(userEmail);
|
||||
cy.get('[data-testid="email"]').scrollIntoView().type(userEmail);
|
||||
|
||||
cy.get('[data-testid="displayName"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type(userName);
|
||||
cy.get('[data-testid="displayName"]').type(userName);
|
||||
|
||||
cy.get(descriptionBox)
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type('Adding user');
|
||||
cy.get(descriptionBox).type('Adding user');
|
||||
|
||||
interceptURL('GET', '/api/v1/users/generateRandomPwd', 'generatePassword');
|
||||
cy.get('[data-testid="password-generator"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="password-generator"]').scrollIntoView().click();
|
||||
verifyResponseStatusCode('@generatePassword', 200);
|
||||
|
||||
cy.get(`[data-testid="roles-dropdown"]`)
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get(`[data-testid="roles-dropdown"]`).type(roleName);
|
||||
cy.get(`.ant-select-dropdown [title="${roleName}"]`).click();
|
||||
|
||||
cy.get(`[data-testid="roles-dropdown"]`).click();
|
||||
|
||||
cy.get(`[title="${roleName}"]`).scrollIntoView().should('be.visible');
|
||||
|
||||
cy.get(`[title="${roleName}"]`).click();
|
||||
|
||||
cy.get('[data-testid="roles-dropdown"]').click();
|
||||
cy.clickOutside();
|
||||
interceptURL('POST', '/api/v1/users', 'createUser');
|
||||
cy.get('[data-testid="save-user"]').scrollIntoView().click();
|
||||
verifyResponseStatusCode('@createUser', 201);
|
||||
});
|
||||
|
||||
it('Verify assigned role to new user', () => {
|
||||
@ -130,13 +99,10 @@ describe('Test Add role and assign it to the user', () => {
|
||||
'searchUser'
|
||||
);
|
||||
interceptURL('GET', '/api/v1/users/*', 'userDetailsPage');
|
||||
cy.get('[data-testid="searchbar"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type(userName);
|
||||
cy.get('[data-testid="searchbar"]').type(userName);
|
||||
verifyResponseStatusCode('@searchUser', 200);
|
||||
|
||||
cy.get(`[data-testid="${userName}"]`).should('be.visible').click();
|
||||
cy.get(`[data-testid="${userName}"]`).click();
|
||||
verifyResponseStatusCode('@userDetailsPage', 200);
|
||||
|
||||
cy.get(
|
||||
|
||||
@ -50,56 +50,84 @@ describe('Entity Announcement', () => {
|
||||
interceptURL('GET', '/api/v1/permissions/*/name/*', 'entityPermission');
|
||||
interceptURL('GET', '/api/v1/feed/count?entityLink=*', 'entityFeed');
|
||||
interceptURL('GET', `/api/v1/${value.entity}/name/*`, 'getEntityDetails');
|
||||
const startDate = getCurrentLocaleDate();
|
||||
const endDate = getFutureLocaleDateFromCurrentDate(5);
|
||||
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
|
||||
|
||||
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="announcement-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="announcement-error"]')
|
||||
.should('be.visible')
|
||||
.contains('No Announcements, Click on add announcement to add one.');
|
||||
|
||||
interceptURL('POST', '/api/v1/feed', 'waitForAnnouncement');
|
||||
// Create Active Announcement
|
||||
createAnnouncement(
|
||||
'Announcement Title',
|
||||
startDate,
|
||||
endDate,
|
||||
'Announcement Description'
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/feed?entityLink=*type=Announcement',
|
||||
'announcementFeed'
|
||||
);
|
||||
|
||||
// wait time for success toast message
|
||||
verifyResponseStatusCode('@waitForAnnouncement', 201);
|
||||
cy.get('.Toastify__close-button >').should('be.visible').click();
|
||||
// Create InActive Announcement
|
||||
const InActiveStartDate = getFutureLocaleDateFromCurrentDate(6);
|
||||
const InActiveEndDate = getFutureLocaleDateFromCurrentDate(11);
|
||||
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
|
||||
cy.get('[data-testid="manage-button"]').click();
|
||||
cy.get('[data-testid="announcement-button"]').click();
|
||||
|
||||
createAnnouncement(
|
||||
'InActive Announcement Title',
|
||||
InActiveStartDate,
|
||||
InActiveEndDate,
|
||||
'InActive Announcement Description'
|
||||
);
|
||||
cy.wait('@announcementFeed').then((res) => {
|
||||
const data = res.response.body.data;
|
||||
|
||||
// wait time for success toast message
|
||||
verifyResponseStatusCode('@waitForAnnouncement', 201);
|
||||
cy.get('.Toastify__close-button >').should('be.visible').click();
|
||||
// check for inActive-announcement
|
||||
cy.get('[data-testid="inActive-announcements"]').should('be.visible');
|
||||
if (data.length > 0) {
|
||||
const token = localStorage.getItem('oidcIdToken');
|
||||
data.map((feed) => {
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
url: `/api/v1/feed/${feed.id}`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
cy.reload();
|
||||
cy.get('[data-testid="manage-button"]').click();
|
||||
cy.get('[data-testid="announcement-button"]').click();
|
||||
}
|
||||
const startDate = getCurrentLocaleDate();
|
||||
const endDate = getFutureLocaleDateFromCurrentDate(5);
|
||||
|
||||
// close announcement drawer
|
||||
cy.get('[data-testid="title"] .anticon-close').should('be.visible').click();
|
||||
cy.get('[data-testid="announcement-error"]')
|
||||
.should('be.visible')
|
||||
.contains('No Announcements, Click on add announcement to add one.');
|
||||
|
||||
// reload page to get the active announcement card
|
||||
cy.reload();
|
||||
verifyResponseStatusCode('@entityPermission', 200);
|
||||
verifyResponseStatusCode('@getEntityDetails', 200);
|
||||
verifyResponseStatusCode('@entityFeed', 200);
|
||||
// Create Active Announcement
|
||||
createAnnouncement(
|
||||
'Announcement Title',
|
||||
startDate,
|
||||
endDate,
|
||||
'Announcement Description'
|
||||
);
|
||||
|
||||
// check for announcement card on entity page
|
||||
cy.get('[data-testid="announcement-card"]').should('be.visible');
|
||||
// wait time for success toast message
|
||||
verifyResponseStatusCode('@waitForAnnouncement', 201);
|
||||
cy.get('.Toastify__close-button >').should('be.visible').click();
|
||||
// Create InActive Announcement
|
||||
const InActiveStartDate = getFutureLocaleDateFromCurrentDate(6);
|
||||
const InActiveEndDate = getFutureLocaleDateFromCurrentDate(11);
|
||||
|
||||
createAnnouncement(
|
||||
'InActive Announcement Title',
|
||||
InActiveStartDate,
|
||||
InActiveEndDate,
|
||||
'InActive Announcement Description'
|
||||
);
|
||||
|
||||
// wait time for success toast message
|
||||
verifyResponseStatusCode('@waitForAnnouncement', 201);
|
||||
cy.get('.Toastify__close-button >').should('be.visible').click();
|
||||
// check for inActive-announcement
|
||||
cy.get('[data-testid="inActive-announcements"]').should('be.visible');
|
||||
|
||||
// close announcement drawer
|
||||
cy.get('[data-testid="title"] .anticon-close')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
// reload page to get the active announcement card
|
||||
cy.reload();
|
||||
verifyResponseStatusCode('@entityPermission', 200);
|
||||
verifyResponseStatusCode('@getEntityDetails', 200);
|
||||
verifyResponseStatusCode('@entityFeed', 200);
|
||||
|
||||
// check for announcement card on entity page
|
||||
cy.get('[data-testid="announcement-card"]').should('be.visible');
|
||||
});
|
||||
};
|
||||
|
||||
ANNOUNCEMENT_ENTITIES.forEach((entity) => {
|
||||
@ -107,4 +135,29 @@ describe('Entity Announcement', () => {
|
||||
addAnnouncement(entity);
|
||||
});
|
||||
});
|
||||
ANNOUNCEMENT_ENTITIES.forEach((value) => {
|
||||
it(`Delete announcement ${value.entity}`, () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/feed?entityLink=*type=Announcement',
|
||||
'announcementFeed'
|
||||
);
|
||||
interceptURL('DELETE', '/api/v1/feed/*', 'deleteFeed');
|
||||
visitEntityDetailsPage(value.term, value.serviceName, value.entity);
|
||||
cy.get('[data-testid="manage-button"]').click();
|
||||
cy.get('[data-testid="announcement-button"]').click();
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -51,21 +51,11 @@ describe('Data Insight Alert', () => {
|
||||
verifyResponseStatusCode('@dataInsightReport', 200);
|
||||
});
|
||||
|
||||
it('Should have default alert with proper data', () => {
|
||||
cy.get('[data-testid="sub-heading"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.description);
|
||||
|
||||
cy.get('[data-testid="trigger-type"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.triggerType);
|
||||
|
||||
cy.get('[data-testid="schedule-info-type"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.scheduleInfoType);
|
||||
|
||||
cy.get('[data-testid="sendToAdmins"]').should('be.visible');
|
||||
cy.get('[data-testid="sendToTeams"]').should('be.visible');
|
||||
it('Should have default alert', () => {
|
||||
cy.get('[data-testid="sub-heading"]').should('be.visible');
|
||||
cy.get('[data-testid="trigger-type"]').should('be.visible');
|
||||
cy.get('[data-testid="schedule-info-type"]').should('be.visible');
|
||||
cy.get('[data-testid="destination"]').should('be.visible');
|
||||
cy.get('[data-testid="edit-button"]').should('be.visible');
|
||||
});
|
||||
|
||||
@ -75,40 +65,29 @@ describe('Data Insight Alert', () => {
|
||||
'api/v1/events/subscriptions/*',
|
||||
'dataInsightReportById'
|
||||
);
|
||||
cy.get('[data-testid="edit-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="edit-button"]').click();
|
||||
verifyResponseStatusCode('@dataInsightReportById', 200);
|
||||
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.should('be.disabled')
|
||||
.should('have.value', dataInsightReport.name);
|
||||
|
||||
// update the description
|
||||
cy.get(descriptionBox)
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.clear()
|
||||
.type(dataInsightReport.updatedDescription);
|
||||
|
||||
// update schedule info
|
||||
cy.get('[data-testid="scheduleInfo"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="scheduleInfo"]').scrollIntoView().click();
|
||||
|
||||
cy.get('[title="Monthly"]').should('be.visible').click();
|
||||
cy.get('.ant-select-dropdown [title="Monthly"]').click();
|
||||
|
||||
// update send to teams and admins
|
||||
cy.get('[data-testid="sendToTeams"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.uncheck();
|
||||
cy.get('[data-testid="sendToTeams"]').scrollIntoView().uncheck();
|
||||
|
||||
cy.get('[data-testid="sendToAdmins"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.uncheck();
|
||||
cy.get('[data-testid="sendToAdmins"]').scrollIntoView().uncheck();
|
||||
|
||||
interceptURL('PUT', 'api/v1/events/subscriptions', 'updatedAlert');
|
||||
interceptURL(
|
||||
@ -124,17 +103,17 @@ describe('Data Insight Alert', () => {
|
||||
|
||||
// verify the updated data
|
||||
|
||||
cy.get('[data-testid="sub-heading"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.updatedDescription);
|
||||
cy.get('[data-testid="sub-heading"]').should(
|
||||
'contain',
|
||||
dataInsightReport.updatedDescription
|
||||
);
|
||||
|
||||
cy.get('[data-testid="trigger-type"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.triggerType);
|
||||
cy.get('[data-testid="trigger-type"]').should(
|
||||
'contain',
|
||||
dataInsightReport.triggerType
|
||||
);
|
||||
|
||||
cy.get('[data-testid="schedule-info-type"]')
|
||||
.should('be.visible')
|
||||
.contains('Monthly');
|
||||
cy.get('[data-testid="schedule-info-type"]').should('contain', 'Monthly');
|
||||
});
|
||||
|
||||
it('Should Update the alert to default values', () => {
|
||||
@ -143,40 +122,29 @@ describe('Data Insight Alert', () => {
|
||||
'api/v1/events/subscriptions/*',
|
||||
'dataInsightReportById'
|
||||
);
|
||||
cy.get('[data-testid="edit-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="edit-button"]').click();
|
||||
verifyResponseStatusCode('@dataInsightReportById', 200);
|
||||
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.should('be.disabled')
|
||||
.should('have.value', dataInsightReport.name);
|
||||
|
||||
// update the description
|
||||
cy.get(descriptionBox)
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.clear()
|
||||
.type(dataInsightReport.description);
|
||||
|
||||
// update schedule info
|
||||
cy.get('[data-testid="scheduleInfo"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="scheduleInfo"]').scrollIntoView().click();
|
||||
|
||||
cy.get('[title="Weekly"]').should('be.visible').click();
|
||||
cy.get('.ant-select-dropdown [title="Weekly"]').click();
|
||||
|
||||
// update send to teams and admins
|
||||
cy.get('[data-testid="sendToTeams"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.check();
|
||||
cy.get('[data-testid="sendToTeams"]').scrollIntoView().check();
|
||||
|
||||
cy.get('[data-testid="sendToAdmins"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.check();
|
||||
cy.get('[data-testid="sendToAdmins"]').scrollIntoView().check();
|
||||
|
||||
interceptURL('PUT', 'api/v1/events/subscriptions', 'updatedAlert');
|
||||
interceptURL(
|
||||
@ -192,17 +160,20 @@ describe('Data Insight Alert', () => {
|
||||
|
||||
// verify the updated data
|
||||
|
||||
cy.get('[data-testid="sub-heading"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.description);
|
||||
cy.get('[data-testid="sub-heading"]').should(
|
||||
'contain',
|
||||
dataInsightReport.description
|
||||
);
|
||||
|
||||
cy.get('[data-testid="trigger-type"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.triggerType);
|
||||
cy.get('[data-testid="trigger-type"]').should(
|
||||
'contain',
|
||||
dataInsightReport.triggerType
|
||||
);
|
||||
|
||||
cy.get('[data-testid="schedule-info-type"]')
|
||||
.should('be.visible')
|
||||
.contains(dataInsightReport.scheduleInfoType);
|
||||
cy.get('[data-testid="schedule-info-type"]').should(
|
||||
'contain',
|
||||
dataInsightReport.scheduleInfoType
|
||||
);
|
||||
|
||||
cy.get('[data-testid="sendToAdmins"]').should('be.visible');
|
||||
cy.get('[data-testid="sendToTeams"]').should('be.visible');
|
||||
|
||||
@ -896,6 +896,9 @@ const CreateUser = ({
|
||||
<Select
|
||||
data-testid="roles-dropdown"
|
||||
disabled={isEmpty(roles)}
|
||||
filterOption={(input, option) =>
|
||||
(option?.label ?? '').includes(input)
|
||||
}
|
||||
mode="multiple"
|
||||
options={roleOptions}
|
||||
placeholder={t('label.please-select-entity', {
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
@tag-default-bg: @grey-1;
|
||||
@grey-bg-with-alpha: #7575751a;
|
||||
@btn-shadow: none;
|
||||
@user-profile-background: rgba(9, 80, 197, 0.05);
|
||||
@user-profile-background: #f4f8ff;
|
||||
@success-background-color: rgba(0, 131, 118, 0.2);
|
||||
@tag-background-color: rgba(0, 0, 0, 0.03);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user