Fix #15438: Update filters and destination for 'Conversation' source in notification alert (#15443)

* Add 'Mentions' enum for subscriptionCategory

* fix the user list selection field not showing for 'Mentioned Users' filter

* update the cypress for new changes

* fix teams not showing in the mention suggestions
This commit is contained in:
Aniket Katkar 2024-03-04 21:40:31 +05:30 committed by GitHub
parent 7b5f36b374
commit 110e7a4f4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 943 additions and 790 deletions

View File

@ -86,6 +86,7 @@
"Admins",
"Assignees",
"Owners",
"Mentions",
"Followers",
"External"
]

View File

@ -127,7 +127,8 @@ export const addEventTypeFilter = (
}
};
export const addUpdaterNameFilter = (
export const addFilterWithUsersListInput = (
filterTestId,
filterNumber,
updaterName,
exclude = false
@ -136,9 +137,7 @@ export const addUpdaterNameFilter = (
cy.get(`[data-testid="filter-select-${filterNumber}"]`).click({
waitForAnimations: true,
});
cy.get('[data-testid="Updater Name-filter-option"]')
.filter(':visible')
.click();
cy.get(`[data-testid="${filterTestId}"]`).filter(':visible').click();
// Search and select user
interceptURL('GET', `/api/v1/search/query?q=*`, 'getSearchResult');

View File

@ -19,10 +19,10 @@ import {
addEntityFQNFilter,
addEventTypeFilter,
addExternalDestination,
addFilterWithUsersListInput,
addGMEFilter,
addInternalDestination,
addOwnerFilter,
addUpdaterNameFilter,
deleteAlertSteps,
verifyAlertDetails,
} from '../../common/AlertUtils';
@ -54,380 +54,495 @@ const SOURCE_NAME_2 = 'dashboard';
const SOURCE_DISPLAY_NAME_2 = 'Dashboard';
const SOURCE_NAME_3 = 'task';
const SOURCE_DISPLAY_NAME_3 = 'Task';
const SOURCE_NAME_4 = 'conversation';
const SOURCE_DISPLAY_NAME_4 = 'Conversation';
describe('Notification Alert Flow', { tags: 'Settings' }, () => {
const data = {
user: {
displayName: '',
},
domain: {
name: '',
},
alertDetails: {
id: '',
},
};
describe(
'Notification Alert Flow',
{ tags: ['Settings', 'Observability'] },
() => {
const data = {
user: {
displayName: '',
},
domain: {
name: '',
},
alertDetails: {
id: '',
},
};
before(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
before(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
// Create a dashboard
createSingleLevelEntity({
token,
...DASHBOARD_SERVICE,
});
// Create a dashboard
createSingleLevelEntity({
token,
...DASHBOARD_SERVICE,
});
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: USER_DETAILS,
}).then((response) => {
data.user = response.body;
});
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: USER_DETAILS,
}).then((response) => {
data.user = response.body;
});
// Create a domain
cy.request({
method: 'PUT',
url: `/api/v1/domains`,
headers: { Authorization: `Bearer ${token}` },
body: DOMAIN_CREATION_DETAILS,
}).then((response) => {
data.domain = response.body;
// Create a domain
cy.request({
method: 'PUT',
url: `/api/v1/domains`,
headers: { Authorization: `Bearer ${token}` },
body: DOMAIN_CREATION_DETAILS,
}).then((response) => {
data.domain = response.body;
});
});
});
});
after(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
after(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
hardDeleteService({
token,
serviceFqn: DASHBOARD_SERVICE.service.name,
serviceType: DASHBOARD_SERVICE.serviceType,
});
hardDeleteService({
token,
serviceFqn: DASHBOARD_SERVICE.service.name,
serviceType: DASHBOARD_SERVICE.serviceType,
});
// Delete created domain
cy.request({
method: 'DELETE',
url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`,
headers: { Authorization: `Bearer ${token}` },
});
// Delete created domain
cy.request({
method: 'DELETE',
url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`,
headers: { Authorization: `Bearer ${token}` },
});
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${data.user.id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${data.user.id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
});
beforeEach(() => {
interceptURL('POST', '/api/v1/events/subscriptions', 'createAlert');
interceptURL('PUT', '/api/v1/events/subscriptions', 'updateAlert');
interceptURL('GET', '/api/v1/events/subscriptions/name/*', 'alertDetails');
cy.login();
cy.sidebarClick(SidebarItem.SETTINGS);
interceptURL('GET', '/api/v1/events/subscriptions?*', 'alertsPage');
cy.get('[data-testid="notifications"]')
.contains('Notifications')
.scrollIntoView()
.click();
});
it('Create new alert with single filter and destination', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_1}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_1
);
// Select filters
cy.get('[data-testid="add-filters"]').click();
addOwnerFilter(0, data.user.displayName);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Admins', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Check created alert details', () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
verifyResponseStatusCode('@alertDetails', 200);
// Verify alert details
verifyAlertDetails(data.alertDetails);
});
it('Edit and check alert by adding multiple filters and internal destinations', () => {
const { id: alertId } = data.alertDetails;
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Update description
cy.get(descriptionBox).click().clear().type(ALERT_UPDATED_DESCRIPTION);
// Update source
cy.get('[data-testid="source-select"]').scrollIntoView().click();
cy.get(`[data-testid="${SOURCE_NAME_2}-option"]`)
.contains(SOURCE_DISPLAY_NAME_2)
.click();
// Filters should reset after source change
cy.get('[data-testid="filter-select-0"]').should('not.exist');
// Add multiple filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
beforeEach(() => {
interceptURL('POST', '/api/v1/events/subscriptions', 'createAlert');
interceptURL('PUT', '/api/v1/events/subscriptions', 'updateAlert');
interceptURL(
'GET',
'/api/v1/events/subscriptions/name/*',
'alertDetails'
);
cy.login();
cy.sidebarClick(SidebarItem.SETTINGS);
interceptURL('GET', '/api/v1/events/subscriptions?*', 'alertsPage');
cy.get('[data-testid="notifications"]')
.contains('Notifications')
.scrollIntoView()
.click();
});
addOwnerFilter(0, data.user.displayName);
addEntityFQNFilter(
1,
`${DASHBOARD_SERVICE.service.name}.${DASHBOARD_SERVICE.entity.name}`,
true
);
addEventTypeFilter(2, 'entityCreated');
addUpdaterNameFilter(3, data.user.displayName, true);
addDomainFilter(4, data.domain.name);
addGMEFilter(5);
it('Create new alert with single filter and destination', () => {
verifyResponseStatusCode('@alertsPage', 200);
// Add multiple destinations
[...Array(3).keys()].forEach(() => {
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_1}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_1
);
// Select filters
cy.get('[data-testid="add-filters"]').click();
addOwnerFilter(0, data.user.displayName);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Admins', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
addInternalDestination(1, 'Owners', 'G Chat');
addInternalDestination(2, 'Teams', 'Slack', 'Team-select', 'Organization');
addInternalDestination(
3,
'Users',
'Email',
'User-select',
data.user.displayName
);
it('Check created alert details', () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
expect(interception?.response?.statusCode).equal(200);
verifyResponseStatusCode('@alertDetails', 200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
it('Delete alert with single filter', () => {
deleteAlertSteps(ALERT_NAME);
});
it('Create new alert with multiple filters and destinations', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_1}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_1
);
// Add multiple filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
// Verify alert details
verifyAlertDetails(data.alertDetails);
});
addOwnerFilter(0, data.user.displayName);
addEntityFQNFilter(
1,
`${DASHBOARD_SERVICE.service.name}.${DASHBOARD_SERVICE.entity.name}`,
true
);
addEventTypeFilter(2, 'entityCreated');
addUpdaterNameFilter(3, data.user.displayName, true);
addDomainFilter(4, data.domain.name);
addGMEFilter(5);
it('Edit and check alert by adding multiple filters and internal destinations', () => {
const { id: alertId } = data.alertDetails;
// Add multiple destinations
[...Array(6).keys()].forEach(() => {
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Update description
cy.get(descriptionBox).click().clear().type(ALERT_UPDATED_DESCRIPTION);
// Update source
cy.get('[data-testid="source-select"]').scrollIntoView().click();
cy.get(`[data-testid="${SOURCE_NAME_2}-option"]`)
.contains(SOURCE_DISPLAY_NAME_2)
.click();
// Filters should reset after source change
cy.get('[data-testid="filter-select-0"]').should('not.exist');
// Add multiple filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
});
addOwnerFilter(0, data.user.displayName);
addEntityFQNFilter(
1,
`${DASHBOARD_SERVICE.service.name}.${DASHBOARD_SERVICE.entity.name}`,
true
);
addEventTypeFilter(2, 'entityCreated');
addFilterWithUsersListInput(
'Updater Name-filter-option',
3,
data.user.displayName,
true
);
addDomainFilter(4, data.domain.name);
addGMEFilter(5);
// Add multiple destinations
[...Array(3).keys()].forEach(() => {
cy.get('[data-testid="add-destination-button"]')
.scrollIntoView()
.click();
});
addInternalDestination(1, 'Owners', 'G Chat');
addInternalDestination(
2,
'Teams',
'Slack',
'Team-select',
'Organization'
);
addInternalDestination(
3,
'Users',
'Email',
'User-select',
data.user.displayName
);
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
it('Delete alert with single filter', () => {
deleteAlertSteps(ALERT_NAME);
});
it('Create new alert with multiple filters and destinations', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_1}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_1
);
// Add multiple filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
});
addOwnerFilter(0, data.user.displayName);
addEntityFQNFilter(
1,
`${DASHBOARD_SERVICE.service.name}.${DASHBOARD_SERVICE.entity.name}`,
true
);
addEventTypeFilter(2, 'entityCreated');
addFilterWithUsersListInput(
'Updater Name-filter-option',
3,
data.user.displayName,
true
);
addDomainFilter(4, data.domain.name);
addGMEFilter(5);
// Add multiple destinations
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="add-destination-button"]')
.scrollIntoView()
.click();
});
addInternalDestination(0, 'Followers', 'Email');
addExternalDestination(1, 'Email', 'test@example.com');
addExternalDestination(2, 'G Chat', 'https://gchat.com');
addExternalDestination(3, 'Generic', 'https://generic.com');
addExternalDestination(4, 'Ms Teams', 'https://msteams.com');
addExternalDestination(5, 'Slack', 'https://slack.com');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Edit and check alert by removing added filters and internal destinations', () => {
const { id: alertId } = data.alertDetails;
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Remove description
cy.get(descriptionBox).click().clear();
// Remove all filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="remove-filter-0"]').scrollIntoView().click();
});
// Remove all destinations except one
[...Array(5).keys()].forEach(() => {
cy.get('[data-testid="remove-destination-0"]').scrollIntoView().click();
});
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
it('Delete alert with multiple filters', () => {
deleteAlertSteps(ALERT_NAME);
});
it('Create alert for task source', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_3}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_3)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_3
);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Owners', 'Email');
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(1, 'Assignees', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
addInternalDestination(0, 'Followers', 'Email');
addExternalDestination(1, 'Email', 'test@example.com');
addExternalDestination(2, 'G Chat', 'https://gchat.com');
addExternalDestination(3, 'Generic', 'https://generic.com');
addExternalDestination(4, 'Ms Teams', 'https://msteams.com');
addExternalDestination(5, 'Slack', 'https://slack.com');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Edit and check alert by removing added filters and internal destinations', () => {
const { id: alertId } = data.alertDetails;
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Remove description
cy.get(descriptionBox).click().clear();
// Remove all filters
[...Array(6).keys()].forEach(() => {
cy.get('[data-testid="remove-filter-0"]').scrollIntoView().click();
it('Delete alert for task source', () => {
deleteAlertSteps(ALERT_NAME);
});
// Remove all destinations except one
[...Array(5).keys()].forEach(() => {
cy.get('[data-testid="remove-destination-0"]').scrollIntoView().click();
it('Create alert for conversation source', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_4}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_4)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_4
);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Owners', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
it('Edit and check alert by adding mentions filter', () => {
const { id: alertId } = data.alertDetails;
expect(interception?.response?.statusCode).equal(200);
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Add filter
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
addFilterWithUsersListInput(
'Mentioned Users-filter-option',
0,
data.user.displayName,
true
);
// Add mentions destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(1, 'Mentions', 'Slack');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
});
it('Delete alert with multiple filters', () => {
deleteAlertSteps(ALERT_NAME);
});
it('Create alert for task source', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-notification"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${SOURCE_NAME_3}-option"]`
)
.contains(SOURCE_DISPLAY_NAME_3)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
SOURCE_DISPLAY_NAME_3
);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Owners', 'Email');
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(1, 'Assignees', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
it('Delete alert for conversation source', () => {
deleteAlertSteps(ALERT_NAME);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Delete alert for task source', () => {
deleteAlertSteps(ALERT_NAME);
});
});
}
);

View File

@ -55,473 +55,495 @@ import { SERVICE_CATEGORIES } from '../../constants/service.constants';
const SOURCE_NAME_1 = 'Container';
const SOURCE_NAME_2 = 'Pipeline';
describe('Observability Alert Flow', { tags: 'Settings' }, () => {
const data = {
testCase: {},
testSuite: {},
pipelineService: {},
ingestionPipeline: {},
user: {
displayName: '',
},
domain: {
name: '',
},
alertDetails: {
id: '',
},
};
describe(
'Observability Alert Flow',
{ tags: ['Settings', 'Observability'] },
() => {
const data = {
testCase: {},
testSuite: {},
pipelineService: {},
ingestionPipeline: {},
user: {
displayName: '',
},
domain: {
name: '',
},
alertDetails: {
id: '',
},
};
before(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
before(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
// Create a table
createEntityTable({
token,
...DATABASE_SERVICE,
tables: [DATABASE_SERVICE.entity],
});
// Create a test suite and test case for table
cy.request({
method: 'POST',
url: `/api/v1/dataQuality/testSuites/executable`,
headers: { Authorization: `Bearer ${token}` },
body: {
name: TEST_SUITE_FQN,
executableEntityReference: TABLE_FQN,
},
}).then((response) => {
data.testSuite = response.body;
// Create a table
createEntityTable({
token,
...DATABASE_SERVICE,
tables: [DATABASE_SERVICE.entity],
});
// Create a test suite and test case for table
cy.request({
method: 'POST',
url: `/api/v1/dataQuality/testCases`,
url: `/api/v1/dataQuality/testSuites/executable`,
headers: { Authorization: `Bearer ${token}` },
body: {
name: TEST_CASE_NAME,
displayName: TEST_CASE_NAME,
entityLink: `<#E::table::${TABLE_FQN}>`,
parameterValues: [
{
name: 'columnCount',
value: 7,
},
],
testDefinition: 'tableColumnCountToEqual',
testSuite: TEST_SUITE_FQN,
name: TEST_SUITE_FQN,
executableEntityReference: TABLE_FQN,
},
}).then((testCaseResponse) => {
data.testCase = testCaseResponse.body;
});
});
}).then((response) => {
data.testSuite = response.body;
// Create a pipeline
cy.request({
method: 'POST',
url: `/api/v1/services/${PIPELINE_SERVICE.serviceType}`,
headers: { Authorization: `Bearer ${token}` },
body: PIPELINE_SERVICE.service,
}).then((pipelineServiceResponse) => {
data.pipelineService = pipelineServiceResponse.body;
cy.request({
method: 'POST',
url: `/api/v1/${PIPELINE_SERVICE.entityType}`,
headers: { Authorization: `Bearer ${token}` },
body: PIPELINE_SERVICE.entity,
});
// Create a ingestion pipeline
cy.request({
method: 'POST',
url: `/api/v1/services/ingestionPipelines`,
headers: { Authorization: `Bearer ${token}` },
body: {
airflowConfig: {},
loggerLevel: 'INFO',
name: INGESTION_PIPELINE_NAME,
pipelineType: 'metadata',
service: {
id: data.pipelineService.id,
type: 'pipelineService',
cy.request({
method: 'POST',
url: `/api/v1/dataQuality/testCases`,
headers: { Authorization: `Bearer ${token}` },
body: {
name: TEST_CASE_NAME,
displayName: TEST_CASE_NAME,
entityLink: `<#E::table::${TABLE_FQN}>`,
parameterValues: [
{
name: 'columnCount',
value: 7,
},
],
testDefinition: 'tableColumnCountToEqual',
testSuite: TEST_SUITE_FQN,
},
sourceConfig: {
config: {},
},
},
}).then((ingestionPipelineResponse) => {
data.ingestionPipeline = ingestionPipelineResponse.body;
});
});
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: USER_DETAILS,
}).then((response) => {
data.user = response.body;
});
// Create a domain
cy.request({
method: 'PUT',
url: `/api/v1/domains`,
headers: { Authorization: `Bearer ${token}` },
body: DOMAIN_CREATION_DETAILS,
}).then((response) => {
data.domain = response.body;
});
});
});
after(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
// Delete created services
hardDeleteService({
token,
serviceFqn: DATABASE_SERVICE.service.name,
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
});
hardDeleteService({
token,
serviceFqn: PIPELINE_SERVICE.service.name,
serviceType: PIPELINE_SERVICE.serviceType,
});
// Delete created domain
cy.request({
method: 'DELETE',
url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`,
headers: { Authorization: `Bearer ${token}` },
});
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${data.user.id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
beforeEach(() => {
interceptURL('POST', '/api/v1/events/subscriptions', 'createAlert');
interceptURL('PUT', '/api/v1/events/subscriptions', 'updateAlert');
interceptURL('GET', '/api/v1/events/subscriptions/name/*', 'alertDetails');
interceptURL('GET', '/api/v1/events/subscriptions?*', 'alertsPage');
cy.login();
cy.sidebarClick(SidebarItem.OBSERVABILITY_ALERT);
});
it('Create new alert Pipeline', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-observability"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get('[data-testid="drop-down-menu"] [data-testid="container-option"]')
.contains(SOURCE_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should('contain', SOURCE_NAME_1);
// Select filters
cy.get('[data-testid="add-filters"]').click();
addOwnerFilter(0, data.user.displayName, false, 'Owner Name');
// Select actions
cy.get('[data-testid="add-trigger"]').click();
addGetSchemaChangesAction(0);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Admins', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Check created pipeline alert details', () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
verifyResponseStatusCode('@alertDetails', 200);
// Verify alert details
verifyAlertDetails(data.alertDetails);
});
it('Edit created alert', () => {
const { id: alertId } = data.alertDetails;
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Update description
cy.get(descriptionBox).click().clear().type(ALERT_UPDATED_DESCRIPTION);
// Update source
cy.get('[data-testid="source-select"]').scrollIntoView().click();
cy.get('[data-testid="pipeline-option"]').contains(SOURCE_NAME_2).click();
// Filters should reset after source change
cy.get('[data-testid="filter-select-0"]').should('not.exist');
// Add multiple filters
[...Array(3).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
});
addOwnerFilter(0, data.user.displayName, false, 'Owner Name');
addEntityFQNFilter(
1,
`${PIPELINE_SERVICE.service.name}.${PIPELINE_SERVICE.entity.name}`,
true,
'Pipeline Name'
);
addDomainFilter(2, data.domain.name);
// Add actions
cy.get('[data-testid="add-trigger"]').click();
addPipelineStatusUpdatesAction(0, 'Successful', true);
// Add multiple destinations
[...Array(2).keys()].forEach(() => {
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
});
addInternalDestination(1, 'Owners', 'G Chat');
addInternalDestination(2, 'Teams', 'Slack', 'Team-select', 'Organization');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
it('Delete created alert', () => {
deleteAlertSteps(ALERT_NAME);
});
Object.entries(OBSERVABILITY_CREATION_DETAILS).forEach(
([source, alertDetails]) => {
it(`Alert creation for ${source}`, () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-observability"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get(
`[data-testid="drop-down-menu"] [data-testid="${source}-option"]`
)
.contains(alertDetails.sourceDisplayName)
.click();
cy.get('[data-testid="source-select"]').should(
'contain',
alertDetails.sourceDisplayName
);
// Add filters
alertDetails.filters.forEach((filter, filterNumber) => {
cy.get('[data-testid="add-filters"]').click();
// Select filter
cy.get(`[data-testid="filter-select-${filterNumber}"]`).click({
waitForAnimations: true,
}).then((testCaseResponse) => {
data.testCase = testCaseResponse.body;
});
cy.get(`[data-testid="${filter.name}-filter-option"]`)
.filter(':visible')
.click();
});
// Search and select filter input value
interceptURL('GET', `/api/v1/search/query?q=*`, 'getSearchResult');
cy.get(`[data-testid="${filter.inputSelector}"]`)
.click()
.type(filter.inputValue);
// Create a pipeline
cy.request({
method: 'POST',
url: `/api/v1/services/${PIPELINE_SERVICE.serviceType}`,
headers: { Authorization: `Bearer ${token}` },
body: PIPELINE_SERVICE.service,
}).then((pipelineServiceResponse) => {
data.pipelineService = pipelineServiceResponse.body;
// Adding manual wait here as as safe since debounced API is not being detected in the cypress
cy.wait(500);
verifyResponseStatusCode('@getSearchResult', 200);
cy.get(`[title="${filter.inputValue}"]`)
.filter(':visible')
.scrollIntoView()
.click();
cy.request({
method: 'POST',
url: `/api/v1/${PIPELINE_SERVICE.entityType}`,
headers: { Authorization: `Bearer ${token}` },
body: PIPELINE_SERVICE.entity,
});
// Create a ingestion pipeline
cy.request({
method: 'POST',
url: `/api/v1/services/ingestionPipelines`,
headers: { Authorization: `Bearer ${token}` },
body: {
airflowConfig: {},
loggerLevel: 'INFO',
name: INGESTION_PIPELINE_NAME,
pipelineType: 'metadata',
service: {
id: data.pipelineService.id,
type: 'pipelineService',
},
sourceConfig: {
config: {},
},
},
}).then((ingestionPipelineResponse) => {
data.ingestionPipeline = ingestionPipelineResponse.body;
});
});
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: USER_DETAILS,
}).then((response) => {
data.user = response.body;
});
// Create a domain
cy.request({
method: 'PUT',
url: `/api/v1/domains`,
headers: { Authorization: `Bearer ${token}` },
body: DOMAIN_CREATION_DETAILS,
}).then((response) => {
data.domain = response.body;
});
});
});
after(() => {
cy.login();
cy.getAllLocalStorage().then((storageData) => {
const token = Object.values(storageData)[0].oidcIdToken;
// Delete created services
hardDeleteService({
token,
serviceFqn: DATABASE_SERVICE.service.name,
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
});
hardDeleteService({
token,
serviceFqn: PIPELINE_SERVICE.service.name,
serviceType: PIPELINE_SERVICE.serviceType,
});
// Delete created domain
cy.request({
method: 'DELETE',
url: `/api/v1/domains/name/${DOMAIN_CREATION_DETAILS.name}`,
headers: { Authorization: `Bearer ${token}` },
});
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${data.user.id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
beforeEach(() => {
interceptURL('POST', '/api/v1/events/subscriptions', 'createAlert');
interceptURL('PUT', '/api/v1/events/subscriptions', 'updateAlert');
interceptURL(
'GET',
'/api/v1/events/subscriptions/name/*',
'alertDetails'
);
interceptURL('GET', '/api/v1/events/subscriptions?*', 'alertsPage');
cy.login();
cy.sidebarClick(SidebarItem.OBSERVABILITY_ALERT);
});
it('Create new alert Pipeline', () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-observability"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select all source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
cy.get('[data-testid="drop-down-menu"] [data-testid="container-option"]')
.contains(SOURCE_NAME_1)
.click();
cy.get('[data-testid="source-select"]').should('contain', SOURCE_NAME_1);
// Select filters
cy.get('[data-testid="add-filters"]').click();
addOwnerFilter(0, data.user.displayName, false, 'Owner Name');
// Select actions
cy.get('[data-testid="add-trigger"]').click();
addGetSchemaChangesAction(0);
// Select Destination
cy.get('[data-testid="add-destination-button"]').scrollIntoView().click();
addInternalDestination(0, 'Admins', 'Email');
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it('Check created pipeline alert details', () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
verifyResponseStatusCode('@alertDetails', 200);
// Verify alert details
verifyAlertDetails(data.alertDetails);
});
it('Edit created alert', () => {
const { id: alertId } = data.alertDetails;
// Go to edit alert page
cy.get('table').should('contain', ALERT_NAME).click();
cy.get(
`[data-row-key="${alertId}"] [data-testid="alert-edit-${ALERT_NAME}"]`
).click();
// Update description
cy.get(descriptionBox).click().clear().type(ALERT_UPDATED_DESCRIPTION);
// Update source
cy.get('[data-testid="source-select"]').scrollIntoView().click();
cy.get('[data-testid="pipeline-option"]').contains(SOURCE_NAME_2).click();
// Filters should reset after source change
cy.get('[data-testid="filter-select-0"]').should('not.exist');
// Add multiple filters
[...Array(3).keys()].forEach(() => {
cy.get('[data-testid="add-filters"]').scrollIntoView().click();
});
addOwnerFilter(0, data.user.displayName, false, 'Owner Name');
addEntityFQNFilter(
1,
`${PIPELINE_SERVICE.service.name}.${PIPELINE_SERVICE.entity.name}`,
true,
'Pipeline Name'
);
addDomainFilter(2, data.domain.name);
// Add actions
cy.get('[data-testid="add-trigger"]').click();
addPipelineStatusUpdatesAction(0, 'Successful', true);
// Add multiple destinations
[...Array(2).keys()].forEach(() => {
cy.get('[data-testid="add-destination-button"]')
.scrollIntoView()
.click();
});
addInternalDestination(1, 'Owners', 'G Chat');
addInternalDestination(
2,
'Teams',
'Slack',
'Team-select',
'Organization'
);
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@updateAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(200);
// Verify the edited alert changes
verifyAlertDetails(interception?.response?.body);
});
});
it('Delete created alert', () => {
deleteAlertSteps(ALERT_NAME);
});
Object.entries(OBSERVABILITY_CREATION_DETAILS).forEach(
([source, alertDetails]) => {
it(`Alert creation for ${source}`, () => {
verifyResponseStatusCode('@alertsPage', 200);
cy.get('[data-testid="create-observability"]').click();
// Enter alert name
cy.get('#name').type(ALERT_NAME);
// Enter description
cy.get(descriptionBox).clear().type(ALERT_DESCRIPTION);
// Select source
cy.get('[data-testid="add-source-button"]').scrollIntoView().click();
// Check if option is selected
cy.get(
`[title="${filter.inputValue}"] .ant-select-item-option-state`
).should('exist');
`[data-testid="drop-down-menu"] [data-testid="${source}-option"]`
)
.contains(alertDetails.sourceDisplayName)
.click();
if (filter.exclude) {
// Change filter effect
cy.get(`[data-testid="filter-switch-${filterNumber}"]`)
cy.get('[data-testid="source-select"]').should(
'contain',
alertDetails.sourceDisplayName
);
// Add filters
alertDetails.filters.forEach((filter, filterNumber) => {
cy.get('[data-testid="add-filters"]').click();
// Select filter
cy.get(`[data-testid="filter-select-${filterNumber}"]`).click({
waitForAnimations: true,
});
cy.get(`[data-testid="${filter.name}-filter-option"]`)
.filter(':visible')
.click();
// Search and select filter input value
interceptURL('GET', `/api/v1/search/query?q=*`, 'getSearchResult');
cy.get(`[data-testid="${filter.inputSelector}"]`)
.click()
.type(filter.inputValue);
// Adding manual wait here as as safe since debounced API is not being detected in the cypress
cy.wait(500);
verifyResponseStatusCode('@getSearchResult', 200);
cy.get(`[title="${filter.inputValue}"]`)
.filter(':visible')
.scrollIntoView()
.click();
}
});
// Add actions
alertDetails.actions.forEach((action, actionNumber) => {
cy.get('[data-testid="add-trigger"]').click();
// Check if option is selected
cy.get(
`[title="${filter.inputValue}"] .ant-select-item-option-state`
).should('exist');
// Select action
cy.get(`[data-testid="trigger-select-${actionNumber}"]`).click({
waitForAnimations: true,
});
cy.get(`[data-testid="${action.name}-filter-option"]`)
.filter(':visible')
.click();
if (action.inputs && action.inputs.length > 0) {
action.inputs.forEach((input) => {
// Search and select domain
interceptURL(
'GET',
`/api/v1/search/query?q=*`,
'getSearchResult'
);
cy.get(`[data-testid="${input.inputSelector}"]`)
.click()
.type(input.inputValue);
if (input.waitForAPI) {
verifyResponseStatusCode('@getSearchResult', 200);
}
cy.get(`[title="${input.inputValue}"]`)
.filter(':visible')
if (filter.exclude) {
// Change filter effect
cy.get(`[data-testid="filter-switch-${filterNumber}"]`)
.scrollIntoView()
.click();
cy.get(`[data-testid="${input.inputSelector}"]`).should(
'contain',
input.inputValue
);
cy.clickOutside();
});
}
}
});
if (action.exclude) {
// Change filter effect
cy.get(`[data-testid="trigger-switch-${actionNumber}"]`)
.scrollIntoView()
// Add actions
alertDetails.actions.forEach((action, actionNumber) => {
cy.get('[data-testid="add-trigger"]').click();
// Select action
cy.get(`[data-testid="trigger-select-${actionNumber}"]`).click({
waitForAnimations: true,
});
cy.get(`[data-testid="${action.name}-filter-option"]`)
.filter(':visible')
.click();
}
if (action.inputs && action.inputs.length > 0) {
action.inputs.forEach((input) => {
// Search and select domain
interceptURL(
'GET',
`/api/v1/search/query?q=*`,
'getSearchResult'
);
cy.get(`[data-testid="${input.inputSelector}"]`)
.click()
.type(input.inputValue);
if (input.waitForAPI) {
verifyResponseStatusCode('@getSearchResult', 200);
}
cy.get(`[title="${input.inputValue}"]`)
.filter(':visible')
.scrollIntoView()
.click();
cy.get(`[data-testid="${input.inputSelector}"]`).should(
'contain',
input.inputValue
);
cy.clickOutside();
});
}
if (action.exclude) {
// Change filter effect
cy.get(`[data-testid="trigger-switch-${actionNumber}"]`)
.scrollIntoView()
.click();
}
});
// Add Destinations
alertDetails.destinations.forEach(
(destination, destinationNumber) => {
cy.get('[data-testid="add-destination-button"]')
.scrollIntoView()
.click();
if (destination.mode === 'internal') {
addInternalDestination(
destinationNumber,
destination.category,
destination.type,
destination.inputSelector,
destination.inputValue
);
} else {
addExternalDestination(
destinationNumber,
destination.category,
destination.inputValue
);
}
}
);
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
// Add Destinations
alertDetails.destinations.forEach((destination, destinationNumber) => {
cy.get('[data-testid="add-destination-button"]')
.scrollIntoView()
it(`Verify created ${source} alert details and delete alert`, () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
if (destination.mode === 'internal') {
addInternalDestination(
destinationNumber,
destination.category,
destination.type,
destination.inputSelector,
destination.inputValue
);
} else {
addExternalDestination(
destinationNumber,
destination.category,
destination.inputValue
);
}
verifyResponseStatusCode('@alertDetails', 200);
// Verify alert details
verifyAlertDetails(data.alertDetails);
// Delete alert
cy.get('[data-testid="delete-button"]').scrollIntoView().click();
cy.get('.ant-modal-header').should(
'contain',
`Delete subscription "${ALERT_NAME}"`
);
cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM);
interceptURL(
'DELETE',
'/api/v1/events/subscriptions/*',
'deleteAlert'
);
cy.get('[data-testid="confirm-button"]').click();
verifyResponseStatusCode('@deleteAlert', 200);
toastNotification(`"${ALERT_NAME}" deleted successfully!`);
});
// Click save
cy.get('[data-testid="save-button"]').scrollIntoView().click();
cy.wait('@createAlert').then((interception) => {
data.alertDetails = interception?.response?.body;
expect(interception?.response?.statusCode).equal(201);
});
toastNotification('Alerts created successfully.');
// Check if the alert details page is visible
verifyResponseStatusCode('@alertDetails', 200);
cy.get('[data-testid="alert-details-container"]').should('exist');
});
it(`Verify created ${source} alert details and delete alert`, () => {
const { id: alertId } = data.alertDetails;
verifyResponseStatusCode('@alertsPage', 200);
cy.get(`[data-row-key="${alertId}"] [data-testid="alert-name"]`)
.should('contain', ALERT_NAME)
.click();
verifyResponseStatusCode('@alertDetails', 200);
// Verify alert details
verifyAlertDetails(data.alertDetails);
// Delete alert
cy.get('[data-testid="delete-button"]').scrollIntoView().click();
cy.get('.ant-modal-header').should(
'contain',
`Delete subscription "${ALERT_NAME}"`
);
cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM);
interceptURL('DELETE', '/api/v1/events/subscriptions/*', 'deleteAlert');
cy.get('[data-testid="confirm-button"]').click();
verifyResponseStatusCode('@deleteAlert', 200);
toastNotification(`"${ALERT_NAME}" deleted successfully!`);
});
}
);
});
}
);
}
);

View File

@ -268,14 +268,14 @@ const SignInPage = () => {
</div>
</div>
)}
{(!isAuthProviderLDAP) && (
{!isAuthProviderLDAP && (
<div className="mt-8" onClick={onClickForgotPassword}>
<Typography.Link underline data-testid="forgot-password">
{t('label.forgot-password')}
</Typography.Link>
</div>
)}
{(authConfig?.enableSelfSignup) && (!isAuthProviderLDAP) && (
{authConfig?.enableSelfSignup && !isAuthProviderLDAP && (
<>
<Divider className="w-min-0 mt-8 mb-12 justify-center">
<Typography.Text className="text-sm" type="secondary">

View File

@ -528,6 +528,7 @@ export const getFieldByArgumentType = (
break;
case 'updateByUserList':
case 'userList':
field = (
<Col key="user-select" span={12}>
<Form.Item
@ -921,8 +922,10 @@ export const getFilteredDestinationOptions = (
// Logic to filter options for destination type "Internal"
// Show all options except "Assignees" for all sources.
let shouldShowOption = option.value !== SubscriptionCategory.Assignees;
// Show all options except "Assignees" and "Mentions" for all sources.
let shouldShowOption =
option.value !== SubscriptionCategory.Assignees &&
option.value !== SubscriptionCategory.Mentions;
// Only show "Owners" and "Assignees" options for "Task" source.
if (selectedSource === 'task') {
@ -932,6 +935,14 @@ export const getFilteredDestinationOptions = (
].includes(option.value as SubscriptionCategory);
}
// Only show "Owners" and "Mentions" options for "Conversation" source.
if (selectedSource === 'conversation') {
shouldShowOption = [
SubscriptionCategory.Owners,
SubscriptionCategory.Mentions,
].includes(option.value as SubscriptionCategory);
}
return shouldShowOption;
});

View File

@ -164,7 +164,7 @@ export async function suggestions(
'isBot:false',
'displayName.keyword',
'asc',
SearchIndex.USER
[SearchIndex.USER, SearchIndex.TEAM]
);
const hits = data.data.hits.hits;

View File

@ -15,6 +15,7 @@ import { includes, isNil } from 'lodash';
import React from 'react';
import { ReactComponent as AdminIcon } from '../assets/svg/admin-colored-icon.svg';
import { ReactComponent as GChatIcon } from '../assets/svg/gchat.svg';
import { ReactComponent as MentionIcon } from '../assets/svg/ic-mentions.svg';
import { ReactComponent as MSTeamsIcon } from '../assets/svg/ms-teams.svg';
import { ReactComponent as SlackIcon } from '../assets/svg/slack.svg';
import { ReactComponent as TeamIcon } from '../assets/svg/team-colored-icon.svg';
@ -42,6 +43,10 @@ export const getAlertDestinationCategoryIcons = (type: string) => {
case 'Assignees':
Icon = AssigneeIcon;
break;
case 'Mentions':
Icon = MentionIcon;
break;
case 'GChat':
Icon = GChatIcon;