|
| 1 | +import { MaputnikDriver } from "./maputnik-driver"; |
| 2 | + |
| 3 | +describe("local file", () => { |
| 4 | + const { when, get } = new MaputnikDriver(); |
| 5 | + |
| 6 | + beforeEach(() => { |
| 7 | + when.setStyle(""); |
| 8 | + }); |
| 9 | + |
| 10 | + describe("PMTiles", () => { |
| 11 | + it("loads local file for tile inspect", () => { |
| 12 | + const sourceId = "source"; |
| 13 | + const fileName = "polygon-z0.pmtiles" // a small polygon located at Null Island |
| 14 | + const baseUrl = "http://localhost:8888/"; |
| 15 | + const zoomTarget = "#14/0.5/0.5"; |
| 16 | + |
| 17 | + when.visit(`${baseUrl}${zoomTarget}`); |
| 18 | + |
| 19 | + get |
| 20 | + .bySelector("file", "type") |
| 21 | + .selectFile(`cypress/fixtures/${fileName}`, { force: true }); |
| 22 | + |
| 23 | + when.click("nav:sources"); |
| 24 | + when.setValue("modal:sources.add.source_id", sourceId); |
| 25 | + when.select("modal:sources.add.source_type", "tile_vector"); |
| 26 | + get.elementByTestId("modal:sources.add.tile_url").find('.maputnik-string') |
| 27 | + .clear() |
| 28 | + .type(`pmtiles://${fileName}/{z}/{x}/{y}`, { parseSpecialCharSequences: false }); |
| 29 | + when.select("modal:sources.add.scheme_type", "xyz"); |
| 30 | + when.setValue("modal:sources.add.maxzoom", "0"); |
| 31 | + when.click("modal:sources.add.add_source"); |
| 32 | + when.click("modal:sources.close-modal"); |
| 33 | + when.wait(200); |
| 34 | + |
| 35 | + when.select("maputnik-select", "inspect"); |
| 36 | + |
| 37 | + get.element(".maplibregl-map").trigger("mouseover", { force: true, waitForAnimations: true }).wait(2000) |
| 38 | + // @ts-ignore |
| 39 | + .compareSnapshot({ |
| 40 | + name: 'local-pmtiles-inspect', |
| 41 | + cypressScreenshotOptions: { |
| 42 | + clip: { x: 100, y: 100, width: 10, height: 10 } |
| 43 | + } |
| 44 | + }); |
| 45 | + }); |
| 46 | + }); |
| 47 | +}); |
0 commit comments