Skip to content

Commit 0e86aa8

Browse files
authored
chore: adopt all specs to shadow$ syntax (#745)
1 parent 484b89d commit 0e86aa8

25 files changed

+110
-110
lines changed

packages/main/test/pageobjects/DatePickerFGPage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class DatePickerFGPage {
22

33
get dpStart() { return $('#ui5-datepicker--startDate'); }
4-
get startPopoverContent() { return browser.findElementDeep("#ui5-datepicker--startDate >>> ui5-popover >>> .ui5-popup-root"); }
5-
get startInnerInput() { return browser.findElementDeep("#ui5-datepicker--startDate >>> ui5-input >>> input"); }
4+
get startPopoverContent() { return browser.$("#ui5-datepicker--startDate").shadow$("ui5-popover").shadow$(".ui5-popup-root"); }
5+
get startInnerInput() { return browser.$("#ui5-datepicker--startDate").shadow$("ui5-input").shadow$("input"); }
66
get dpEnd() { return $('#ui5-datepicker--endDate'); }
77

88
open() {

packages/main/test/pageobjects/ListTestPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ListTestPage {
88
}
99

1010
get header() {
11-
return browser.findElementDeep(`${this._sut} >>> header`);
11+
return browser.$(`${this._sut}`).shadow$(`header`);
1212
}
1313

1414
getItem(index) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("Badge rendering", () => {
55

66
it("tests label not rendered if not text content", () => {
77

8-
const badgeLabel = browser.findElementDeep("#badgeIconOnly >>> .ui5-badge-text");
8+
const badgeLabel = browser.$("#badgeIconOnly").shadow$(".ui5-badge-text");
99

1010
assert.ok(badgeLabel, "bagde label tag not rendered.");
1111
});

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ describe("Button general interaction", () => {
55
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Button.html");
66

77
it("tests press event", () => {
8-
const button = browser.findElementDeep("#button1");
9-
const field = browser.findElementDeep("#press-counter");
8+
const button = browser.$("#button1");
9+
const field = browser.$("#press-counter");
1010

1111
button.click();
1212
button.keys("Space");
@@ -16,7 +16,7 @@ describe("Button general interaction", () => {
1616
});
1717

1818
it("tests pressing on disabled button", () => {
19-
const button = browser.findElementDeep("#button-disabled >>> button");
19+
const button = browser.$("#button-disabled").shadow$("button");
2020

2121
assert.throws(() => {
2222
button.click();
@@ -25,14 +25,14 @@ describe("Button general interaction", () => {
2525
// don't test space and enter, as wdio always fires a click but the browser not.
2626
// button.keys("Space");
2727
// button.keys("Enter");
28-
const field = browser.findElementDeep("#press-counter");
28+
const field = browser.$("#press-counter");
2929
assert.strictEqual(field.getProperty("value"), "3", "Press should be called 3 times");
3030
});
3131

3232
it("click should call handler", () => {
3333

34-
const button = browser.findElementDeep("#button1");
35-
const field = browser.findElementDeep("#click-counter");
34+
const button = browser.$("#button1");
35+
const field = browser.$("#click-counter");
3636

3737
button.click();
3838
button.keys("Space");
@@ -42,8 +42,8 @@ describe("Button general interaction", () => {
4242
});
4343

4444
it("click on disabled button should not call handler", () => {
45-
const button = browser.findElementDeep("#button-disabled >>> button");
46-
const field = browser.findElementDeep("#click-counter");
45+
const button = browser.$("#button-disabled").shadow$("button");
46+
const field = browser.$("#click-counter");
4747

4848
assert.throws(() => {
4949
button.click();

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ describe("Card general interaction", () => {
33
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Card.html");
44

55
it("fires headerPress upon click, Enter and Space", () => {
6-
const cardHeader = browser.findElementDeep("#card >>> .ui5-card-header");
7-
const cardHeader2 = browser.findElementDeep("#card2 >>> .ui5-card-header");
6+
const cardHeader = browser.$("#card").shadow$(".ui5-card-header");
7+
const cardHeader2 = browser.$("#card2").shadow$(".ui5-card-header");
88
const field = browser.$("#field");
99

1010
cardHeader.click();

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ describe("CheckBox general interaction", () => {
44
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/CheckBox.html");
55

66
it("tests checked default value is false", () => {
7-
const checkBox = browser.findElementDeep("#cb1");
7+
const checkBox = browser.$("#cb1");
88

99
assert.strictEqual(checkBox.getProperty("checked"), false, "Check if default value for checked is false");
1010
});
1111

1212
it("tests change event", () => {
13-
const checkBox = browser.findElementDeep("#cb1");
14-
const field = browser.findElementDeep("#field");
13+
const checkBox = browser.$("#cb1");
14+
const field = browser.$("#field");
1515

1616
checkBox.click();
1717
checkBox.keys("Space");
@@ -21,8 +21,8 @@ describe("CheckBox general interaction", () => {
2121
});
2222

2323
it("tests change event not fired, when disabled", () => {
24-
const checkBox = browser.findElementDeep("#cb2");
25-
const field = browser.findElementDeep("#field");
24+
const checkBox = browser.$("#cb2");
25+
const field = browser.$("#field");
2626

2727
checkBox.click();
2828
checkBox.keys("Space");
@@ -33,8 +33,8 @@ describe("CheckBox general interaction", () => {
3333

3434
it("tests truncating and wrapping", () => {
3535
const CHECKBOX_DEFAULT_HEIGHT = 44;
36-
const truncatingCb = browser.findElementDeep("#truncatingCb >>> .ui5-checkbox-root");
37-
const wrappingCb = browser.findElementDeep("#wrappingCb");
36+
const truncatingCb = browser.$("#truncatingCb").shadow$(".ui5-checkbox-root");
37+
const wrappingCb = browser.$("#wrappingCb");
3838

3939
const truncatingCbHeight = truncatingCb.getSize("height");
4040
const wrappingCbHeight = wrappingCb.getSize("height");

packages/main/test/specs/DatePicker-fg.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ describe('Date Picker Field Glass modifications', () => {
55
it('direct usage for comparison', () => {
66
browser.url('http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/DatePicker_fg.html');
77

8-
let popoverContent = browser.findElementDeep("#ui5-datepicker--startDate >>> ui5-popover >>> .ui5-popup-root");
8+
let popoverContent = browser.$("#ui5-datepicker--startDate").shadow$("ui5-popover").shadow$(".ui5-popup-root");
99
assert.ok(!popoverContent.isDisplayedInViewport(), "popover is initially hidden");
1010

11-
const innerInput = browser.findElementDeep("#ui5-datepicker--startDate >>> ui5-input >>> input");
11+
const innerInput = browser.$("#ui5-datepicker--startDate").shadow$("ui5-input").shadow$("input");
1212
innerInput.click();
1313
assert.ok(popoverContent.isDisplayedInViewport(), "popover is visible");
1414

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("Date Picker Tests", () => {
4141

4242
assert.equal(datepicker.input.getProperty("valueState"), "Error", "value state of the input is valid");
4343

44-
const contentWrapper = browser.findElementDeep("#dp3 >>> ui5-input >>> .ui5-input-content");
44+
const contentWrapper = browser.$("#dp3").shadow$("ui5-input").shadow$(".ui5-input-content");
4545
assert.ok(contentWrapper.isDisplayedInViewport(), "content wrapper has error styles");
4646
});
4747

@@ -112,9 +112,9 @@ describe("Date Picker Tests", () => {
112112

113113
datepicker.root.click();
114114
datepicker.innerInput.setValue("Jan 6, 2015");
115-
browser.findElementDeep("#dp1 >>> ui5-input >>> input").click(); //click elsewhere to focusout
115+
browser.$("#dp1").shadow$("ui5-input").shadow$("input").click(); //click elsewhere to focusout
116116

117-
assert.equal(browser.findElementDeep("#lbl").getHTML(false), "1", 'change has fired once');
117+
assert.equal(browser.$("#lbl").getHTML(false), "1", 'change has fired once');
118118
});
119119

120120
it("delete input value then open picker keeps the empty value", () => {
@@ -162,8 +162,8 @@ describe("Date Picker Tests", () => {
162162
it("Calendar selection works on different timezones", () => {
163163
datepicker.id = "#dp7";
164164

165-
browser.findElementDeep("#inputTimezone").setValue(-6); //CST
166-
browser.findElementDeep("#btnApplyTimezone").click();
165+
browser.$("#inputTimezone").setValue(-6); //CST
166+
browser.$("#btnApplyTimezone").click();
167167

168168
datepicker.valueHelpIcon.click();
169169

@@ -173,7 +173,7 @@ describe("Date Picker Tests", () => {
173173
assert.equal(datepicker.innerInput.getProperty("value"), "Jan 4, 2019", "dp value is correct");
174174

175175
//restore timezone
176-
browser.findElementDeep('#btnRestoreTimezone').click();
176+
browser.$('#btnRestoreTimezone').click();
177177

178178
// test needs to end with an assert, otherwise the next test seems to start before the click is finished and it hangs from time to time
179179
assert.equal($("#inputTimezone").getValue(), "", "timezone is reset");
@@ -228,16 +228,16 @@ describe("Date Picker Tests", () => {
228228
datepicker.innerInput.click();
229229
browser.keys("\b\b\b\b\b\b\b\b\b\b\b");
230230
datepicker.innerInput.keys("Jan 8, 2015");
231-
browser.findElementDeep("#dp1 >>> ui5-input >>> input").click(); //click elsewhere to focusout
231+
browser.$("#dp1").shadow$("ui5-input").shadow$("input").click(); //click elsewhere to focusout
232232

233-
assert.equal(browser.findElementDeep("#lbl").getHTML(false), "1", 'change has fired once');
233+
assert.equal(browser.$("#lbl").getHTML(false), "1", 'change has fired once');
234234

235235
datepicker.innerInput.click();
236236
browser.keys("\b\b\b\b\b\b\b\b\b\b\b");
237237
datepicker.innerInput.keys("Jan 6, 2015");
238-
browser.findElementDeep("#dp1 >>> ui5-input >>> input").click(); //click elsewhere to focusout
238+
browser.$("#dp1").shadow$("ui5-input").shadow$("input").click(); //click elsewhere to focusout
239239

240-
assert.equal(browser.findElementDeep("#lbl").getHTML(false), "2", 'change has fired once');
240+
assert.equal(browser.$("#lbl").getHTML(false), "2", 'change has fired once');
241241
});
242242

243243
it("change fires every time tomorrow is typed and normalized", () => {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("Dialog general interaction", () => {
99

1010
btnOpenDialog.click();
1111

12-
const dialog = browser.findElementDeep("ui5-dialog >>> .ui5-dialog-root");
12+
const dialog = browser.$("ui5-dialog").shadow$(".ui5-dialog-root");
1313
assert.ok(dialog.isDisplayedInViewport(), "Dialog is opened.");
1414

1515
btnCloseDialog.click();

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("Eventing", () => {
55
it("Default prevented", () => {
66
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Eventing.html");
77

8-
const innerLink = browser.findElementDeep("#defaultPreventedLink");
8+
const innerLink = browser.$("#defaultPreventedLink");
99
innerLink.click();
1010

1111
const hrefIsSame = browser.execute(() => {
@@ -17,7 +17,7 @@ describe("Eventing", () => {
1717
it("Default not prevented", () => {
1818
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Eventing.html");
1919

20-
const innerLink = browser.findElementDeep("#normalLink");
20+
const innerLink = browser.$("#normalLink");
2121
innerLink.click();
2222

2323
const hrefChanged = browser.execute(() => {

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ describe("Input general interaction", () => {
44
browser.url("http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Input.html");
55

66
it("fires change", () => {
7-
const input1 = browser.findElementDeep("#input1 >>> input");
8-
const inputResult = browser.findElementDeep("#inputResult >>> input");
7+
const input1 = browser.$("#input1").shadow$("input");
8+
const inputResult = browser.$("#inputResult").shadow$("input");
99

1010
// Start typing.
1111
input1.click();
@@ -35,8 +35,8 @@ describe("Input general interaction", () => {
3535
});
3636

3737
it("fires change when same value typed, but value is mutated via API in between", () => {
38-
const inputChange = browser.findElementDeep("#inputChange >>> input");
39-
const inputChangeResult = browser.findElementDeep("#inputChangeResult >>> input");
38+
const inputChange = browser.$("#inputChange").shadow$("input");
39+
const inputChangeResult = browser.$("#inputChangeResult").shadow$("input");
4040

4141
inputChange.click();
4242
inputChange.keys("abc");
@@ -57,9 +57,9 @@ describe("Input general interaction", () => {
5757

5858
it("handles suggestions", () => {
5959
let item;
60-
const suggestionsInput = browser.findElementDeep("#myInput >>> input");
61-
const inputResult = browser.findElementDeep("#inputResult >>> input");
62-
const popover = browser.findElementDeep("#myInput >>> ui5-popover >>> .ui5-popover-root");
60+
const suggestionsInput = browser.$("#myInput").shadow$("input");
61+
const inputResult = browser.$("#inputResult").shadow$("input");
62+
const popover = browser.$("#myInput").shadow$("ui5-popover").shadow$(".ui5-popover-root");
6363

6464
suggestionsInput.click();
6565
suggestionsInput.keys("p");
@@ -82,8 +82,8 @@ describe("Input general interaction", () => {
8282
});
8383

8484
it("handles suggestions via keyboard", () => {
85-
const suggestionsInput = browser.findElementDeep("#myInput2 >>> input");
86-
const inputResult = browser.findElementDeep("#inputResult >>> input");
85+
const suggestionsInput = browser.$("#myInput2").shadow$("input");
86+
const inputResult = browser.$("#inputResult").shadow$("input");
8787

8888
suggestionsInput.click();
8989
suggestionsInput.keys("c");
@@ -103,8 +103,8 @@ describe("Input general interaction", () => {
103103

104104
/*
105105
it("sets empty value to an input", () => {
106-
const input1 = browser.findElementDeep("#input1");
107-
const innerInput = browser.findElementDeep("#input1 >>> input");
106+
const input1 = browser.$("#input1");
107+
const innerInput = browser.$("#input1").shadow$("input");
108108
109109
input1.setProperty("value", "");
110110

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ describe("General API", () => {
1212
});
1313

1414
it("should wrap the text of the label", () => {
15-
const wrappingLabel = browser.findElementDeep("#wrapping-label");
16-
const truncatingLabel = browser.findElementDeep("#truncated-label");
15+
const wrappingLabel = browser.$("#wrapping-label");
16+
const truncatingLabel = browser.$("#truncated-label");
1717

1818
assert.ok(wrappingLabel.getSize().height > truncatingLabel.getSize().height);
1919
assert.strictEqual(truncatingLabel.getSize().height, 16, "truncated label should be single line");
2020
});
2121

2222
describe("linked element with 'for' property", () => {
2323
it("should focus ui5-input on click", () => {
24-
const label = browser.findElementDeep("#label-for-ui5-input");
25-
const field = browser.findElementDeep("#form-ui5-input");
24+
const label = browser.$("#label-for-ui5-input");
25+
const field = browser.$("#form-ui5-input");
2626

2727
label.click();
2828

2929
assert.ok(field.isFocused(), "ui5-input should be focussed");
3030
});
3131

3232
it("should focus native input on click", () => {
33-
const label = browser.findElementDeep("#label-for-native-input");
34-
const field = browser.findElementDeep("#native-input");
33+
const label = browser.$("#label-for-native-input");
34+
const field = browser.$("#native-input");
3535

3636
label.click();
3737

3838
assert.ok(field.isFocused(), "native input should be focussed");
3939
});
4040

4141
it("should focus ui5-textarea on click", () => {
42-
const label = browser.findElementDeep("#label-for-ui5-textarea");
43-
const field = browser.findElementDeep("#ui5-textarea");
42+
const label = browser.$("#label-for-ui5-textarea");
43+
const field = browser.$("#ui5-textarea");
4444

4545
label.click();
4646

4747
assert.ok(field.isFocused(), "ui5-textarea should be focussed");
4848
});
4949

5050
it("should focus native textarea on click", () => {
51-
const label = browser.findElementDeep("#label-for-native-textarea");
52-
const field = browser.findElementDeep("#native-textarea");
51+
const label = browser.$("#label-for-native-textarea");
52+
const field = browser.$("#native-textarea");
5353

5454
label.click();
5555

5656
assert.ok(field.isFocused(), "native-textarea should be focussed");
5757
});
5858

5959
it("should focus ui5-datepicker on click", () => {
60-
const label = browser.findElementDeep("#label-for-ui5-datepicker");
61-
const field = browser.findElementDeep("#ui5-datepicker");
60+
const label = browser.$("#label-for-ui5-datepicker");
61+
const field = browser.$("#ui5-datepicker");
6262

6363
label.click();
6464

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ describe("General API", () => {
44
browser.url('http://localhost:8080/test-resources/sap/ui/webcomponents/main/pages/Link.html');
55

66
it("should wrap the text of the link", () => {
7-
const wrappingLabel = browser.findElementDeep("#wrapping-link");
8-
const truncatingLabel = browser.findElementDeep("#non-wrapping-link");
7+
const wrappingLabel = browser.$("#wrapping-link");
8+
const truncatingLabel = browser.$("#non-wrapping-link");
99

1010
assert.ok(wrappingLabel.getSize().height > truncatingLabel.getSize().height);
1111
assert.strictEqual(truncatingLabel.getSize().height, 16, "truncated label should be single line");
1212
});
1313

1414
it("should prevent clicking on disabled link", () => {
15-
const disLink = browser.findElementDeep("#disabled-link");
16-
const input = browser.findElementDeep("#helper-input");
15+
const disLink = browser.$("#disabled-link");
16+
const input = browser.$("#helper-input");
1717

1818
assert.throws(() => {
1919
disLink.click();
@@ -24,9 +24,9 @@ describe("General API", () => {
2424
});
2525

2626
it("should trigger click event onclick / enter / space", () => {
27-
const link = browser.findElementDeep("#link >>> a");
28-
const input = browser.findElementDeep("#helper-input");
29-
const inputClick = browser.findElementDeep("#helper-input-click");
27+
const link = browser.$("#link").shadow$("a");
28+
const input = browser.$("#helper-input");
29+
const inputClick = browser.$("#helper-input-click");
3030

3131
// same as in Timeline.spec.js
3232
// disable the click test temporarily, wdio click simulation does not trigger the ui5-link click handler

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe("Date Picker Tests", () => {
9090

9191
assert.ok(!firstItem.getAttribute("selected"), "item is selected");
9292

93-
const itemDeleteButton = firstItem.findElementDeep('ui5-button');
93+
const itemDeleteButton = firstItem.shadow$('ui5-button');
9494
assert.ok(itemDeleteButton.isExisting(), "there is a delete button");
9595

9696
itemDeleteButton.click();

0 commit comments

Comments
 (0)