Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions examples/ui5-js-app/webapp/test/e2e/allControls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,35 @@ describe("ui5 basic, get all buttons", () => {
const webButton = await buttons[0].getWebElement()
expect(webButton).toBeTruthy()
})

it("press() with interaction selector on specific control from allControls", async () => {
// This test verifies the fix for the issue where press() with interaction selector
// always pressed the first control instead of the specific one
const buttonSelector = {
forceSelect: true,
selector: {
controlType: "sap.m.Button",
viewName: "test.Sample.view.Main",
interaction: "press"
}
}

const buttons = await browser.allControls(buttonSelector)
expect(buttons.length).toBeGreaterThan(1)

// Get the text of the second button before pressing
const secondButtonText = await buttons[1].getText()
expect(secondButtonText).toBeTruthy()

// Press the second button using the interaction selector
// This should NOT press the first button
await buttons[1].press()

// Verify we didn't navigate (which would happen if first button was pressed)
// The first button is "to Other view" which navigates away
const currentHash = await browser.getUrl()
// If the fix works correctly, we should still be on the main view
// because we pressed a different button, not the navigation one
expect(currentHash).toContain("Main")
})
})
Loading
Loading