1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/cypress/integration/projects/notifications.spec.ts
andreas-unleash c6ba6059cc
fix: reset stickiness to default on variants modal close (#3455)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Expanded the onClose handler to reset stickiness to default for project
on modal close
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-05 14:20:58 +03:00

61 lines
2.0 KiB
TypeScript

///<reference path="../../global.d.ts" />
const EDITOR = 2;
describe('notifications', () => {
const randomId = String(Math.random()).split('.')[1];
const featureToggleName = `notifications_test-${randomId}`;
const baseUrl = Cypress.config().baseUrl;
let userIds: number[] = [];
let userCredentials: Cypress.UserCredentials[] = [];
const userName = `notifications_user-${randomId}`;
const projectName = `default`;
before(() => {
cy.runBefore();
});
// This one is failing on CI: https://github.com/Unleash/unleash/actions/runs/4609305167/jobs/8160244872#step:4:193
it.skip('should create a notification when a feature is created in a project', () => {
cy.login_UI();
cy.createUser_API(userName, EDITOR).then(value => {
userIds = value.userIds;
userCredentials = value.userCredentials;
cy.login_UI();
cy.visit(`/projects/${projectName}`);
cy.createFeature_UI(featureToggleName);
//Should not show own notifications
cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click();
//then
cy.get("[data-testid='NOTIFICATIONS_MODAL']").should('exist');
const credentials = userCredentials[0];
//Sign in as a different user
cy.login_UI(credentials.email, credentials.password);
cy.visit(`/projects/${projectName}`);
cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click();
//then
// cy.get("[data-testid='UNREAD_NOTIFICATIONS']").should('exist');
cy.get("[data-testid='NOTIFICATIONS_LIST']").should(
'contain.text',
`New feature ${featureToggleName}`
);
//clean
// We need to login as admin for cleanup
cy.login_UI();
userIds.forEach(id =>
cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`)
);
cy.deleteFeature_API(featureToggleName);
});
});
});