Skip to content

Commit caa16f1

Browse files
committed
test: stabilize test
1 parent 9307d7c commit caa16f1

File tree

2 files changed

+12
-50
lines changed

2 files changed

+12
-50
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ describe("Select mobile general interaction", () => {
1717
select.click();
1818

1919
// act - move the focus to the first item
20-
const popover = await select.shadow$("ui5-responsive-popover");
21-
const selectedItem = await popover.$("ui5-li:last-child");
20+
const selectedItem = await browser.$("#mySelect ui5-option:last-child");
2221
selectedItem.keys("ArrowUp");
2322
selectedItem.keys("ArrowUp");
2423

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

+11-48
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ describe("Select general interaction", () => {
2525
const EXPECTED_SELECTION_TEXT = "Cozy";
2626

2727
await select.click();
28-
const popover = await select.shadow$("ui5-responsive-popover");
29-
const firstItem = (await popover.$$("ui5-li"))[0];
28+
const firstItem = (await browser.$$("#mySelect ui5-option"))[0];
3029

3130
await firstItem.click();
3231

@@ -42,8 +41,7 @@ describe("Select general interaction", () => {
4241
const EXPECTED_SELECTION_TEXT = "Condensed";
4342

4443
await select.click();
45-
const popover = await select.shadow$("ui5-responsive-popover");
46-
const secondItem = (await popover.$$("ui5-li"))[1];
44+
const secondItem = (await browser.$$("#selectPrevent ui5-option"))[1];
4745

4846
await secondItem.click();
4947

@@ -60,9 +58,8 @@ describe("Select general interaction", () => {
6058

6159
await select.click();
6260

63-
const popover = await select.shadow$("ui5-responsive-popover");
64-
const firstItem = await popover.$("ui5-li:last-child");
65-
await firstItem.click();
61+
const lastItem = await browser.$("#mySelect ui5-option:last-child")
62+
await lastItem.click();
6663

6764
assert.strictEqual(await inputResult.getProperty("value"), "", "Event not fired when already selected item is selected");
6865
});
@@ -436,9 +433,7 @@ describe("Select general interaction", () => {
436433
await addItemsBtn.click();
437434

438435
const firstOption = await browser.$("#mySelect ui5-option:first-child");
439-
const select = await browser.$("#mySelect");
440-
const popover = await select.shadow$("ui5-responsive-popover");
441-
const firstListItem = await popover.$("ui5-li:first-child");
436+
const firstListItem = (await browser.$("#mySelect ui5-option:first-child"))
442437

443438
assert.ok(await firstOption.getProperty("selected"), "First option should be selected");
444439
assert.ok(await firstListItem.getProperty("selected"), "First list item should be selected");
@@ -493,8 +488,7 @@ describe("Select general interaction", () => {
493488
await select.keys("Escape");
494489

495490
await select.click();
496-
const popover = await select.shadow$("ui5-responsive-popover");
497-
const firstItem = await popover.$("ui5-li:first-child");
491+
const firstItem = await browser.$("#mySelect ui5-option:first-child");
498492

499493
await firstItem.click();
500494

@@ -508,9 +502,8 @@ describe("Select general interaction", () => {
508502
const EXPECTED_SELECTION_TEXT2 = "Condensed";
509503

510504
await select.click();
511-
const popover = await select.shadow$("ui5-responsive-popover");
512-
const firstItem = (await popover.$$("ui5-li"))[0];
513-
const thirdItem = (await popover.$$("ui5-li"))[2];
505+
const firstItem = await browser.$("#mySelectEsc ui5-option:first-child");
506+
const thirdItem = (await browser.$$("#mySelectEsc ui5-option"))[2];
514507

515508
await firstItem.click();
516509

@@ -584,7 +577,7 @@ describe("Select general interaction", () => {
584577
it("Tests that the picker is closed when the selected value is clicked", async () => {
585578
const select = await browser.$("#mySelect");
586579
const popover = await select.shadow$("ui5-responsive-popover");
587-
const firstItem = (await popover.$$("ui5-li"))[0];
580+
const firstItem = await browser.$("#mySelect ui5-option:first-child");
588581

589582
// select the first item
590583
await select.click();
@@ -612,37 +605,7 @@ describe("Select general interaction", () => {
612605
await select.keys("ArrowDown");
613606
await select.keys("ArrowDown");
614607

615-
const selectedOption = await popover.$("ui5-list").$("ui5-li[selected]");
608+
const selectedOption = await browser.$("#warningSelect ui5-option[selected]");
616609
assert.ok(await selectedOption.isClickable(), "Selected option is visible in the viewport.");
617610
});
618-
});
619-
620-
describe("Attributes propagation", () => {
621-
before(async () => {
622-
await browser.url(`test/pages/Select.html`);
623-
});
624-
625-
it("propagates additional-text attribute", async () => {
626-
const select = await browser.$("#mySelect6");
627-
const EXPECTED_ADDITIONAL_TEXT = "DZ",
628-
firstOption = await browser.$("#mySelect6 ui5-option:first-child"),
629-
firstItem = (await select.shadow$$("ui5-li"))[0];
630-
631-
assert.strictEqual(await firstOption.getProperty("additionalText"), EXPECTED_ADDITIONAL_TEXT, "The additional text is set");
632-
assert.strictEqual(await firstItem.getProperty("additionalText"), EXPECTED_ADDITIONAL_TEXT, "The additional text is correct");
633-
});
634-
635-
it("Tooltip propagation", async () => {
636-
const select = await browser.$("#selectTooltip");
637-
const tooltip = "Cozy"
638-
639-
await select.click();
640-
641-
const popover = await select.shadow$("[ui5-responsive-popover]");
642-
const option = await select.$("[ui5-option]");
643-
const listItem = await popover.$("[data-ui5-stable='tooltip-test-option']")
644-
645-
assert.strictEqual(await option.getProperty("tooltip"), tooltip, "Tooltip is correct");
646-
assert.strictEqual(await listItem.getProperty("tooltip"), tooltip, "Tooltip is correctly propagated");
647-
});
648-
});
611+
});

0 commit comments

Comments
 (0)