Browse Source

test: app-store removed from project settings

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/4861/head
Raju Udava 2 years ago committed by Pranav C
parent
commit
75cab2eaf9
  1. 30
      tests/playwright/pages/Account/AppStore.ts
  2. 3
      tests/playwright/pages/Account/index.ts
  3. 4
      tests/playwright/pages/Dashboard/Settings/index.ts
  4. 35
      tests/playwright/tests/viewForm.spec.ts

30
tests/playwright/pages/Dashboard/Settings/AppStore.ts → tests/playwright/pages/Account/AppStore.ts

@ -1,21 +1,31 @@
import { expect } from '@playwright/test';
import { SettingsPage } from '.';
import BasePage from '../../Base';
import BasePage from '../Base';
import { AccountPage } from './index';
export class AppStoreSettingsPage extends BasePage {
private readonly settings: SettingsPage;
export class AccountAppStorePage extends BasePage {
private accountPage: AccountPage;
constructor(settings: SettingsPage) {
super(settings.rootPage);
this.settings = settings;
constructor(accountPage: AccountPage) {
super(accountPage.rootPage);
this.accountPage = accountPage;
}
async goto() {
await this.rootPage.goto('/#/account/apps', { waitUntil: 'networkidle' });
}
async waitUntilContentLoads() {
return this.rootPage.waitForResponse(
resp => resp.url().includes('api/v1/db/meta/plugins') && resp.status() === 200
);
}
get() {
return this.settings.get().locator(`[data-testid="nc-settings-subtab-appStore"]`);
return this.accountPage.get().locator(`[data-testid="nc-settings-subtab-appStore"]`);
}
async install({ name }: { name: string }) {
const card = await this.settings.get().locator(`.nc-app-store-card-${name}`);
const card = await this.accountPage.get().locator(`.nc-app-store-card-${name}`);
await card.click();
// todo: Hack to solve the issue when if the test installing a plugin fails, the next test will fail because the plugin is already installed
@ -48,7 +58,7 @@ export class AppStoreSettingsPage extends BasePage {
}
async uninstall(param: { name: string }) {
const card = this.settings.get().locator(`.nc-app-store-card-${param.name}`);
const card = this.accountPage.get().locator(`.nc-app-store-card-${param.name}`);
// await card.scrollIntoViewIfNeeded();
await card.click();

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

@ -3,17 +3,20 @@ import BasePage from '../Base';
import { AccountSettingsPage } from './Settings';
import { AccountTokenPage } from './Token';
import { AccountUsersPage } from './Users';
import { AccountAppStorePage } from './AppStore';
export class AccountPage extends BasePage {
readonly settings: AccountSettingsPage;
readonly token: AccountTokenPage;
readonly users: AccountUsersPage;
readonly appStore: AccountAppStorePage;
constructor(page: Page) {
super(page);
this.settings = new AccountSettingsPage(this);
this.token = new AccountTokenPage(this);
this.users = new AccountUsersPage(this);
this.appStore = new AccountAppStorePage(this);
}
get() {

4
tests/playwright/pages/Dashboard/Settings/index.ts

@ -1,14 +1,12 @@
import { DashboardPage } from '..';
import BasePage from '../../Base';
import { AuditSettingsPage } from './Audit';
import { AppStoreSettingsPage } from './AppStore';
import { MiscSettingsPage } from './Miscellaneous';
import { TeamsPage } from './Teams';
import { DataSourcesPage } from './DataSources';
export enum SettingTab {
TeamAuth = 'teamAndAuth',
AppStore = 'appStore',
DataSources = 'dataSources',
Audit = 'audit',
ProjectSettings = 'projectSettings',
@ -22,7 +20,6 @@ export enum SettingsSubTab {
export class SettingsPage extends BasePage {
readonly audit: AuditSettingsPage;
readonly appStore: AppStoreSettingsPage;
readonly miscellaneous: MiscSettingsPage;
readonly dataSources: DataSourcesPage;
readonly teams: TeamsPage;
@ -30,7 +27,6 @@ export class SettingsPage extends BasePage {
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.audit = new AuditSettingsPage(this);
this.appStore = new AppStoreSettingsPage(this);
this.miscellaneous = new MiscSettingsPage(this);
this.dataSources = new DataSourcesPage(this);
this.teams = new TeamsPage(this);

35
tests/playwright/tests/viewForm.spec.ts

@ -1,20 +1,25 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { SettingTab } from '../pages/Dashboard/Settings';
import setup from '../setup';
import { FormPage } from '../pages/Dashboard/Form';
import { SharedFormPage } from '../pages/SharedForm';
import { AccountPage } from '../pages/Account';
import { AccountAppStorePage } from '../pages/Account/AppStore';
// todo: Move most of the ui actions to page object and await on the api response
test.describe('Form view', () => {
let dashboard: DashboardPage;
let form: FormPage;
let accountAppStorePage: AccountAppStorePage;
let accountPage: AccountPage;
let context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
form = dashboard.form;
accountPage = new AccountPage(page);
accountAppStorePage = accountPage.appStore;
});
test('Field re-order operations', async () => {
@ -78,7 +83,7 @@ test.describe('Form view', () => {
});
});
test('Form elements validation', async () => {
test('Form elements validation', async ({ page }) => {
// close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Country' });
@ -168,12 +173,16 @@ test.describe('Form view', () => {
await dashboard.verifyToast({
message: 'Please activate SMTP plugin in App store for enabling email notification',
});
const url = dashboard.rootPage.url();
// activate SMTP plugin
await dashboard.gotoSettings();
await dashboard.settings.selectTab({ tab: SettingTab.AppStore });
await dashboard.settings.appStore.install({ name: 'SMTP' });
await dashboard.settings.appStore.configureSMTP({
await accountAppStorePage.goto();
await accountAppStorePage.rootPage.reload({ waitUntil: 'networkidle' });
await accountAppStorePage.waitUntilContentLoads();
// install SMTP
await accountAppStorePage.install({ name: 'SMTP' });
await accountAppStorePage.configureSMTP({
email: 'a@b.com',
host: 'smtp.gmail.com',
port: '587',
@ -181,7 +190,9 @@ test.describe('Form view', () => {
await dashboard.verifyToast({
message: 'Successfully installed and email notification will use SMTP configuration',
});
await dashboard.settings.close();
// revisit form view
await page.goto(url);
// enable 'email-me' option
await dashboard.viewSidebar.openView({ title: 'CountryForm' });
@ -192,15 +203,15 @@ test.describe('Form view', () => {
showBlankForm: false,
});
// reset SMTP
await dashboard.gotoSettings();
await dashboard.settings.selectTab({ tab: SettingTab.AppStore });
await dashboard.settings.appStore.uninstall({ name: 'SMTP' });
// Uninstall SMTP
await accountAppStorePage.goto();
await accountAppStorePage.rootPage.reload({ waitUntil: 'networkidle' });
await accountAppStorePage.waitUntilContentLoads();
await accountAppStorePage.uninstall({ name: 'SMTP' });
await dashboard.verifyToast({
message: 'Plugin uninstalled successfully',
});
await dashboard.settings.close();
});
test('Form share, verify attachment file', async () => {

Loading…
Cancel
Save