cancel
Showing results for 
Search instead for 
Did you mean: 

how to fix data binding when doing OPA?

Former Member
0 Kudos

I have a simple OPA5 test for my SAPUI5 app to check that a table is displayed when I click a button. When the test runs it clicks on the button and the table shows up but the there is no data on it. Using console logs on my code I can see that the data is being set properly. Here are my code snippets. Is there a way to wait for the data to be bound before proceeding to check for the table?

Code to be tested:

var errorsModel = new sap.ui.model.json.JSONModel(data);
        oComponent.setModel(errorsModel, "errors_inputs");
        console.log(oComponent.getModel("errors_inputs"));

OPA Test

opaTest("Should press the Process button and see the  formatting errors table", function (Given, When, Then) {
    // Actions  
    When.onCheckingErrortables.iPressTheProcessButtonWithBadData();

    // Assertions
    Then.onCheckingErrortables.iShouldSeeTheErrorsTableWithOneRow();
});

PageObjects for this test:

actions: {
          iPressTheProcessButtonWithBadData: function(){
                return this.waitFor({
                    viewName: inputsView,
                    id: "processBtn",
                    actions: new Press(),
                    errorMessage: "No Process button found"
                });
            }
        },

        assertions: {
            iShouldSeeTheErrorsTableWithOneRow: function () {
                return this.waitFor({
                    viewName: inputsView,
                    id: "errors_table",
                    matchers: new AggregationFilled({name: "rows"}),
                    success: function (rows) {
                        Opa5.assert.ok(rows.getRows().length === 1, "The Errors Table is visible and contains one row");
                    },
                    errorMessage: "Errors Tables does not have the right number of rows"
                });

Accepted Solutions (0)

Answers (0)