Browse Source

work on map view tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
126927d442
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 27
      tests/playwright/pages/Dashboard/ExpandedForm/index.ts
  2. 4
      tests/playwright/pages/Dashboard/Map/index.ts
  3. 30
      tests/playwright/tests/viewMap.spec.ts

27
tests/playwright/pages/Dashboard/ExpandedForm/index.ts

@ -67,6 +67,33 @@ export class ExpandedFormPage extends BasePage {
case 'text':
await field.locator('input').fill(value);
break;
case 'geodata': {
const [lat, long] = value.split(',');
// async open({ index, columnHeader }: { index: number; columnHeader: string }) {
// await this.cell.get({ index, columnHeader }).locator(`[data-testid="nc-geo-data-set-location-button"]`).click();
// }
// 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 close() {
// await this.rootPage.keyboard.press('Escape');
// }
await this.rootPage.locator(`[data-testid="nc-geo-data-set-location-button"]`).click();
await this.rootPage.locator(`[data-testid="nc-geo-data-latitude"]`).fill(lat);
await this.rootPage.locator(`[data-testid="nc-geo-data-longitude"]`).fill(long);
await this.rootPage.locator(`[data-testid="nc-geo-data-save"]`).click();
// await field.locator('input').fill(value);
break;
}
case 'belongsTo':
await field.locator('.nc-action-icon').click();
await this.dashboard.linkRecord.select(value);

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

@ -25,6 +25,10 @@ export class MapPage extends BasePage {
return marker;
}
async clickAddRowButton() {
await this.rootPage.locator('.nc-add-new-row-btn').click();
}
async clickMarker(lat: string, long: string) {
return (await this.marker(lat, long)).click();
}

30
tests/playwright/tests/viewMap.spec.ts

@ -84,7 +84,35 @@ test.describe.only('Map View', () => {
// Zoom out
await dashboard.map.zoomOut(8);
await dashboard.map.verifyMarkerCount(1);
await dashboard.map.clickMarker(latitudeInShortDecimalLength, longitudeInShortDecimalLength);
await dashboard.map.clickAddRowButton();
await dashboard.expandedForm.fillField({
columnTitle: 'FirstName',
value: 'Mario',
type: 'text',
});
await dashboard.expandedForm.fillField({
columnTitle: 'LastName',
value: 'Ali',
type: 'text',
});
await dashboard.expandedForm.fillField({
columnTitle: 'Actors Birthplace',
value: '12, 34',
type: 'geodata',
});
await dashboard.expandedForm.save();
await dashboard.map.verifyMarkerCount(2);
await dashboard.map.clickMarker('12', '34');
await dashboard.expandedForm.clickDeleteRow();
await dashboard.map.verifyMarkerCount(1);
});
// await dashboard.viewSidebar.verifyView({

Loading…
Cancel
Save