Skip to Content

OPA5 - The control Element is not rendered

Oct 31, 2017 at 11:43 AM


avatar image
Former Member


I am writing OPA5 integration tests for a SAPUI5 application.

When i try to test elements which are in aggregation i run into a problem.

I try to test if a menu has correct amount of elements after clicked.

The view of the menu:

<MenuButton id="plantMenuButton" text="{plantInfo>/plant/customerName} - {plantInfo>/plant/location}" class="bold-font">
    <FlexItemData maxWidth="100%"/>
    <Menu id="plantMenu" itemSelected="onMenuAction" items="{plants>/plants}">
      <MenuItem text="{plants>customerName} - {plants>location}" key="{plants>id}"/>

The journey:

opaTest("Should be able to see one plant in the selector", function(Given, When, Then) {

  // Assertions

The action for the click:

iPressOnPlantSelector: function() {
  return this.waitFor({
    id: sPlantMenuButtonId,
    viewName: sViewName,
    actions: new Press(),
    errorMessage: "The plant selector does not have a trigger"

The assertion which fails:

thePlantSelectorShouldShowEveryPlant: function() {
  return this.waitFor({
    id: sPlantMenuId,
    viewName: sViewName,
    matchers: new AggregationLengthEquals({
      name: "items",
      length: 1
    success: function() {
      Opa5.assert.ok(true, "The plant selector contains one item.");
    errorMessage: "The plant selector does not contain an item."

If a run the test, i can see that the click is working and the menu is opened. I tried other ways to get the menu elements but every time i got the result that they are not rendered.

The full error:

[opaTests.qunit.html] The plant selector does not contain an item.
Opa timeout
This is what Opa logged:
The control Element sap.m.Menu#__xmlview1--plantMenu is not rendered -  sap.ui.test.matchers.Visible
all results were filtered out by the matchers - skipping the check -  sap.ui.test.pipelines.MatcherPipeline

With thanks,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Dec 12, 2017 at 06:03 PM

I ran into the exact same problem. I found two issues with selecting a MenuButton item - opa5 thinks the item is 'not rendered' even though it's perfectly visible, and new Press() doesn't work for selecting the item. Setting visible: false and using firePress() resolves these issues. Here's code which I find works:

                iSelectFromActionsMenu: function (sText) {
                    return this.waitFor({
                        viewName: "myView",
                        id: "actionsMenuButton",
                        actions: new Press(),
                        errorMessage: "Menu was looked for but not found.",
                        success: function (oSelect) {
                            Opa5.assert.ok(sViewName, "Found menu.");
                                controlType: "sap.m.MenuItem",
                                visible: false,
                                matchers: [
                                    new Ancestor(oSelect),
                                    new Properties({ text: "Press me!" })
                                actions: function (oMenuItem) {
                                success: function () {
                                    Opa5.assert.ok(sViewName, "Item was successfully selected.");
                                errorMessage: "Cannot select item from menu"


10 |10000 characters needed characters left characters exceeded