Browse Source

cleanup

pull/5114/head
Daniel Spaude 2 years ago
parent
commit
5d0af4011b
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 176
      tests/playwright/pages/Dashboard/FindRowByScanOverlay/index.ts
  2. 4
      tests/playwright/pages/Dashboard/TreeView.ts
  3. 6
      tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts
  4. 7
      tests/playwright/pages/Dashboard/index.ts

176
tests/playwright/pages/Dashboard/FindRowByScanOverlay/index.ts

@ -1,4 +1,4 @@
import { expect, Locator } from '@playwright/test';
import { Locator } from '@playwright/test';
import BasePage from '../../Base';
import { DashboardPage } from '..';
import { ToolbarPage } from '../common/Toolbar';
@ -31,178 +31,4 @@ export class FindRowByScanOverlay extends BasePage {
await this.selectColumnDropdown.click();
await this.selectColumnDropdown.selectOption({ label: columnName });
}
// async create({ title, event, url = 'http://localhost:9090/hook' }: { title: string; event: string; url?: string }) {
// await this.toolbar.clickActions();
// await this.toolbar.actions.click('Webhooks');
// await this.addNewButton.click();
// await this.get().waitFor({ state: 'visible' });
// await this.configureHeader({
// key: 'Content-Type',
// value: 'application/json',
// });
// await this.configureWebhook({ title, event, url });
// await this.save();
// await this.close();
// }
// async configureWebhook({ title, event, url }: { title?: string; event?: string; url?: string }) {
// if (title) {
// await this.get().locator(`.nc-text-field-hook-title`).fill(title);
// }
// if (event) {
// await this.get().locator(`.nc-text-field-hook-event`).click();
// const modal = this.rootPage.locator(`.nc-dropdown-webhook-event`);
// await modal.locator(`.ant-select-item:has-text("${event}")`).click();
// }
// if (url) {
// await this.get().locator(`.nc-text-field-hook-url-path`).fill(url);
// }
// }
// async addCondition({
// column,
// operator,
// value,
// save,
// }: {
// column: string;
// operator: string;
// value: string;
// save: boolean;
// }) {
// await this.get().locator(`.nc-check-box-hook-condition`).click();
// const modal = await this.get().locator(`.menu-filter-dropdown`).last();
// // todo: All delays are for api calls that filter does, which rerenders
// await this.rootPage.waitForTimeout(1000);
// await modal.locator(`button:has-text("Add Filter")`).click();
// await this.rootPage.waitForTimeout(1500);
// await modal.locator('.nc-filter-field-select').click();
// const modalField = await this.dashboard.rootPage.locator('.nc-dropdown-toolbar-field-list:visible');
// await modalField.locator(`.ant-select-item:has-text("${column}")`).click();
// await this.rootPage.waitForTimeout(1500);
// await modal.locator('.nc-filter-operation-select').click();
// const modalOp = await this.dashboard.rootPage.locator('.nc-dropdown-filter-comp-op:visible');
// await modalOp.locator(`.ant-select-item:has-text("${operator}")`).click();
// await this.rootPage.waitForTimeout(1500);
// if (operator != 'is null' && operator != 'is not null') {
// await modal.locator('.nc-filter-value-select > input').fill(value);
// }
// if (save) {
// await this.save();
// await this.close();
// }
// }
// async deleteCondition(p: { save: boolean }) {
// await this.get().locator(`.nc-filter-item-remove-btn`).click();
// if (p.save) {
// await this.save();
// await this.close();
// }
// }
// async save() {
// const saveAction = () => this.saveButton.click();
// await this.waitForResponse({
// uiAction: saveAction,
// requestUrlPathToMatch: '/hooks',
// httpMethodsToMatch: ['POST', 'PATCH'],
// });
// await this.verifyToast({ message: 'Webhook details updated successfully' });
// }
// async test() {
// await this.testButton.click();
// await this.verifyToast({ message: 'Webhook tested successfully' });
// }
// async delete({ index }: { index: number }) {
// await this.toolbar.clickActions();
// await this.toolbar.actions.click('Webhooks');
// await this.get().locator(`.nc-hook-delete-icon`).nth(index).click();
// await this.verifyToast({ message: 'Hook deleted successfully' });
// // click escape to close the drawer
// await this.get().press('Escape');
// }
// async close() {
// // type esc key
// await this.get().press('Escape');
// }
// async open({ index }: { index: number }) {
// await this.toolbar.clickActions();
// await this.toolbar.actions.click('Webhooks');
// await this.dashboard.get().locator(`.nc-hook`).nth(index).click();
// }
// async openForm({ index }: { index: number }) {
// await this.dashboard.get().locator(`.nc-hook`).nth(index).click();
// }
// async click({ index }: { index: number }) {
// await this.dashboard.get().locator(`.nc-hook`).nth(index).click();
// }
// async configureHeader({ key, value }: { key: string; value: string }) {
// // hardcode "Content-type: application/json"
// await this.get().locator(`.ant-tabs-tab-btn:has-text("Headers")`).click();
// await this.get().locator('.nc-input-hook-header-key >> input').fill(key);
// await this.rootPage.locator(`.ant-select-item:has-text("${key}")`).click();
// await this.get().locator('.nc-input-hook-header-value').type(value);
// await this.get().press('Enter');
// await this.get().locator('.nc-hook-header-tab-checkbox').locator('input.ant-checkbox-input').click();
// }
// async verifyForm({
// title,
// hookEvent,
// url,
// notificationType,
// urlMethod,
// condition,
// }: {
// title: string;
// hookEvent: string;
// url: string;
// notificationType: string;
// urlMethod: string;
// condition: boolean;
// }) {
// await expect.poll(async () => await this.get().locator('input.nc-text-field-hook-title').inputValue()).toBe(title);
// await expect(this.get().locator('.nc-text-field-hook-event >> .ant-select-selection-item')).toHaveText(hookEvent);
// await expect(this.get().locator('.nc-select-hook-notification-type >> .ant-select-selection-item')).toHaveText(
// notificationType
// );
// await expect(this.get().locator('.nc-select-hook-url-method >> .ant-select-selection-item')).toHaveText(urlMethod);
// await expect.poll(async () => await this.get().locator('input.nc-text-field-hook-url-path').inputValue()).toBe(url);
// const conditionCheckbox = this.get().locator('label.nc-check-box-hook-condition >> input[type="checkbox"]');
// if (condition) {
// await expect(conditionCheckbox).toBeChecked();
// } else {
// await expect(conditionCheckbox).not.toBeChecked();
// }
// }
// async goBackFromForm() {
// await this.get().locator('svg.nc-icon-hook-navigate-left').click();
// }
}

