mirror of https://github.com/nocodb/nocodb
Pranav C
2 years ago
9 changed files with 148 additions and 568 deletions
@ -0,0 +1,33 @@
|
||||
import { expect } from '@playwright/test'; |
||||
import BasePage from '../Base'; |
||||
import { AccountPage } from './index'; |
||||
|
||||
export class AccountSettingsPage extends BasePage { |
||||
private accountPage: AccountPage; |
||||
|
||||
constructor(accountPage: AccountPage) { |
||||
super(accountPage.rootPage); |
||||
this.accountPage = accountPage; |
||||
} |
||||
|
||||
async goto() { |
||||
await this.rootPage.goto('/?dummy=settings#/account/users/settings'); |
||||
} |
||||
|
||||
get() { |
||||
return this.accountPage.get().locator(`[data-testid="nc-app-settings"]`); |
||||
} |
||||
|
||||
getInviteOnlyCheckbox() { |
||||
return this.get().locator(`.nc-invite-only-signup-checkbox`); |
||||
} |
||||
|
||||
async checkInviteOnlySignupCheckbox(value: boolean) { |
||||
return expect(await this.get().locator(`.nc-invite-only-signup-checkbox`).isChecked()).toBe(value); |
||||
} |
||||
|
||||
async toggleInviteOnlyCheckbox() { |
||||
await this.getInviteOnlyCheckbox().click(); |
||||
await this.verifyToast({ message: 'Settings saved successfully' }); |
||||
} |
||||
} |
@ -1,139 +1,24 @@
|
||||
import { test } from '@playwright/test' |
||||
import { AccountPage } from '../pages/Account' |
||||
import { AccountTokenPage } from '../pages/Account/Token' |
||||
import { AccountUsersPage } from '../pages/Account/Users' |
||||
import setup from '../setup' |
||||
|
||||
const roleDb = [ |
||||
{ email: 'creator@nocodb.com', role: 'Organization level creator', url: '' }, |
||||
{ email: 'viewer@nocodb.com', role: 'Organization level viewer', url: '' }, |
||||
] |
||||
import { test } from '@playwright/test'; |
||||
import { AccountPage } from '../pages/Account'; |
||||
import { AccountTokenPage } from '../pages/Account/Token'; |
||||
import setup from '../setup'; |
||||
|
||||
test.describe('User roles', () => { |
||||
// let dashboard: DashboardPage;
|
||||
// let settings: SettingsPage;
|
||||
// let signupPage: SignupPage;
|
||||
let accountTokenPage: AccountTokenPage |
||||
let accountPage: AccountPage |
||||
let context: any |
||||
let accountTokenPage: AccountTokenPage; |
||||
let accountPage: AccountPage; |
||||
// @ts-ignore
|
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page }) |
||||
accountPage = new AccountPage(page) |
||||
accountTokenPage = new AccountTokenPage(accountPage) |
||||
}) |
||||
|
||||
test('Invite user', async () => { |
||||
test.slow() |
||||
|
||||
await accountTokenPage.goto() |
||||
|
||||
await accountTokenPage.createToken({description: 'test token'}) |
||||
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// roleDb[i].url = await accountTokenPage.invite({
|
||||
// email: roleDb[i].email,
|
||||
// role: roleDb[i].role,
|
||||
// });
|
||||
// await accountTokenPage.closeInvite();
|
||||
// }
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// await accountTokenPage.getUserRow({
|
||||
// email: roleDb[i].email,
|
||||
// })
|
||||
// }
|
||||
|
||||
// close 'Team & Auth' tab
|
||||
// await dashboard.gotoSettings();
|
||||
// await settings.selectTab({ tab: SettingTab.TeamAuth });
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// roleDb[i].url = await settings.teams.invite({
|
||||
// email: roleDb[i].email,
|
||||
// role: roleDb[i].role,
|
||||
// });
|
||||
// await settings.teams.closeInvite();
|
||||
// }
|
||||
// await settings.close();
|
||||
//
|
||||
// // configure access control
|
||||
// await dashboard.gotoSettings();
|
||||
// await settings.selectTab({
|
||||
// tab: SettingTab.ProjectMetadata,
|
||||
// subTab: SettingsSubTab.ACL,
|
||||
// });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'editor' });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'commenter' });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'viewer' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'editor' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'commenter' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'viewer' });
|
||||
// await settings.acl.save();
|
||||
// await settings.close();
|
||||
//
|
||||
// // Role test
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// await roleTest(i);
|
||||
// }
|
||||
}) |
||||
//
|
||||
// async function roleTest(roleIdx: number) {
|
||||
// await roleSignup(roleIdx);
|
||||
// await dashboard.validateProjectMenu({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.treeView.openTable({ title: 'Country' });
|
||||
//
|
||||
// await dashboard.viewSidebar.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.toolbar.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.treeView.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.openExpandedRow({ index: 0 });
|
||||
// await dashboard.expandedForm.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// // Access control validation
|
||||
// await dashboard.treeView.verifyTable({
|
||||
// title: 'Language',
|
||||
// exists: roleDb[roleIdx].role === 'creator' ? true : false,
|
||||
// });
|
||||
// await dashboard.treeView.verifyTable({
|
||||
// title: 'CustomerList',
|
||||
// exists: roleDb[roleIdx].role === 'creator' ? true : false,
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// async function roleSignup(roleIdx: number) {
|
||||
// await dashboard.signOut();
|
||||
//
|
||||
// await dashboard.rootPage.goto(roleDb[roleIdx].url);
|
||||
// await signupPage.signUp({
|
||||
// email: roleDb[roleIdx].email,
|
||||
// password: 'Password123.',
|
||||
// });
|
||||
//
|
||||
// await projectsPage.openProject({
|
||||
// title: context.project.title,
|
||||
// waitForAuthTab: roleDb[roleIdx].role === 'creator',
|
||||
// withoutPrefix: true,
|
||||
// });
|
||||
//
|
||||
// // close 'Team & Auth' tab
|
||||
// if (roleDb[roleIdx].role === 'creator') {
|
||||
// await dashboard.closeTab({ title: 'Team & Auth' });
|
||||
// }
|
||||
// }
|
||||
}) |
||||
context = await setup({ page }); |
||||
accountPage = new AccountPage(page); |
||||
accountTokenPage = new AccountTokenPage(accountPage); |
||||
}); |
||||
|
||||
test('Create and Delete token', async () => { |
||||
test.slow(); |
||||
await accountTokenPage.goto(); |
||||
await accountTokenPage.createToken({ description: 'test token' }); |
||||
await accountTokenPage.deleteToken({ description: 'test token' }); |
||||
}); |
||||
}); |
||||
|
@ -1,137 +1,28 @@
|
||||
import { test } from '@playwright/test' |
||||
import { AccountPage } from '../pages/Account' |
||||
import { AccountUsersPage } from '../pages/Account/Users' |
||||
import setup from '../setup' |
||||
import { test } from '@playwright/test'; |
||||
import { AccountPage } from '../pages/Account'; |
||||
import { AccountSettingsPage } from '../pages/Account/Settings'; |
||||
import setup from '../setup'; |
||||
|
||||
const roleDb = [ |
||||
{ email: 'creator@nocodb.com', role: 'Organization level creator', url: '' }, |
||||
{ email: 'viewer@nocodb.com', role: 'Organization level viewer', url: '' }, |
||||
] |
||||
|
||||
test.describe('User roles', () => { |
||||
// let dashboard: DashboardPage;
|
||||
// let settings: SettingsPage;
|
||||
// let signupPage: SignupPage;
|
||||
let accountUsersPage: AccountUsersPage |
||||
let accountPage: AccountPage |
||||
let context: any |
||||
test.describe('App settings', () => { |
||||
let accountSettingsPage: AccountSettingsPage; |
||||
let accountPage: AccountPage; |
||||
// @ts-ignore
|
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page }) |
||||
accountPage = new AccountPage(page) |
||||
accountUsersPage = new AccountUsersPage(accountPage) |
||||
}) |
||||
|
||||
test('Invite user', async () => { |
||||
test.slow() |
||||
|
||||
await accountUsersPage.goto() |
||||
|
||||
for (let i = 0; i < roleDb.length; i++) { |
||||
roleDb[i].url = await accountUsersPage.invite({ |
||||
email: roleDb[i].email, |
||||
role: roleDb[i].role, |
||||
}); |
||||
await accountUsersPage.closeInvite(); |
||||
} |
||||
for (let i = 0; i < roleDb.length; i++) { |
||||
await accountUsersPage.getUserRow({ |
||||
email: roleDb[i].email, |
||||
|
||||
}) |
||||
} |
||||
|
||||
// close 'Team & Auth' tab
|
||||
// await dashboard.gotoSettings();
|
||||
// await settings.selectTab({ tab: SettingTab.TeamAuth });
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// roleDb[i].url = await settings.teams.invite({
|
||||
// email: roleDb[i].email,
|
||||
// role: roleDb[i].role,
|
||||
// });
|
||||
// await settings.teams.closeInvite();
|
||||
// }
|
||||
// await settings.close();
|
||||
//
|
||||
// // configure access control
|
||||
// await dashboard.gotoSettings();
|
||||
// await settings.selectTab({
|
||||
// tab: SettingTab.ProjectMetadata,
|
||||
// subTab: SettingsSubTab.ACL,
|
||||
// });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'editor' });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'commenter' });
|
||||
// await settings.acl.toggle({ table: 'Language', role: 'viewer' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'editor' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'commenter' });
|
||||
// await settings.acl.toggle({ table: 'CustomerList', role: 'viewer' });
|
||||
// await settings.acl.save();
|
||||
// await settings.close();
|
||||
//
|
||||
// // Role test
|
||||
// for (let i = 0; i < roleDb.length; i++) {
|
||||
// await roleTest(i);
|
||||
// }
|
||||
}) |
||||
//
|
||||
// async function roleTest(roleIdx: number) {
|
||||
// await roleSignup(roleIdx);
|
||||
// await dashboard.validateProjectMenu({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.treeView.openTable({ title: 'Country' });
|
||||
//
|
||||
// await dashboard.viewSidebar.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.toolbar.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.treeView.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// await dashboard.grid.openExpandedRow({ index: 0 });
|
||||
// await dashboard.expandedForm.validateRoleAccess({
|
||||
// role: roleDb[roleIdx].role,
|
||||
// });
|
||||
//
|
||||
// // Access control validation
|
||||
// await dashboard.treeView.verifyTable({
|
||||
// title: 'Language',
|
||||
// exists: roleDb[roleIdx].role === 'creator' ? true : false,
|
||||
// });
|
||||
// await dashboard.treeView.verifyTable({
|
||||
// title: 'CustomerList',
|
||||
// exists: roleDb[roleIdx].role === 'creator' ? true : false,
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// async function roleSignup(roleIdx: number) {
|
||||
// await dashboard.signOut();
|
||||
//
|
||||
// await dashboard.rootPage.goto(roleDb[roleIdx].url);
|
||||
// await signupPage.signUp({
|
||||
// email: roleDb[roleIdx].email,
|
||||
// password: 'Password123.',
|
||||
// });
|
||||
//
|
||||
// await projectsPage.openProject({
|
||||
// title: context.project.title,
|
||||
// waitForAuthTab: roleDb[roleIdx].role === 'creator',
|
||||
// withoutPrefix: true,
|
||||
// });
|
||||
//
|
||||
// // close 'Team & Auth' tab
|
||||
// if (roleDb[roleIdx].role === 'creator') {
|
||||
// await dashboard.closeTab({ title: 'Team & Auth' });
|
||||
// }
|
||||
// }
|
||||
}) |
||||
context = await setup({ page }); |
||||
accountPage = new AccountPage(page); |
||||
accountSettingsPage = new AccountSettingsPage(accountPage); |
||||
}); |
||||
|
||||
test('Toggle invite only signup', async () => { |
||||
test.slow(); |
||||
|
||||
await accountSettingsPage.goto(); |
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(false); |
||||
await accountSettingsPage.toggleInviteOnlyCheckbox(); |
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(true); |
||||
await accountSettingsPage.toggleInviteOnlyCheckbox(); |
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(false); |
||||
}); |
||||
}); |
||||
|
Loading…
Reference in new issue