Namespace sap.ui.test


Namespaces & Classes
OpaOne Page Acceptance testing.
Opa5UI5 extension of the OPA framework
OpaExtensionOPA extension interface.
OpaPluginA Plugin to search UI5 controls.
PageObjectFactoryPage Object Factory
Method Summary
sap.ui.test.opaQunit(testName, expected, callback)QUnit test adapter for opa.js has the same signature as a test of QUnit.
Method Detail
sap.ui.test.opaQunit(testName, expected, callback): QUnit.testModule: sap/ui/test/opaQunit

QUnit test adapter for opa.js has the same signature as a test of QUnit. Suggested usage:


sap.ui.require(["sap/ui/test/Opa5", "sap/ui/test/opaQunit"], function (Opa5, opaTest) {

   Opa5.extendConfig({
       assertions: new Opa5({
           checkIfSomethingIsOk : function () {
               this.waitFor({
                   success: function () {
                       Opa5.assert.ok(true, "Everything is fine");
                   }
               });
           }
       })
   });

   opaTest("Should test something", function (Given, When, Then) {
      // Implementation of the test
      Then.checkIfSomethingIsOk();
   });

});

When you require this file, it will also introduce a global variable: opaTest. It will also alter some settings of QUnit.config - testTimout will be increased to 90 if you do not specify your own. QUnit.reorder will be set to false, because OPA tests are often depending on each other.

Parameters:
stringtestNameThe name of the created QUnit test.
int|functionexpectedInteger showing how many QUnit assertions are expected by the test. If a function is passed, it is interpreted as callback and the expected is skipped.
functioncallback

The test function. It will get 3 arguments passed to it.

  1. Will be sap.ui.test.Opa.config .arrangements.
  2. Will be sap.ui.test.Opa.config .actions.
  3. Will be sap.ui.test.Opa.config .assertions.
Returns:
QUnit.testA function to register opaTests