on 2022 Oct 06 8:10 PM
Hi colleagues,
I am developing fiori elements with odata v4. The fiori tooling generator creates nice test pages and the sap-fe-mockserver is much better then the old mockserver.
However when it comes to karma testing (local and in pipeline). I am a little bit lost.
Using karma-ui5 causes some problems.
The ui5.configPath ui5-local.yaml is not loading/mounting the sap-ui-core and more correctly. Karma server uses ./base/webapp/resources while fiori-tools-proxy listens to ./resources. I could add ../../../../ to all references but this looks weird. See https://answers.sap.com/questions/13665378/ui5-karma-config-404-on-ui5-resource-load.html
Does someone has a working example that uses own yaml with fiori-tools-proxy and sap-fe-mockserver?
Greetings and thanks,
Daniel
hello Daniel,
Thank You for this post. We are facing issues with karma runner and OPA5.
For reference, we downloaded the code from https://github.com/SAP-samples/fiori-tools-samples, and navigated to V4/apps/salesorder. Installed karma and tested and it shows us a metadata error. We noticed this in your post "It also runs locally and on jenkins.". I am trying this on IntelliJ locally.
Your recommendation "Finally it seems that own shortened resource roots are causing trouble and I did not want to face it yet. So I took the same resource root alias as in the main application. Typically the generator create a opa templat with a shortened one." did not work for us, so we left it as is.
Do you have any suggestions please?
Joe Valliparampil.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved this, the following are the points to note when using an OData V4 service, Fiori elements and karma test runner:
1) In the karma.conf.js do not use the "url" and the "useMockServer" properties. "useMockServer" works only with V2 services. If the "url" property is present, then the middlewares will not be loaded, documentation is here: GitHub - SAP/karma-ui5: A Karma plugin for UI5
2) In the ui5-karma.yaml file:
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
specVersion: "2.5"
metadata:
name: salesorder
type: application
server:
customMiddleware:
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
debug: true
ui5:
path:
- /resources
- /test-resources
url: https://ui5.sap.com
version: "" # some UI5 versions do not have "sap/fe/test/JourneyRunner", set this to the latest or one that has the # Journey Runner
- name: sap-fe-mockserver
beforeMiddleware: csp # needs to be csp
configuration:
mountPath: /
services:
- urlPath: "your url here"
metadataPath: ./webapp/localService/metadata.xml
mockdataPath: ./webapp/localService/data
generateMockData: true
annotations: []
3. In "opaTests.qunit.html", set the paths, this will depends on your project folder structure, and thus the middleware can handle the requests correctly.
User | Count |
---|---|
69 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.