Browse Source

work on geo data column tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
209c5967a2
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 29
      tests/playwright/pages/Dashboard/ViewSidebar/index.ts
  2. 15
      tests/playwright/pages/Dashboard/common/Cell/GeoDataCell.ts
  3. 44
      tests/playwright/tests/columnGeoData.spec.ts

29
tests/playwright/pages/Dashboard/ViewSidebar/index.ts

@ -40,35 +40,6 @@ export class ViewSidebarPage extends BasePage {
window.localStorage.setItem('geodataToggleState', 'true'); window.localStorage.setItem('geodataToggleState', 'true');
}); });
await this.rootPage.goto(this.rootPage.url()); await this.rootPage.goto(this.rootPage.url());
// await this.rootPage.pause();
// await this.rootPage.pause();
// const toggleViewSidebarButton = await this.rootPage.$('.nc-toggle-right-navbar');
// if (!(await this.get().isVisible())) {
// // await this.get().click();
// await toggleViewSidebarButton.click();
// }
// // await this.rootPage.pause();
// // await this.verifyVisibility({ isVisible: true });
// // await this.rootPage.pause();
// // const element = await this.rootPage.$('.nc-active-btn');
// const { x, y } = await toggleViewSidebarButton.boundingBox();
// // Click the element 5 times in a row
// for (let i = 0; i < 5; i++) {
// await this.rootPage.mouse.click(x + 10, y);
// }
// await this.rootPage.pause();
// if (!(await this.get().isVisible())) {
// // await this.get().click();
// await toggleViewSidebarButton.click();
// }
// await this.rootPage.pause();
// // await this.verifyVisibility({ isVisible: true });
// await this.rootPage.pause();
// await this.rootPage.getByTestId('toggle-geodata-feature-icon').click();
} }
private async createView({ title, locator }: { title: string; locator: Locator }) { private async createView({ title, locator }: { title: string; locator: Locator }) {

15
tests/playwright/pages/Dashboard/common/Cell/GeoDataCell.ts

@ -14,13 +14,7 @@ export class GeoDataCellPageObject extends BasePage {
} }
async open({ index, columnHeader }: { index: number; columnHeader: string }) { async open({ index, columnHeader }: { index: number; columnHeader: string }) {
// await this.rootPage.pause();
await this.cell.get({ index, columnHeader }).locator(`[data-testid="nc-geo-data-set-location-button"]`).click(); await this.cell.get({ index, columnHeader }).locator(`[data-testid="nc-geo-data-set-location-button"]`).click();
// await this.rootPage.pause();
// .dblclick({
// index,
// columnHeader,
// });
} }
async enterLatLong({ lat, long }: { lat: string; long: string }) { async enterLatLong({ lat, long }: { lat: string; long: string }) {
@ -32,15 +26,6 @@ export class GeoDataCellPageObject extends BasePage {
await this.rootPage.locator(`[data-testid="nc-geo-data-save"]`).click(); await this.rootPage.locator(`[data-testid="nc-geo-data-save"]`).click();
} }
async selectDate({
// date in format `YYYY-MM-DD`
date,
}: {
date: string;
}) {
await this.rootPage.locator(`td[title="${date}"]`).click();
}
async close() { async close() {
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
} }

44
tests/playwright/tests/columnGeoData.spec.ts

@ -1,14 +1,9 @@
import { expect, test } from '@playwright/test'; import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard'; import { DashboardPage } from '../pages/Dashboard';
import setup from '../setup'; import setup from '../setup';
import { GridPage } from '../pages/Dashboard/Grid'; import { GridPage } from '../pages/Dashboard/Grid';
type ExpectedQrCodeData = { test.describe('Geo Data column', () => {
referencedValue: string;
base64EncodedSrc: string;
};
test.describe.only('Geo Data column', () => {
let dashboard: DashboardPage; let dashboard: DashboardPage;
let grid: GridPage; let grid: GridPage;
let context: any; let context: any;
@ -19,13 +14,7 @@ test.describe.only('Geo Data column', () => {
grid = dashboard.grid; grid = dashboard.grid;
}); });
test('creation, validation, use "My Location" and deleting geo data column', async () => { test('creation, validation and deleting geo data column', async () => {
// Write Playwright test that tests the following for the Geo Data column:
// - creation
// - validation
// - use "My Location"
// - deleting geo data column
// close 'Team & Auth' tab // close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
@ -38,10 +27,8 @@ test.describe.only('Geo Data column', () => {
type: 'GeoData', type: 'GeoData',
}); });
// await grid.rootPage.pause();
await grid.column.verify({ title: 'GeoData1', isVisible: true }); await grid.column.verify({ title: 'GeoData1', isVisible: true });
// await dashboard.grid.cell.attachment.addFile({
await grid.cell.geoData.open({ await grid.cell.geoData.open({
index: 0, index: 0,
columnHeader: 'GeoData1', columnHeader: 'GeoData1',
@ -59,34 +46,9 @@ test.describe.only('Geo Data column', () => {
long: '30.5234000', long: '30.5234000',
}); });
// await grid.rootPage.pause();
// await dashboard.grid.cell.attachment.addFile({
// index: i,
// columnHeader: 'testAttach',
// filePath: filepath,
// });
// await dashboard.grid.cell.attachment.verifyFile({
// index: i,
// columnHeader: 'testAttach',
// });
expect(1 + 2).toBe(3);
// await grid.rootPage.pause();
await grid.column.delete({ title: 'GeoData1' }); await grid.column.delete({ title: 'GeoData1' });
await grid.column.verify({ title: 'GeoData1', isVisible: false }); await grid.column.verify({ title: 'GeoData1', isVisible: false });
await dashboard.closeTab({ title: 'City' }); await dashboard.closeTab({ title: 'City' });
// await dashboard.treeView.openTable({ title: 'City' });
// await grid.column.create({
// title: 'Geo Data',
// type: 'Geo Data',
// });
// await grid.column.openEdit({
// title: 'Geo Data',
// type: 'Geo Data',
// });
}); });
}); });

Loading…
Cancel
Save