Browse Source

work on map view tests - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
28b155eee9
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 6
      tests/playwright/pages/Dashboard/Map/index.ts
  2. 10
      tests/playwright/pages/Dashboard/index.ts
  3. 1
      tests/playwright/tests/columnGeoData.spec.ts
  4. 2
      tests/playwright/tests/viewMap.spec.ts

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

@ -1,3 +1,4 @@
import { expect } from '@playwright/test';
import { DashboardPage } from '..';
import BasePage from '../../Base';
import { ToolbarPage } from '../common/Toolbar';
@ -28,6 +29,11 @@ export class MapPage extends BasePage {
return (await this.marker(lat, long)).click();
}
async verifyMarkerCount(count: number) {
const markers = await this.get().locator('.leaflet-marker-pane img');
await expect(markers).toHaveCount(count);
}
async zoomOut(times = 10) {
const zoomOutButton = await this.get().locator('.leaflet-control-zoom-out');
for (let i = 0; i < times; i++) {

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

@ -71,6 +71,16 @@ export class DashboardPage extends BasePage {
await this.tabBar.textContent().then(text => expect(text).toContain(title));
}
// async activateGeoDataEasterEgg() {
// const element = await this.rootPage.$('.nc-active-btn');
// const { x, y } = await element.boundingBox();
// // Click the element 5 times in a row
// for (let i = 0; i < 5; i++) {
// await this.rootPage.mouse.click(x + 50, y);
// }
// }
async closeTab({ title }: { title: string }) {
const tab = this.tabBar.locator(`.ant-tabs-tab:has-text("${title}")`);
await tab.locator('button.ant-tabs-tab-remove').click();

1
tests/playwright/tests/columnGeoData.spec.ts

@ -28,6 +28,7 @@ test.describe('Geo Data column', () => {
});
await grid.column.verify({ title: 'GeoData1', isVisible: true });
// await dashboard.rootPage.pause();
await grid.cell.geoData.open({
index: 0,

2
tests/playwright/tests/viewMap.spec.ts

@ -83,7 +83,7 @@ test.describe.only('Map View', () => {
});
// Zoom out
await dashboard.map.zoomOut(8);
// await dashboard.map.verifyMarkerCount({ count: 1 });
await dashboard.map.verifyMarkerCount(1);
await dashboard.map.clickMarker(latitudeInShortDecimalLength, longitudeInShortDecimalLength);
});

Loading…
Cancel
Save