Browse Source

Merge pull request #4923 from nocodb/test/enterprise-key

test: enterprise key verification
pull/4925/head
Raju Udava 2 years ago committed by GitHub
parent
commit
1ac5ab333d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .run/test-debug.run.xml
  2. 35
      tests/playwright/pages/Account/License.ts
  3. 3
      tests/playwright/pages/Account/index.ts
  4. 29
      tests/playwright/tests/accountLicense.spec.ts

4
.run/test-debug.run.xml

@ -1,9 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="test-debug" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/scripts/playwright/package.json" />
<package-json value="$PROJECT_DIR$/tests/playwright/package.json" />
<command value="run" />
<scripts>
<script value="test-debug" />
<script value="test:debug" />
</scripts>
<node-interpreter value="project" />
<envs />

35
tests/playwright/pages/Account/License.ts

@ -0,0 +1,35 @@
import BasePage from '../Base';
import { AccountPage } from './index';
export class AccountLicensePage extends BasePage {
private accountPage: AccountPage;
constructor(accountPage: AccountPage) {
super(accountPage.rootPage);
this.accountPage = accountPage;
}
async goto() {
await this.rootPage.goto('/#/account/license', { waitUntil: 'networkidle' });
}
async waitUntilContentLoads() {
return this.rootPage.waitForResponse(resp => resp.url().includes('api/v1/license') && resp.status() === 200);
}
// License TextBox
get() {
return this.accountPage.get().locator(`textarea[placeholder="License key"]`);
}
// Save button
getSaveButton() {
return this.accountPage.get().locator(`button.ant-btn-primary:has-text("Save license key")`);
}
async saveLicenseKey(licenseKey: string) {
await this.get().fill(licenseKey);
await this.getSaveButton().click();
await this.verifyToast({ message: 'License key updated' });
}
}

3
tests/playwright/pages/Account/index.ts

@ -4,12 +4,14 @@ import { AccountSettingsPage } from './Settings';
import { AccountTokenPage } from './Token';
import { AccountUsersPage } from './Users';
import { AccountAppStorePage } from './AppStore';
import { AccountLicensePage } from './License';
export class AccountPage extends BasePage {
readonly settings: AccountSettingsPage;
readonly token: AccountTokenPage;
readonly users: AccountUsersPage;
readonly appStore: AccountAppStorePage;
readonly license: AccountLicensePage;
constructor(page: Page) {
super(page);
@ -17,6 +19,7 @@ export class AccountPage extends BasePage {
this.token = new AccountTokenPage(this);
this.users = new AccountUsersPage(this);
this.appStore = new AccountAppStorePage(this);
this.license = new AccountLicensePage(this);
}
get() {

29
tests/playwright/tests/accountLicense.spec.ts

@ -0,0 +1,29 @@
import { test } from '@playwright/test';
import { AccountPage } from '../pages/Account';
import setup from '../setup';
import { AccountLicensePage } from '../pages/Account/License';
import { DashboardPage } from '../pages/Dashboard';
test.describe('Enterprise License', () => {
// @ts-ignore
let dashboard: DashboardPage;
// @ts-ignore
let accountLicensePage: AccountLicensePage, accountPage: AccountPage, context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
accountPage = new AccountPage(page);
accountLicensePage = new AccountLicensePage(accountPage);
dashboard = new DashboardPage(page, context.project);
});
test('Update license key & verify if enterprise features enabled', async () => {
test.slow();
await accountLicensePage.goto();
await accountLicensePage.saveLicenseKey('1234567890');
await dashboard.goto();
// presence of snowflake icon indicates enterprise features are enabled
await dashboard.treeView.quickImport({ title: 'Snowflake' });
});
});
Loading…
Cancel
Save