4
tests/playwright/pages/Dashboard/TreeView.ts

@ -22,10 +22,6 @@ export class TreeViewPage extends BasePage {
return await this.get().isVisible();
}
// async isInViewport() {
// return await this.get().isIntersectingViewport();
// }
async verifyVisibility({ isVisible }: { isVisible: boolean }) {
if (isVisible) {
await expect(this.get()).toBeVisible();

6
tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts

@ -14,12 +14,6 @@ export class ToolbarFieldsPage extends BasePage {
return this.rootPage.locator(`[data-testid="nc-fields-menu"]`);
}
// async verifyVisibleWithIconAndText() {
// await expect(this.get()).toBeVisible();
// await expect(this.get().locator(`button`)).toBeVisible();
// await expect(this.get().locator(`button`).locator(`svg`)).toBeVisible();
// }
// todo: Click and toggle are similar method. Remove one of them
async toggle({ title, isLocallySaved }: { title: string; isLocallySaved?: boolean }) {
await this.toolbar.clickFields();

7
tests/playwright/pages/Dashboard/index.ts

@ -89,15 +89,11 @@ export class DashboardPage extends BasePage {
async gotoSettings() {
await this.rootPage.getByTestId('nc-project-menu').click();
await this.rootPage.locator('div.nc-project-menu-item:has-text(" Team & Settings")').click();
// await this.projectMenuLink.click();
// await this.getProjectMenuLink({ title: ' Team & Settings' }).click();
}
async gotoProjectSubMenu({ title }: { title: string }) {
await this.rootPage.getByTestId('nc-project-menu').click();
await this.rootPage.locator(`div.nc-project-menu-item:has-text("${title}")`).click();
// await this.projectMenuLink.click();
// await this.getProjectMenuLink({ title }).click();
}
async verifyInTabBar({ title }: { title: string }) {
@ -163,9 +159,6 @@ export class DashboardPage extends BasePage {
const projMenu = this.rootPage.locator('.nc-dropdown-project-menu');
await projMenu.locator('[data-menu-id="mobile-mode"]:visible').click();
await this.projectMenuLink.click();
// await this.rootPage.locator('div.nc-project-menu-item:has-text("Sign Out"):visible').click();
// await this.rootPage.locator('[data-testid="nc-form-signin"]:visible').waitFor();
// await new Promise(resolve => setTimeout(resolve, 150));
}
async signOut() {

Loading…
Cancel
Save