mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Hard load after logout to reset stores (no-changelog) (#9500)
This commit is contained in:
parent
f8683c31e0
commit
93679076b4
|
@ -34,6 +34,27 @@ describe('User Management', { disableAutoLogin: true }, () => {
|
||||||
cy.enableFeature('sharing');
|
cy.enableFeature('sharing');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.only('should login and logout', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('input[name="email"]').type(INSTANCE_OWNER.email);
|
||||||
|
cy.get('input[name="password"]').type(INSTANCE_OWNER.password);
|
||||||
|
cy.getByTestId('form-submit-button').click();
|
||||||
|
mainSidebar.getters.logo().should('be.visible');
|
||||||
|
mainSidebar.actions.goToSettings();
|
||||||
|
settingsSidebar.getters.users().should('be.visible');
|
||||||
|
|
||||||
|
mainSidebar.actions.closeSettings();
|
||||||
|
mainSidebar.actions.openUserMenu();
|
||||||
|
cy.getByTestId('user-menu-item-logout').click();
|
||||||
|
|
||||||
|
cy.get('input[name="email"]').type(INSTANCE_MEMBERS[0].email);
|
||||||
|
cy.get('input[name="password"]').type(INSTANCE_MEMBERS[0].password);
|
||||||
|
cy.getByTestId('form-submit-button').click();
|
||||||
|
mainSidebar.getters.logo().should('be.visible');
|
||||||
|
mainSidebar.actions.goToSettings();
|
||||||
|
cy.getByTestId('menu-item').filter('#settings-users').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
it('should prevent non-owners to access UM settings', () => {
|
it('should prevent non-owners to access UM settings', () => {
|
||||||
usersSettingsPage.actions.loginAndVisit(
|
usersSettingsPage.actions.loginAndVisit(
|
||||||
INSTANCE_MEMBERS[0].email,
|
INSTANCE_MEMBERS[0].email,
|
||||||
|
|
|
@ -15,7 +15,7 @@ const credentialsModal = new CredentialsModal();
|
||||||
const executionsTab = new WorkflowExecutionsTab();
|
const executionsTab = new WorkflowExecutionsTab();
|
||||||
|
|
||||||
describe('Projects', () => {
|
describe('Projects', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.resetDatabase();
|
cy.resetDatabase();
|
||||||
cy.enableFeature('sharing');
|
cy.enableFeature('sharing');
|
||||||
cy.enableFeature('advancedPermissions');
|
cy.enableFeature('advancedPermissions');
|
||||||
|
@ -219,4 +219,13 @@ describe('Projects', () => {
|
||||||
menuItems.filter('[class*=active_]').should('have.length', 1);
|
menuItems.filter('[class*=active_]').should('have.length', 1);
|
||||||
menuItems.filter(':contains("Development")[class*=active_]').should('exist');
|
menuItems.filter(':contains("Development")[class*=active_]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not show project add button and projects to a member if not invited to any project', () => {
|
||||||
|
cy.signout();
|
||||||
|
cy.signin(INSTANCE_MEMBERS[1]);
|
||||||
|
cy.visit(workflowsPage.url);
|
||||||
|
|
||||||
|
projects.getAddProjectButton().should('not.exist');
|
||||||
|
projects.getMenuItems().should('not.exist');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ export class MainSidebar extends BasePage {
|
||||||
getters = {
|
getters = {
|
||||||
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
|
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
|
||||||
settings: () => this.getters.menuItem('settings'),
|
settings: () => this.getters.menuItem('settings'),
|
||||||
|
settingsBack: () => cy.getByTestId('settings-back'),
|
||||||
templates: () => this.getters.menuItem('templates'),
|
templates: () => this.getters.menuItem('templates'),
|
||||||
workflows: () => this.getters.menuItem('workflows'),
|
workflows: () => this.getters.menuItem('workflows'),
|
||||||
credentials: () => this.getters.menuItem('credentials'),
|
credentials: () => this.getters.menuItem('credentials'),
|
||||||
|
@ -30,8 +31,8 @@ export class MainSidebar extends BasePage {
|
||||||
openUserMenu: () => {
|
openUserMenu: () => {
|
||||||
this.getters.userMenu().click();
|
this.getters.userMenu().click();
|
||||||
},
|
},
|
||||||
openUserMenu: () => {
|
closeSettings: () => {
|
||||||
this.getters.userMenu().click();
|
this.getters.settingsBack().click();
|
||||||
},
|
},
|
||||||
signout: () => {
|
signout: () => {
|
||||||
const workflowsPage = new WorkflowsPage();
|
const workflowsPage = new WorkflowsPage();
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default defineComponent({
|
||||||
async logout() {
|
async logout() {
|
||||||
try {
|
try {
|
||||||
await this.usersStore.logout();
|
await this.usersStore.logout();
|
||||||
void this.$router.replace({ name: VIEWS.SIGNIN });
|
window.location.href = this.$router.resolve({ name: VIEWS.SIGNIN }).href;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.showError(e, this.$locale.baseText('auth.signout.error'));
|
this.showError(e, this.$locale.baseText('auth.signout.error'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue