Skip to content

Commit d01fb65

Browse files
committed
Add tests for feature index option
1 parent 10c23e1 commit d01fb65

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

test/e2e/basics/popup.test.js

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ describe("Popup test", () => {
2121
});
2222

2323
test("Turn on options", async ()=>{
24-
let extension = page;
24+
await page.keyboard.press("Tab");
25+
await page.waitForTimeout(500);
26+
2527
for(let i = 0; i < 2; i++){
2628
await page.keyboard.press("Tab");
2729
await page.waitForTimeout(500);
30+
await page.keyboard.press("Space");
31+
await page.waitForTimeout(500);
2832
}
29-
await extension.keyboard.press("Space");
30-
await extension.waitForTimeout(500);
31-
3233
let newPage = await context.newPage();
3334
await newPage.waitForTimeout(1000);
3435
await newPage.goto(PATH + "basics/locale.html");
@@ -37,25 +38,36 @@ describe("Popup test", () => {
3738
await newPage.waitForTimeout(500);
3839
await newPage.keyboard.press("ArrowUp");
3940
await newPage.waitForTimeout(1000);
40-
const output = await newPage.$eval(
41+
42+
const featureIndexOverlay = await newPage.$eval(
43+
"xpath=//html/body/mapml-viewer >> css=div",
44+
(div) => div.querySelector("output.mapml-feature-index")
45+
);
46+
47+
const announceMovement = await newPage.$eval(
4148
"xpath=//html/body/mapml-viewer >> css=div > output",
4249
(output) => output.innerHTML
4350
);
51+
4452
await newPage.close();
45-
await expect(output).toEqual("zoom level 2 column 10 row 11");
53+
await expect(featureIndexOverlay === null).toEqual(false);
54+
await expect(announceMovement).toEqual("zoom level 2 column 10 row 11");
4655
});
4756

4857
test("Clear storage", async ()=>{
49-
for(let i = 0; i < 2; i++){
50-
await page.keyboard.press("Tab");
51-
await page.waitForTimeout(500);
52-
}
5358
await page.keyboard.press("Space");
5459
await page.waitForTimeout(500);
60+
await page.keyboard.press("Shift+Tab");
61+
await page.waitForTimeout(500);
62+
await page.keyboard.press("Space");
63+
await page.waitForTimeout(500);
64+
5565
await page.reload();
5666
await page.waitForTimeout(1000);
5767
let announceMoveOption = await page.locator('[id=announceMovement]').isChecked();
68+
let featureIndexOverlayOption = await page.locator('[id=featureIndexOverlayOption]').isChecked();
5869
expect(announceMoveOption).toBe(false);
70+
expect(featureIndexOverlayOption).toBe(false);
5971
});
6072

6173
test("Check if options are off", async ()=>{
@@ -67,10 +79,18 @@ describe("Popup test", () => {
6779
await newPage.waitForTimeout(500);
6880
await newPage.keyboard.press("ArrowUp");
6981
await newPage.waitForTimeout(1000);
82+
83+
const featureIndexOverlay = await newPage.$eval(
84+
"xpath=//html/body/mapml-viewer >> css=div",
85+
(div) => div.querySelector("output.mapml-feature-index")
86+
);
87+
7088
const output = await newPage.$eval(
7189
"xpath=//html/body/mapml-viewer >> css=div > output",
7290
(output) => output.innerHTML
7391
);
92+
93+
await expect(featureIndexOverlay).toEqual(null);
7494
await expect(output).toEqual("");
7595
});
7696
});

0 commit comments

Comments
 (0)