mirror of https://github.com/nocodb/nocodb
Pranav C
3 months ago
6 changed files with 126 additions and 24 deletions
@ -0,0 +1,39 @@
|
||||
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('/#/account/setup'); |
||||
await this.rootPage.locator(`[data-test-id="nc-setup"]`).waitForElementState('visible'); |
||||
} |
||||
|
||||
get() { |
||||
return this.accountPage.get().locator(`[data-test-id="nc-setup"]`); |
||||
} |
||||
|
||||
openEmailSettings() {} |
||||
|
||||
async getInviteOnlyCheckboxValue() { |
||||
// allow time for the checkbox to be rendered
|
||||
await this.rootPage.waitForTimeout(1000); |
||||
|
||||
return this.get().locator(`.nc-invite-only-signup-checkbox`).isChecked({ timeout: 1000 }); |
||||
} |
||||
|
||||
async checkInviteOnlySignupCheckbox(value: boolean) { |
||||
return expect(await this.getInviteOnlyCheckboxValue()).toBe(value); |
||||
} |
||||
|
||||
async toggleInviteOnlyCheckbox() { |
||||
await this.getInviteOnlyCheckbox().click(); |
||||
await this.verifyToast({ message: 'Settings saved successfully' }); |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
import { test } from '@playwright/test'; |
||||
import { AccountPage } from '../../../pages/Account'; |
||||
import { AccountSettingsPage } from '../../../pages/Account/Settings'; |
||||
import { SignupPage } from '../../../pages/SignupPage'; |
||||
import setup, { unsetup } from '../../../setup'; |
||||
import { getDefaultPwd } from '../../../tests/utils/general'; |
||||
|
||||
test.describe.skip('App setup', () => { |
||||
// hub will not have this feature
|
||||
|
||||
let accountSettingsPage: AccountSettingsPage; |
||||
let accountPage: AccountPage; |
||||
// @ts-ignore
|
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page, isEmptyProject: true }); |
||||
accountPage = new AccountPage(page); |
||||
accountSettingsPage = accountPage.settings; |
||||
}); |
||||
|
||||
test.afterEach(async () => { |
||||
await unsetup(context); |
||||
}); |
||||
|
||||
test('Toggle invite only signup', async () => { |
||||
test.slow(); |
||||
|
||||
await accountSettingsPage.goto({ networkValidation: false }); |
||||
|
||||
// enable invite only signup
|
||||
if (!(await accountSettingsPage.getInviteOnlyCheckboxValue())) { |
||||
await accountSettingsPage.toggleInviteOnlyCheckbox(); |
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(true); |
||||
} |
||||
|
||||
await accountPage.signOut(); |
||||
|
||||
const signupPage = new SignupPage(accountPage.rootPage); |
||||
await signupPage.goto(); |
||||
|
||||
await signupPage.signUp({ |
||||
email: 'test-user-1@nocodb.com', |
||||
password: getDefaultPwd(), |
||||
expectedError: 'Not allowed to signup, contact super admin.', |
||||
}); |
||||
|
||||
await signupPage.rootPage.reload({ waitUntil: 'load' }); |
||||
|
||||
await accountSettingsPage.goto({ networkValidation: false }); |
||||
|
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(true); |
||||
await accountSettingsPage.toggleInviteOnlyCheckbox(); |
||||
await accountSettingsPage.checkInviteOnlySignupCheckbox(false); |
||||
|
||||
await accountPage.signOut(); |
||||
|
||||
await signupPage.goto(); |
||||
|
||||
await signupPage.signUp({ |
||||
email: 'test-user-1@nocodb.com', |
||||
password: getDefaultPwd(), |
||||
}); |
||||
}); |
||||
}); |
Loading…
Reference in new issue