Browse Source

test: enterprise key verification

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/4923/head
Raju Udava 2 years ago
parent
commit
21756b2db3
  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"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="test-debug" type="js.build_tools.npm"> <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" /> <command value="run" />
<scripts> <scripts>
<script value="test-debug" /> <script value="test:debug" />
</scripts> </scripts>
<node-interpreter value="project" /> <node-interpreter value="project" />
<envs /> <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 { AccountTokenPage } from './Token';
import { AccountUsersPage } from './Users'; import { AccountUsersPage } from './Users';
import { AccountAppStorePage } from './AppStore'; import { AccountAppStorePage } from './AppStore';
import { AccountLicensePage } from './License';
export class AccountPage extends BasePage { export class AccountPage extends BasePage {
readonly settings: AccountSettingsPage; readonly settings: AccountSettingsPage;
readonly token: AccountTokenPage; readonly token: AccountTokenPage;
readonly users: AccountUsersPage; readonly users: AccountUsersPage;
readonly appStore: AccountAppStorePage; readonly appStore: AccountAppStorePage;
readonly license: AccountLicensePage;
constructor(page: Page) { constructor(page: Page) {
super(page); super(page);
@ -17,6 +19,7 @@ export class AccountPage extends BasePage {
this.token = new AccountTokenPage(this); this.token = new AccountTokenPage(this);
this.users = new AccountUsersPage(this); this.users = new AccountUsersPage(this);
this.appStore = new AccountAppStorePage(this); this.appStore = new AccountAppStorePage(this);
this.license = new AccountLicensePage(this);
} }
get() { 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