UNPKG

@sap/generator-fiori

Version:

Create an SAPUI5 application using SAP Fiori elements or a freestyle approach

107 lines (100 loc) 5.69 kB
/****************************************************************************** * ╔═══════════════════════════════════════════════════════════════════════╗ * * ║ ║ * * ║ WARNING: AUTO-GENERATED FILE ║ * * ║ ║ * * ║ This file is automatically generated by SAP Fiori tools and is ║ * * ║ overwritten when you run the OPA test generator again. ║ * * ║ ║ * * ║ To add your own custom tests: ║ * * ║ - Create a new journey test file in this directory. ║ * * ║ - Follow the same pattern as this file. ║ * * ║ - Add the new file to the opaTests.qunit.js config file. ║ * * ║ - Custom journey files are not overwritten. ║ * * ║ ║ * * ╚═══════════════════════════════════════════════════════════════════════╝ * ******************************************************************************/ sap.ui.define([ "sap/ui/test/opaQunit", "./pages/JourneyRunner" ], function (opaTest, runner) { "use strict"; function journey() { QUnit.module("<%- name%>ObjectPage journey"); opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) { Given.iStartMyApp(); <% if (!hideFilterBar) { %> When.onThe<%- navigationParents.parentLRName%>.onFilterBar().iExecuteSearch(); <% } %> Then.onThe<%- navigationParents.parentLRName%>.onTable().iCheckRows(); When.onThe<%- navigationParents.parentLRName%>.onTable().iPressRow(0); <% if(navigationParents.parentOPName) { %> Then.onThe<%- navigationParents.parentOPName%>.iSeeThisPage(); Then.onThe<%- navigationParents.parentOPName%>.onTable({ property: "<%- navigationParents.parentOPTableSection %>" }).iCheckRows(); When.onThe<%- navigationParents.parentOPName%>.onTable({ property: "<%- navigationParents.parentOPTableSection %>" }).iPressRow(0); <% } %> Then.onThe<%- name%>.iSeeThisPage(); }); <% if (headerSections?.length > 0) { -%> opaTest("Check header facets of the Object Page", function (Given, When, Then) { <% headerSections.forEach(function(section) { -%> <% if (section.microChart) { -%> Then.onThe<%- name%>.onHeader().iCheckMicroChart("<%- section.title %>"); <% } else { -%> Then.onThe<%- name%>.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>" }); <% if (section.form) { -%> <% section.fields.forEach(function(field) { -%> Then.onThe<%- name%>.onHeader().iCheckFieldInFieldGroup({ fieldGroup: "FieldGroup::<%- field.fieldGroupQualifier %>", field: "<%- field.field %>", targetAnnotation: "<%- field.targetAnnotation %>" }); <% }) -%> <% } -%> <% } -%> <% }) -%> }); <% } -%> <% if (bodySections?.length > 0 && !isStandalone) { -%> opaTest("Check body sections of the Object Page", function (Given, When, Then) { <% if (bodySections?.length > 1) { -%> Then.onThe<%- name%>.iCheckNumberOfSections(<%- bodySections.length %>); <% } -%> <% bodySections.forEach(function(section) { -%> <% if (bodySections.length > 1) { -%> When.onThe<%- name%>.iPressSectionIconTabFilterButton("<%- section.id %>"); <% } -%> Then.onThe<%- name%>.iCheckSection({ section: "<%- section.id %>" }); <% if (section?.subSections?.length > 0) { -%> <% section.subSections.forEach(function(subSection) { -%> //When.onThe<%- name%>.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" }); Then.onThe<%- name%>.iCheckSubSection({ section: "<%- subSection.id %>" }); <% if (subSection.fields && subSection.fields.length > 0) { -%> <% subSection.fields.forEach(function(field) { -%> Then.onThe<%- name%>.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>" }); <% }) -%> <% } -%> <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%> Then.onThe<%- name%>.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(<%- JSON.stringify(subSection.tableColumns) %>); <% } -%> <% }) -%> <% } else { -%> <% if (section.fields && section.fields.length > 0) { -%> <% section.fields.forEach(function(field) { -%> Then.onThe<%- name%>.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>" }); <% }) -%> <% } -%> <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%> Then.onThe<%- name%>.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(<%- JSON.stringify(section.tableColumns) %>); <% } -%> <% } -%> <% }) -%> }); <% } -%> opaTest("Teardown", function (Given, When, Then) { // Cleanup Given.iTearDownMyApp(); }); } runner.run([journey]); });