mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
## Add the ability to disable Personal Access Tokens (PAT) admin API This PR disables PAT admin endpoints so it's not possible to create or get PATs the kill switch is enabled, the UI is hidden but the existing PATs will continue to work if they were created before. The delete endpoint still works allowing an admin to delete old PATs By default the kill switch is disabled (i.e. PAT is enabled by default)
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
///<reference path="../../global.d.ts" />
|
|
|
|
import UserCredentials = Cypress.UserCredentials;
|
|
|
|
const ENTERPRISE = Boolean(Cypress.env('ENTERPRISE'));
|
|
const randomId = String(Math.random()).split('.')[1];
|
|
const featureToggleName = `notifications_test-${randomId}`;
|
|
const baseUrl = Cypress.config().baseUrl;
|
|
let strategyId = '';
|
|
let userIds: number[] = [];
|
|
let userCredentials: UserCredentials[] = [];
|
|
const userName = `notifications_user-${randomId}`;
|
|
const projectName = `default`;
|
|
|
|
const EDITOR = 2;
|
|
|
|
describe('notifications', () => {
|
|
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']")
|
|
.eq(0)
|
|
.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);
|
|
});
|
|
});
|
|
});
|