Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as.karpov1 Week 1,2,3 #40

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 124 additions & 123 deletions package-lock.json

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions webapp/controller/Detail.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/Dialog",
"sap/m/Button"
], function(
Controller,
Dialog,
Button
) {
"use strict";

return Controller.extend("ui5.challenge.controller.Detail", {
onOpenDialog: function(oEvent) {
if (!this.oDialog) {
this.oDialog = new Dialog({
title: "Test dialog",
id:"myDialog",
beginButton: new Button({
text: "close",
press: function() {
this.oDialog.close()
}.bind(this)
})
}).addStyleClass("myDialog")
}
this.oDialog.open()
}
});
});
13 changes: 13 additions & 0 deletions webapp/controller/Main.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sap.ui.define([
"ui5/challenge/controller/BaseController"
], function(
BaseController
) {
"use strict";

return BaseController.extend("ui5.challenge.controller.Main", {
onItem1Press: function(oEvent) {
this.getOwnerComponent().getRouter().navTo("RouteDetail")
}
});
});
2 changes: 2 additions & 0 deletions webapp/i18n/i18n.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
appTitle=ui5-challenge
mainTitleText=wdi5 rocks
2 changes: 1 addition & 1 deletion webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>title</title>
<title>ui5-challenge</title>

<script
id="sap-ui-bootstrap"
Expand Down
25 changes: 23 additions & 2 deletions webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,29 @@
"controlId": "app",
"clearControlAggregation": false
},
"routes": [],
"targets": {}
"routes": [{
"name": "main",
"pattern": "",
"target":["main"]
},
{
"name": "RouteDetail",
"pattern": "RouteDetail",
"target": "detail"
}
],
"targets": {
"main": {
"id": "main",
"viewName": "Main",
"viewType": "XML"
},
"detail": {
"id": "detail",
"viewName": "Detail",
"viewType": "XML"
}
}
},
"rootView": {
"viewName": "ui5.challenge.view.App",
Expand Down
30 changes: 26 additions & 4 deletions webapp/test/e2e/week4.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { wdi5 } = require("wdio-ui5-service")
const Detail = require("./pageObjects/Detail")
const Main = require("./pageObjects/Main")
// const Main = require("./pageObjects/Main")

/*
You have all done a great job so far in building an app that passes predefined tests 🎉
Expand All @@ -19,16 +19,38 @@ https://groups.community.sap.com/t5/coffee-corner-discussions/sap-community-code

describe("week4: main or detail page ...", () => {
before(async () => {
await Main.open()
// await Main.open()
// or
await Detail.open()
})

it("", async () => {
it("should check checkbox", async () => {
// your first test
const cb = await browser.asControl({
selector: {
id:"testCB",
viewName: Detail._viewName
}
})
await cb.setSelected(true)
expect(await cb.getProperty("selected")).toBeTruthy()
})

it("", async () => {
it("should select two items", async () => {
// your second test
const mcb = await browser.asControl({
forceSelect: true,
selector: {
// id:"multiCB",
controlType:"sap.m.MultiComboBox",
viewName: Detail._viewName
}

})
console.log("mcb", mcb)
await mcb.setSelectedKeys(["sk1", "sk2"])
const sk = await mcb.getSelectedKeys()
expect(sk.length).toEqual(2)

})
})
2 changes: 1 addition & 1 deletion webapp/view/App.view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mvc:View xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
<Shell id="shell">
<Shell id="shell" title="ui5_challenge">
<App id="app" />
</Shell>
</mvc:View>
54 changes: 54 additions & 0 deletions webapp/view/Detail.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<mvc:View
controllerName="ui5.challenge.controller.Detail"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:c="sap.ui.core"
displayBlock="true"
height="100%"
busyIndicatorDelay="0"
>
<Page
title="Detail"
showNavButton="true"
>
<content>
<Button
id="dialogButton"
text="Open dialog"
press=".onOpenDialog"
>
</Button>
<MultiComboBox
id="multiCB"
>
<items>
<c:Item
key="sk1"
text="sk1"
>
</c:Item>
<c:Item
key="sk2"
text="sk2"
>

</c:Item>
<c:Item
key="sk3"
text="sk3"
>
</c:Item>

</items>

</MultiComboBox>
<CheckBox
id="testCB"
text="testCB"
>

</CheckBox>

</content>
</Page>
</mvc:View>
38 changes: 38 additions & 0 deletions webapp/view/Main.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<mvc:View
controllerName="ui5.challenge.controller.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:c="sap.ui.core"
displayBlock="true"
height="100%"
busyIndicatorDelay="0"
>
<Page
title="{i18n>mainTitleText}"
>
<content>
<Button
id="mainButton"
text="MainButton"
>
</Button>
<List>
<items>
<StandardListItem
title="item1"
type="Navigation"
press=".onItem1Press"
id="myControl"
/>
<StandardListItem
title="item2"
/>
<StandardListItem
title="item3"
/>
</items>
</List>
</content>

</Page>
</mvc:View>