Skip to content

Commit cbd611f

Browse files
committed
Add linux images for map-link-disabled test
Add waitForTimeout(500) to de-flake the test
1 parent bfc43d2 commit cbd611f

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

test/e2e/elements/map-link/map-link-disabled.test.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ test.describe('map-link disabled', () => {
2525
'map-link[rel=stylesheet][href="restaurants/restaurants.css"]'
2626
);
2727
await expect(stylesheetLink).not.toHaveAttribute('disabled');
28-
28+
await page.waitForTimeout(500);
2929
await expect(viewer).toHaveScreenshot('restaurants_css_style.png', {
3030
maxDiffPixels: 20
3131
});
3232
await stylesheetLink.evaluate((l) => (l.disabled = true));
33+
await page.waitForTimeout(500);
3334
await expect(viewer).toHaveScreenshot('default_style.png', {
3435
maxDiffPixels: 20
3536
});
3637
// enable the stylesheet, ensure it styles again
3738
await stylesheetLink.evaluate((l) => (l.disabled = false));
39+
await page.waitForTimeout(500);
3840
await expect(viewer).toHaveScreenshot('restaurants_css_style.png', {
3941
maxDiffPixels: 20
4042
});
@@ -56,10 +58,12 @@ test.describe('map-link disabled', () => {
5658
});
5759
const featuresLink = page.getByTestId('restaurants_templated_link');
5860
await featuresLink.evaluate((fl) => (fl.disabled = true));
61+
await page.waitForTimeout(500);
5962
await expect(viewer).toHaveScreenshot('blank_map.png', {
6063
maxDiffPixels: 20
6164
});
6265
await featuresLink.evaluate((fl) => (fl.disabled = false));
66+
await page.waitForTimeout(500);
6367
await expect(viewer).toHaveScreenshot('restaurants_css_style.png', {
6468
maxDiffPixels: 20
6569
});
@@ -75,16 +79,19 @@ test.describe('map-link disabled', () => {
7579
await restaurantsLayer.evaluate((l) => (l.checked = false));
7680
const osm = page.getByTestId('inline_tiles');
7781
osm.evaluate((l) => l.zoomTo());
82+
await page.waitForTimeout(500);
7883
// disable the map-link
7984
await expect(viewer).toHaveScreenshot('osm_overview.png', {
8085
maxDiffPixels: 20
8186
});
8287
const tt = page.getByTestId('tile_template');
8388
await tt.evaluate((tl) => (tl.disabled = true));
89+
await page.waitForTimeout(500);
8490
await expect(viewer).toHaveScreenshot('blank_map.png', {
8591
maxDiffPixels: 20
8692
});
8793
await tt.evaluate((tl) => (tl.disabled = false));
94+
await page.waitForTimeout(500);
8895
await expect(viewer).toHaveScreenshot('osm_overview.png', {
8996
maxDiffPixels: 20
9097
});
@@ -101,12 +108,14 @@ test.describe('map-link disabled', () => {
101108
l.zoomTo();
102109
l.checked = true;
103110
});
111+
await page.waitForTimeout(500);
104112
await expect(viewer).toHaveScreenshot('toporama.png', {
105113
maxDiffPixels: 20
106114
});
107115
// disable the map-link
108116
const imageTemplateLink = page.getByTestId('inline-link1');
109117
await imageTemplateLink.evaluate((l) => (l.disabled = true));
118+
await page.waitForTimeout(500);
110119
await expect(viewer).toHaveScreenshot('blank_map.png', {
111120
maxDiffPixels: 20
112121
});
@@ -123,29 +132,32 @@ test.describe('map-link disabled', () => {
123132
const restaurantsLayer = page.getByTestId('inline_templated_features');
124133
await restaurantsLayer.evaluate((l) => (l.checked = false));
125134
const toporama = page.getByTestId('inline_image');
126-
await toporama.evaluate((l)=> l.checked = false);
135+
await toporama.evaluate((l) => (l.checked = false));
127136
const queryableLayer = page.getByTestId('remote-queryable');
128-
await queryableLayer.evaluate((l)=>{l.checked = true;l.zoomTo();});
137+
await queryableLayer.evaluate((l) => {
138+
l.checked = true;
139+
l.zoomTo();
140+
});
129141
await page.waitForTimeout(500);
130142
await viewer.click();
131143
await page.waitForTimeout(500);
132144
// query returns a feature
133145
const queriedFeature = queryableLayer.getByTestId('hareg');
134146
await expect(queriedFeature).toHaveCount(1);
135147
const queryLink = queryableLayer.getByTestId('query-link');
136-
await queryLink.evaluate((l)=> l.disabled = true);
148+
await queryLink.evaluate((l) => (l.disabled = true));
137149
await page.waitForTimeout(500);
138-
const queryLinkIsEmpty = await queryLink.evaluate((l)=> l.shadowRoot.querySelector('*')===null);
150+
const queryLinkIsEmpty = await queryLink.evaluate(
151+
(l) => l.shadowRoot.querySelector('*') === null
152+
);
139153
await expect(queryLinkIsEmpty).toBe(true);
140154
await viewer.click();
141155
await page.waitForTimeout(500);
142156
await expect(queriedFeature).toHaveCount(0);
143157
// enable the query link, should return features again
144-
await queryLink.evaluate((l)=> l.disabled = false);
158+
await queryLink.evaluate((l) => (l.disabled = false));
145159
await viewer.click();
146160
await page.waitForTimeout(500);
147161
await expect(queriedFeature).toHaveCount(1);
148-
149-
150-
});
162+
});
151163
});
3.8 KB
Loading
8.33 KB
Loading
24.9 KB
Loading
10.9 KB
Loading
295 KB
Loading

0 commit comments

Comments
 (0)