Browse Source

work on map view tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
0439286ba3
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 11
      tests/playwright/pages/Dashboard/Map/index.ts
  2. 18
      tests/playwright/tests/viewMap.spec.ts

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

@ -16,9 +16,16 @@ export class MapPage extends BasePage {
return this.dashboard.get().locator('[data-testid="nc-map-wrapper"]');
}
marker(lat: string, long: string) {
async marker(lat: string, long: string) {
const latLongStr = `${lat}, ${long}`;
return this.get().locator(`.leaflet-marker-pane img[alt="${latLongStr}"]`);
// await this.rootPage.pause();
const marker = await this.get().locator(`.leaflet-marker-pane img[alt="${latLongStr}"]`);
// await this.rootPage.pause();
return marker;
}
async clickMarker(lat: string, long: string) {
return (await this.marker(lat, long)).click();
}
async zoomOut(times = 10) {

18
tests/playwright/tests/viewMap.spec.ts

@ -8,6 +8,12 @@ test.describe.only('Map View', () => {
let dashboard: DashboardPage, toolbar: ToolbarPage;
let context: any;
const latitudeInFullDecimalLength = '50.4501000';
const longitudeInFullDecimalLength = '30.5234000';
const latitudeInShortDecimalLength = '50.4501';
const longitudeInShortDecimalLength = '30.5234';
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
@ -33,16 +39,16 @@ test.describe.only('Map View', () => {
columnHeader: 'Actors Birthplace',
});
await grid.cell.geoData.enterLatLong({
lat: '50.4501',
long: '30.5234',
lat: latitudeInShortDecimalLength,
long: longitudeInShortDecimalLength,
});
await grid.cell.geoData.clickSave();
await grid.cell.verifyGeoDataCell({
index: 0,
columnHeader: 'Actors Birthplace',
lat: '50.4501000',
long: '30.5234000',
lat: latitudeInFullDecimalLength,
long: longitudeInFullDecimalLength,
});
});
@ -71,12 +77,14 @@ test.describe.only('Map View', () => {
// await dashboard.grid.column.save();
// }
test('Map View', async () => {
test('shows the marker and opens the expanded form view when clicking on it', async () => {
await dashboard.viewSidebar.createMapView({
title: 'Map 1',
});
// Zoom out
await dashboard.map.zoomOut(8);
// await dashboard.map.verifyMarkerCount({ count: 1 });
await dashboard.map.clickMarker(latitudeInShortDecimalLength, longitudeInShortDecimalLength);
});
// await dashboard.viewSidebar.verifyView({

Loading…
Cancel
Save