-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Opa.html
67 lines (54 loc) · 1.73 KB
/
Opa.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Opa sample for retrieving controls by id</title>
<script id="sap-ui-bootstrap" src="../../../../../../../resources/sap-ui-core.js"></script>
<script>
jQuery.sap.require("sap.ui.qunit.qunit-css");
jQuery.sap.require("sap.ui.thirdparty.qunit");
jQuery.sap.require("sap.ui.qunit.qunit-junit");
jQuery.sap.require("sap.ui.qunit.qunit-coverage");
QUnit.config.autostart = false;
sap.ui.require(
["sap/ui/test/Opa5", "sap/ui/test/opaQunit", "sap/ui/test/actions/Press"],
function (Opa5, opaTest, Press) {
QUnit.module("Controls by id");
Opa5.extendConfig({
viewNamespace: "appUnderTest.view.",
autoWait : true
});
opaTest("Should find a Button with an id", function(Given, When, Then) {
// Act
Given.iStartMyAppInAFrame("applicationUnderTest/index.html");
When.waitFor({
viewName : "Main",
id : "navigationButton",
actions : new Press(),
errorMessage : "Did not find the navigation-button"
});
Then.waitFor({
viewName : "Main",
id : ["firstButtonOnSecondPage", "secondButtonOnSecondPage"],
success : function (aButtons) {
Opa5.assert.strictEqual(aButtons.length, 2, "Found both buttons");
}
});
Then.waitFor({
id: new RegExp("firstButtonOnSecondPage"),
success : function (aButtons) {
Opa5.assert.ok(true, "Found the button: " + aButtons[0]);
},
errorMessage : "Did not find the button with corresponding id"
});
Then.iTeardownMyAppFrame();
});
QUnit.start();
});
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</body>
</html>