i<DoSth><WithSth>
i<ExpectSth>
iExecuteAction("myAction")
iCheckEdit({visible: true})
onFilterBar()
i<DoSth><WithSth>.and.i<DoSth><WithSth>
i<ExpectSth>.and.i<ExpectSth>
test
│
├───integration # By convention OPA tests are added to the test folder inside a UI5 app.
│ ├───pages # The pages folder contains the page objects for the different
│ │ ├───MainListReport.js # Fiori Elements templates.
│ │ └───MainObjectPage.js # Can be extended with own actions & assertions.
│ ├───Opa.qunit.js # Launch URL, pages and configuration settings can be set here.
│ │ # Uses JourneyRunner to call journeys.
│ ├───OpaJourney.js # A journey contains the actual tests which consists of steps
│ │ # constructed from the page objects.
│ └───opaTests.qunit.html # Sets up the UI5 environment to start the OPA5 tests.
│
├───flpSandbox.html # Starts the app with mock data.
├───testsuite.qunit.html # Testsuite that contains all unit and integration tests.
└───testsuite.qunit.js
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{appTitle}}</title>
<meta charset="UTF-8">
<script id="sap-ui-bootstrap"
src="../../resources/sap-ui-core.js"
data-sap-ui-theme='sap_fiori_3'
data-sap-ui-resourceroots='{
"sap.fe.demo.app": "../../"
}'
data-sap-ui-animation="false"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true">
</script>
<link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
<script src="../../resources/sap/ui/thirdparty/qunit-2.js"></script>
<script src="../../resources/sap/ui/qunit/qunit-junit.js"></script>
<script src="Opa.qunit.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>
sap.ui.require([
"sap/fe/test/JourneyRunner",
"sap/fe/test/Shell",
"sap/fe/demo/app/test/integration/pages/MainListReport",
"sap/fe/demo/app/test/integration/pages/MainObjectPage",
"sap/fe/demo/app/test/integration/OpaJourney"
],
function (JourneyRunner, Shell, MainListReport, MainObjectPage, Journey) {
'use strict';
var JourneyRunner = new JourneyRunner({
// start flpSandbox.html in test folder
launchUrl: sap.ui.require.toUrl('incidents') + '/test/flpSandbox.html',
opaConfig: { timeout: 30 }
});
JourneyRunner.run(
{
pages: { onTheMainPage: MainListReport, onTheDetailPage: MainObjectPage }
},
Journey.run,
);
}
)
sap.ui.define(['sap/fe/test/ListReport', "sap/ui/test/Opa5"], function (ListReport, Opa5) {
'use strict';
var AdditionalCustomListReportDefinition = {
// custom actions and assertions can be defined here
actions: {},
assertions: {
iShouldSeeMyCustomActionEnabled: function () {
return this.waitFor({
id: "myCustomSection"
properties: {
enabled: true
},
success: function () {
Opa5.assert.ok(true, "The custom section is visible and enabled")
},
errorMessage: "The custom section could not be found or is not enabled!"
})
}
}
};
return new ListReport(
{
appId: 'sap.fe.demo.app', // Compare sap.app.id in manifest.json
componentId: 'AppList', // Compare sap.ui5.routing.targets.<ListReport|ObjectPage>.id in manifest.json
entitySet: 'EntitySet' // Compare sap.ui5.routing.targets.<ListReport|ObjectPage>.options.settings.entitySet in manifest.json
},
AdditionalCustomListReportDefinition
);
});
FilterBar: We have to click on the link that is provided in the Description Column
iChangeSearchField and iExecuteSearch
sap.ui.define(['sap/ui/test/opaQunit'], function (opaTest) {
'use strict';
var Journey = {
run: function () {
QUnit.module('Sample journey');
opaTest('#0: Start', function (Given, When, Then) {
Given.iResetTestData().and.iStartMyApp("incidents-tile");
Then.onTheMainPage.iSeeThisPage();
});
opaTest('#1: ListReport: Check List Report Page loads', function (Given, When, Then) {
When.onTheMainPage.onFilterBar().iChangeSearchField("incident_001");
When.onTheMainPage.onFilterBar().iExecuteSearch();
// we can also chain multiple functions on the same hierarchy
// When.onTheMainPage.onFilterBar().iChangeSearchField("incident_001).and.iExecuteSearch()
// assert that there should be only 4 rows displayed
Then.onTheMainPage.onTable().iCheckRows(4);
// custom assertion
Then.onTheMainPage.iShouldSeeMyCustomActionEnabled()
});
opaTest('#999: Tear down', function (Given, When, Then) {
Given.iTearDownMyApp();
});
}
};
return Journey;
});
//... wdi5
it("I search product 'Office Plant'", async () => {
await FioriElementsFacade.execute((Given, When, Then) => {
// use the same code in the "Facade" as in your OPA5 tests
When.onTheMainPage.onFilterBar().iChangeSearchField("Office Plant").and.iExecuteSearch()
Then.onTheMainPage.onTable().iCheckRows(3)
})
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |