Sapui5 OPA5テスト:私はポップアップで開きますフラグメントにどのように入手できますか?
「ホーム」ビューには、フラグメントを含むポップアップを開くボタンがあります。 ポップアップは、DOM要素に追加されるフラグメントです。
私はホームページのOPA5テストを行うと、私はそれが仕事をdoesntの断片と、ポップアップにアクセスしようとしているとき、それはうまく行くが。 (例えば、ボタンをクリックするか画像を取得するなど)。
どのように私はポップアップを参照のうえれる機能を実装することができますか?
sap.ui.require(
["sap/ui/test/opaQunit"],
function (opaTest) {
"use strict";
QUnit.module("Load");
opaTest("View init!", function (Given, When, Then) {
// Arrangements
Given.iStartMyApp();
//Actions
When.onTheHomePage.iLookAtTheScreen();
When.onTheHomePage.iPressOnBotButton();
When.onTheHomePage.iPressInDialog();/// Needs to click in popup
When.onTheHomePage.iSearchInDialog();/// Needs to **search** in popup
// Assertions
Then.onTheHomePage.iShouldSeeTheHelloDialog();
});
Home.js
:- Home.view.xml
- Chat.fragment.xml
ここではOPA5 HomeJourney.jsです
iPressInDialog: function() {
// Press action hits the "more" trigger on a table
return this.waitFor({
id: "__button13",
viewName: "Home",
actions: new Press(),
errorMessage: "did not find the Button",
success : function (oTitle) {
Opa5.assert.ok(oTitle.getVisible(), "closeBTN Button Was Clicked");
}
});
},
Chat.fragment.xml
<core:FragmentDefinition
xmlns:core="sap.ui.core"
xmlns:f="sap.ui.layout.form"
xmlns:l="sap.ui.layout"
xmlns:wt="com.sap.it.cs.iphome.controller.fragments"
xmlns:commons="sap.suite.ui.commons"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns="sap.m"
>
<Dialog id="Dialog">
<content>
<l:HorizontalLayout
allowWrapping="false"
class="sapUiContentPadding">
<Panel height="auto" width="auto" backgroundDesign="Solid">
<FlexBox>
<List items="{msgData>/msgData}" >
<CustomListItem >
<wt:MessageStrip
text="{msgData>Text}"
type="{msgData>Type}"
showIcon="true"
showCloseButton="false"
customIcon="{msgData>customIcon}"
>
</wt:MessageStrip>
</CustomListItem>
</List>
<HBox width="100%">
<SearchField width="auto" class="sapUiSmallMargin" id="searchField" search="onSearch" liveChange="onLiveChange" placeholder="How can I help you?">
<layoutData>
<FlexItemData growFactor="1" />
</layoutData>
</SearchField>
<Button id="speech" icon="sap-icon://microphone" press="onAskClick" class="sapUiSmallMarginTop">
</Button>
</HBox>
</FlexBox>
</Panel>
</l:HorizontalLayout>
</content>
</Dialog>
あなたChat.fragment.xmlはどのようなものが見えますか? i'vはchat.fragment.xmlを追加@Allen – Allen
は、見て、私は「searchField」を取得し、再びそこ – Eli