mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-27 13:39:44 -08:00
596c472ecc
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Val <68596159+valya@users.noreply.github.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Valya Bullions <valya@n8n.io> Co-authored-by: Danny Martini <danny@n8n.io> Co-authored-by: Danny Martini <despair.blue@gmail.com> Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: oleg <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: Elias Meire <elias@meire.dev> Co-authored-by: Giulio Andreini <andreini@netseven.it> Co-authored-by: Giulio Andreini <g.andreini@gmail.com> Co-authored-by: Ayato Hayashi <go12limchangyong@gmail.com>
60 lines
2.7 KiB
TypeScript
60 lines
2.7 KiB
TypeScript
import { SettingsSidebar } from './sidebar/settings-sidebar';
|
|
import { MainSidebar } from './sidebar/main-sidebar';
|
|
import { WorkflowPage } from './workflow';
|
|
import { WorkflowsPage } from './workflows';
|
|
import { BasePage } from './base';
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
const workflowsPage = new WorkflowsPage();
|
|
const mainSidebar = new MainSidebar();
|
|
const settingsSidebar = new SettingsSidebar();
|
|
|
|
export class SettingsUsersPage extends BasePage {
|
|
url = '/settings/users';
|
|
getters = {
|
|
setUpOwnerButton: () => cy.getByTestId('action-box').find('button').first(),
|
|
inviteButton: () => cy.getByTestId('settings-users-invite-button').last(),
|
|
inviteUsersModal: () => cy.getByTestId('inviteUser-modal').last(),
|
|
inviteUsersModalEmailsInput: () => cy.getByTestId('emails').find('input').first(),
|
|
userListItems: () => cy.get('[data-test-id^="user-list-item"]'),
|
|
userItem: (email: string) => cy.getByTestId(`user-list-item-${email.toLowerCase()}`),
|
|
userActionsToggle: (email: string) =>
|
|
this.getters.userItem(email).find('[data-test-id="action-toggle"]'),
|
|
userRoleSelect: (email: string) =>
|
|
this.getters.userItem(email).find('[data-test-id="user-role-select"]'),
|
|
deleteUserAction: () =>
|
|
cy.getByTestId('action-toggle-dropdown').find('li:contains("Delete"):visible'),
|
|
confirmDeleteModal: () => cy.getByTestId('deleteUser-modal').last(),
|
|
transferDataRadioButton: () =>
|
|
this.getters.confirmDeleteModal().find('.el-radio .el-radio__input').first(),
|
|
deleteDataRadioButton: () =>
|
|
this.getters.confirmDeleteModal().find('.el-radio .el-radio__input').last(),
|
|
userSelectDropDown: () => this.getters.confirmDeleteModal().find('.n8n-select'),
|
|
userSelectOptions: () => cy.get('.el-select-dropdown:visible .el-select-dropdown__item'),
|
|
deleteUserButton: () => this.getters.confirmDeleteModal().find('button:contains("Delete")'),
|
|
deleteDataInput: () => cy.getByTestId('delete-data-input').find('input').first(),
|
|
};
|
|
actions = {
|
|
goToOwnerSetup: () => this.getters.setUpOwnerButton().click(),
|
|
loginAndVisit: (email: string, password: string, isOwner: boolean) => {
|
|
cy.signin({ email, password });
|
|
workflowPage.actions.visit();
|
|
mainSidebar.actions.goToSettings();
|
|
if (isOwner) {
|
|
settingsSidebar.getters.users().click();
|
|
cy.url().should('match', new RegExp(this.url));
|
|
} else {
|
|
settingsSidebar.getters.users().should('not.exist');
|
|
// Should be redirected to workflows page if trying to access UM url
|
|
cy.visit('/settings/users');
|
|
cy.url().should('match', new RegExp(workflowsPage.url));
|
|
}
|
|
},
|
|
opedDeleteDialog: (email: string) => {
|
|
this.getters.userActionsToggle(email).click();
|
|
this.getters.deleteUserAction().realClick();
|
|
this.getters.confirmDeleteModal().should('be.visible');
|
|
},
|
|
};
|
|
}
|