Browse Source

work on geo data column tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
cb776e9408
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 6
      packages/nc-gui/components/cell/GeoData.vue
  2. 2
      tests/playwright/pages/Dashboard/ViewSidebar/index.ts
  3. 47
      tests/playwright/pages/Dashboard/common/Cell/GeoDataCell.ts
  4. 3
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  5. 29
      tests/playwright/tests/columnGeoData.spec.ts

6
packages/nc-gui/components/cell/GeoData.vue

@ -69,7 +69,7 @@ const onClickSetCurrentLocation = () => {
<template>
<a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" trigger="click">
<a-button>{{ latLongStr }}</a-button>
<a-button data-testid="nc-geo-data-set-location-button">{{ latLongStr }}</a-button>
<template #overlay>
<a-form :model="formState" class="flex flex-col" @finish="handleFinish">
<a-form-item>
@ -77,6 +77,7 @@ const onClickSetCurrentLocation = () => {
<div class="mr-2">{{ $t('labels.lat') }}:</div>
<a-input
v-model:value="formState.latitude"
data-testid="nc-geo-data-latitude"
type="number"
step="0.0000001"
:min="-90"
@ -94,6 +95,7 @@ const onClickSetCurrentLocation = () => {
<div class="mr-2">{{ $t('labels.lng') }}:</div>
<a-input
v-model:value="formState.longitude"
data-testid="nc-geo-data-longitude"
type="number"
step="0.0000001"
required
@ -114,7 +116,7 @@ const onClickSetCurrentLocation = () => {
<a-form-item>
<div class="ml-auto mr-2">
<a-button type="text" @click="clear">{{ $t('general.cancel') }}</a-button>
<a-button type="primary" html-type="submit">{{ $t('general.submit') }}</a-button>
<a-button type="primary" html-type="submit" data-testid="nc-geo-data-save">{{ $t('general.submit') }}</a-button>
</div>
</a-form-item>
</a-form>

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

@ -41,7 +41,7 @@ export class ViewSidebarPage extends BasePage {
});
await this.rootPage.goto(this.rootPage.url());
await this.rootPage.pause();
// await this.rootPage.pause();
// await this.rootPage.pause();
// const toggleViewSidebarButton = await this.rootPage.$('.nc-toggle-right-navbar');

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

@ -0,0 +1,47 @@
import { CellPageObject } from '.';
import BasePage from '../../../Base';
export class GeoDataCellPageObject extends BasePage {
readonly cell: CellPageObject;
constructor(cell: CellPageObject) {
super(cell.rootPage);
this.cell = cell;
}
get({ index, columnHeader }: { index?: number; columnHeader: string }) {
return this.cell.get({ index, columnHeader });
}
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.rootPage.pause();
// .dblclick({
// index,
// columnHeader,
// });
}
async enterLatLong({ lat, long }: { lat: string; long: string }) {
await this.rootPage.locator(`[data-testid="nc-geo-data-latitude"]`).fill(lat);
await this.rootPage.locator(`[data-testid="nc-geo-data-longitude"]`).fill(long);
}
async clickSave() {
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() {
await this.rootPage.keyboard.press('Escape');
}
}

3
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -8,6 +8,7 @@ import { CheckboxCellPageObject } from './CheckboxCell';
import { RatingCellPageObject } from './RatingCell';
import { DateCellPageObject } from './DateCell';
import { DateTimeCellPageObject } from './DateTimeCell';
import { GeoDataCellPageObject } from './GeoDataCell';
export interface CellProps {
index?: number;
@ -20,6 +21,7 @@ export class CellPageObject extends BasePage {
readonly attachment: AttachmentCellPageObject;
readonly checkbox: CheckboxCellPageObject;
readonly rating: RatingCellPageObject;
readonly geoData: GeoDataCellPageObject;
readonly date: DateCellPageObject;
readonly dateTime: DateTimeCellPageObject;
@ -30,6 +32,7 @@ export class CellPageObject extends BasePage {
this.attachment = new AttachmentCellPageObject(this);
this.checkbox = new CheckboxCellPageObject(this);
this.rating = new RatingCellPageObject(this);
this.geoData = new GeoDataCellPageObject(this);
this.date = new DateCellPageObject(this);
this.dateTime = new DateTimeCellPageObject(this);
}

29
tests/playwright/tests/columnGeoData.spec.ts

@ -34,13 +34,38 @@ test.describe.only('Geo Data column', () => {
await dashboard.viewSidebar.activateGeoDataEasterEgg();
await grid.column.create({
title: 'Geo Data 1',
title: 'GeoData1',
type: 'GeoData',
});
// await grid.rootPage.pause();
await grid.column.verify({ title: 'GeoData1', isVisible: true });
// await dashboard.grid.cell.attachment.addFile({
await grid.cell.geoData.open({
index: 0,
columnHeader: 'GeoData1',
});
// await grid.cell.geoData.enterLatLong({
// lat: '50.4501',
// long: '30.5234',
// });
// await grid.cell.geoData.clickSave();
// 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 dashboard.rootPage.pause();
await grid.column.delete({ title: 'GeoData1' });
await grid.column.verify({ title: 'GeoData1', isVisible: false });
await dashboard.closeTab({ title: 'City' });

Loading…
Cancel
Save