Skip to content

Commit e835a50

Browse files
authored
fix(ui5-select): avoid global state in test spec (#3106)
Fxes: #3000
1 parent 201167e commit e835a50

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

packages/main/test/specs/Select.spec.js

+15-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("Select general interaction", () => {
2323
});
2424

2525
it("does not fire change, when clicking on selected item", () => {
26-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
26+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
2727

2828
const select = $("#mySelect");
2929
const inputResult = browser.$("#inputResult").shadow$("input");
@@ -38,7 +38,7 @@ describe("Select general interaction", () => {
3838
});
3939

4040
it("fires change on selection with keyboard handling", () => {
41-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
41+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
4242

4343
const select = $("#mySelect2").shadow$(".ui5-select-root");
4444
const selectText = browser.$("#mySelect2").shadow$(".ui5-select-label-root");
@@ -63,7 +63,7 @@ describe("Select general interaction", () => {
6363
});
6464

6565
it("changes selection while closed with Arrow Up/Down", () => {
66-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
66+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
6767

6868
const inputResult = browser.$("#inputResult").shadow$("input");
6969
const select = $("#mySelect2");
@@ -85,7 +85,7 @@ describe("Select general interaction", () => {
8585
});
8686

8787
it("changes selection sync with selection announcement", () => {
88-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
88+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
8989

9090
const btn = $("#myBtn2");
9191
const inputResult = browser.$("#inputResult").shadow$("input");
@@ -131,7 +131,6 @@ describe("Select general interaction", () => {
131131
assert.strictEqual(inputResult.getProperty("value"), "3", "Change event should have fired twice");
132132
});
133133

134-
/*
135134
it("changes selection on Tab", () => {
136135
const select = browser.$("#keyboardHandling");
137136
const EXPECTED_SELECTION_TEXT = "Banana";
@@ -173,7 +172,6 @@ describe("Select general interaction", () => {
173172

174173
assert.strictEqual(focusedElementId, browser.$("#mySelectEsc").getAttribute("id"), "Previous focusable element is focused");
175174
});
176-
*/
177175

178176
it("tests selection does not cycle with ArrowDown", () => {
179177
const select = $("#selectionNotCycling");
@@ -208,6 +206,8 @@ describe("Select general interaction", () => {
208206
});
209207

210208
it("opens upon space", () => {
209+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
210+
211211
const btn = $("#myBtn2");
212212
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#mySelect");
213213
const popover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
@@ -220,6 +220,8 @@ describe("Select general interaction", () => {
220220
});
221221

222222
it("toggles upon F4", () => {
223+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
224+
223225
const btn = $("#myBtn2");
224226
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#mySelect");
225227
const popover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
@@ -235,6 +237,8 @@ describe("Select general interaction", () => {
235237
});
236238

237239
it("toggles upon ALT + UP", () => {
240+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
241+
238242
const btn = $("#myBtn2");
239243
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#mySelect");
240244
const popover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
@@ -250,6 +254,8 @@ describe("Select general interaction", () => {
250254
});
251255

252256
it("toggles upon ALT + DOWN", () => {
257+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
258+
253259
const btn = $("#myBtn2");
254260
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#mySelect");
255261
const popover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
@@ -281,7 +287,7 @@ describe("Select general interaction", () => {
281287
});
282288

283289
it("reverts value before open after clicking on escape", () => {
284-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
290+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
285291

286292
const select = $("#mySelect");
287293
const selectText = browser.$("#mySelect").shadow$(".ui5-select-label-root").getHTML(false);
@@ -300,7 +306,7 @@ describe("Select general interaction", () => {
300306
});
301307

302308
it("fires change event after selection is change and picker if focussed out", () => {
303-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
309+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
304310

305311
const select = $("#mySelect");
306312
const inputResult = browser.$("#inputResult").shadow$("input");
@@ -316,7 +322,7 @@ describe("Select general interaction", () => {
316322
});
317323

318324
it("fires change event after selecting a previewed item", () => {
319-
browser.url("http://localhost:8080/test-resources/pages/Select.html");
325+
browser.url(`http://localhost:${PORT}/test-resources/pages/Select.html`);
320326

321327
const select = $("#mySelect");
322328
const inputResult = browser.$("#inputResult").shadow$("input");

0 commit comments

Comments
 (0)