Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaleksandrova committed Jan 12, 2020
1 parent 81a58de commit ca435e3
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 10 deletions.
6 changes: 2 additions & 4 deletions docs/usage/locators.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,10 @@ var button = element(by.control({
}
}));

button.getCssValue("visibility").then(function (visibility) {
if (visibility === "visible") {
button.isPresent().then(function (isPresent) {
if (isPresent) {
button.click();
}
}).catch(function () {
// button is not found
});
```
Expand Down
75 changes: 70 additions & 5 deletions e2e/browser/fixture/apps/browser/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
search.attachSearch(function (oEvent) {
searchQuery.setText(oEvent.getSource().getValue());
});

var page1 = new sap.m.Page("page1", {
title: "Page 1",
content : [
Expand Down Expand Up @@ -50,11 +49,77 @@ module.exports = {
new sap.m.Button({
id : "hide-nav-btn",
text : "hide Nav Button",
press : function() {
page1.setShowNavButton(false);
}
press : function() {
page1.setShowNavButton(false);
}
}),
searchQuery,
new sap.m.OverflowToolbar({
id: "toolbar-fit",
width: "600px",
content: [
new sap.m.Button({
text: "Always Visible",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "NeverOverflow"
})
]
}),
new sap.m.Button({
text: "Mostly Visible",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "High"
})
]
}),
new sap.m.Button({
text: "Should Overflow",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "Low"
})
]
})
]
}),
new sap.m.OverflowToolbar({
id: "toolbar-overflow",
width: "300px",
content: [
new sap.m.Button({
text: "Always Visible",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "NeverOverflow"
})
]
}),
new sap.m.Button({
text: "Mostly Visible",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "High"
})
]
}),
searchQuery
new sap.m.Button({
text: "Overflowing",
press: "onToolbarButtonPress",
layoutData: [
new sap.m.OverflowToolbarLayoutData({
priority: "Low"
})
]
})
]
})
],
subHeader: new sap.m.Bar({
contentMiddle: [search]
Expand Down
52 changes: 51 additions & 1 deletion e2e/browser/specs/by_control.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,55 @@ describe("by_control", function () {
}));

expect(list.getAttribute("id")).toContain("ListPage1");
})
});

it("should interact with overflow toolbars", function () {
var presentToggleButton = element(by.control({
controlType: "sap.m.ToggleButton",
ancestor: {
id: "toolbar-overflow"
},
visible: false
}));
var overflowingButton = element(by.control({
controlType: "sap.m.Button",
properties: {
text: "Overflowing"
}
}));

presentToggleButton.isPresent().then(function (isPresent) {
if (isPresent) {
presentToggleButton.click();
}
});

// toggle button should be pressed and overflowing buttons should be shown
expect(overflowingButton.isPresent()).toBeTruthy();

var hiddenToggleButton = element(by.control({
controlType: "sap.m.ToggleButton",
ancestor: {
id: "toolbar-fit"
},
visible: false
}));
var toolbarButton = element(by.control({
controlType: "sap.m.Button",
properties: {
text: "Always Visible"
}
}));

hiddenToggleButton.isPresent().then(function (isPresent) {
if (isPresent) {
// should not get here as the button is not present
hiddenToggleButton.click();
}
});

// toggle button should not be visible and therefore not pressed. non-overflowing buttons should be shown
expect(toolbarButton.isPresent()).toBeTruthy();

});
});

0 comments on commit ca435e3

Please sign in to comment.