Browse Source

test: personal view tests

pull/9807/head
Pranav C 2 weeks ago
parent
commit
b18b1e73a5
  1. 111
      tests/playwright/tests/db/general/viewMenu.spec.ts

111
tests/playwright/tests/db/general/viewMenu.spec.ts

@ -2,12 +2,6 @@ import { test } from '@playwright/test';
import { DashboardPage } from '../../../pages/Dashboard'; import { DashboardPage } from '../../../pages/Dashboard';
import setup, { unsetup } from '../../../setup'; import setup, { unsetup } from '../../../setup';
import { isPg } from '../../../setup/db'; import { isPg } from '../../../setup/db';
import { getDefaultPwd } from '../../utils/general';
import { AccountPage } from '../../../pages/Account';
import { SignupPage } from '../../../pages/SignupPage';
import { Api } from 'nocodb-sdk';
import { LoginPage } from '../../../pages/LoginPage';
import { AccountUsersPage } from '../../../pages/Account/Users';
test.describe('Grid view locked', () => { test.describe('Grid view locked', () => {
let dashboard: DashboardPage; let dashboard: DashboardPage;
@ -45,111 +39,6 @@ test.describe('Grid view locked', () => {
await dashboard.grid.verifyCollaborativeMode(); await dashboard.grid.verifyCollaborativeMode();
}); });
test.describe('Personal mode', () => {
const user1 = {
email: 'view-test-user1@nocodb.com',
password: getDefaultPwd(),
role: 'Organization Level Creator',
};
const user2 = {
email: 'view-test-user2@nocodb.com',
password: getDefaultPwd(),
role: 'Organization Level Viewer',
};
const users = [user1, user2];
let loginPage;
let accountPage;
let accountUsersPage;
let api: Api<any>;
test.beforeEach(async ({ page }) => {
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
loginPage = new LoginPage(page);
accountPage = new AccountPage(page);
accountUsersPage = new AccountUsersPage(accountPage);
for (let i = 0; i < users.length; i++) {
try {
await api.auth.signup({
email: loginPage.prefixEmail(users[i].email),
password: users[i].password,
});
} catch (e) {
// ignore error even if user already exists
}
}
});
test.only('Personal mode', async () => {
await accountUsersPage.goto({ waitForResponse: true });
// invite user
for (let i = 0; i < users.length; i++) {
users[i].url = await accountUsersPage.invite({
email: users[i].email,
role: users[i].role,
});
await accountUsersPage.closeInvite();
}
await dashboard.treeView.openTable({ title: 'Country' });
// create a grid view since the default view cannot be marked as personal
await dashboard.viewSidebar.createGridView({ title: 'CountryGrid' });
await dashboard.viewSidebar.verifyView({ title: 'CountryGrid', index: 0 });
await dashboard.grid.verifyCollaborativeMode();
// enable personal view
await dashboard.grid.toolbar.viewsMenu.click({
menu: 'View Mode',
subMenu: 'Personal',
});
await dashboard.treeView.openTable({ title: 'Country' });
// create a grid view since the default view cannot be marked as personal
await dashboard.viewSidebar.createGridView({ title: 'CountryGrid' });
await dashboard.viewSidebar.verifyView({ title: 'CountryGrid', index: 0 });
await dashboard.grid.verifyCollaborativeMode();
// enable personal view
await dashboard.grid.toolbar.viewsMenu.click({
menu: 'View Mode',
subMenu: 'Personal',
});
// verify view lock
// await dashboard.grid.verifyPersonalMode();
await dashboard.signOut();
await loginPage.goto();
await loginPage.signIn({
email: user2.email,
password: user2.password,
});
await dashboard.signOut();
await dashboard.rootPage.goto('/#/signup');
await loginPage.signIn({
email: user1.email,
password: user1.password,
});
// verify view lock
await dashboard.grid.verifyPersonalMode();
});
});
test('Download CSV', async () => { test('Download CSV', async () => {
// close 'Team & Auth' tab // close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });

Loading…
Cancel
Save