SAP/karma-ui5

Uncaught ReferenceError: sap is not defined

sKeer89 opened this issue · 5 comments

Hello colleagues,

We are updating our UI5 version in our applications from 1.105.3 to 1.111.0-SNAPSHOT

<script
      id="sap-ui-bootstrap"
      src="https://<MB: URL removed>/resources/sap-ui-core.js"
      data-sap-ui-theme="sap_horizon"
      data-sap-ui-resourceroots='{
				"localLaunchpad": "./",
        "resourceRequestLibrary" : "./ui/resourceRequestLibrary"
			}'
      data-sap-ui-oninit="module:localLaunchpad/index"
      data-sap-ui-compatVersion="edge"
      data-sap-ui-async="true"
      data-sap-ui-frameOptions="allow"
      data-sap-ui-flexibilityServices='[{"connector":"LocalStorageConnector"}]'
    ></script>

But am getting this error:
Karma v6.4.1 server started at http://localhost:9876/
2023-01-17T11:56:04.3456838Z info shellExecute - [all ] Launching browsers ChromeHeadlessDocker with concurrency unlimited
2023-01-17T11:56:04.3502647Z info shellExecute - [all ] Starting browser ChromeHeadless
2023-01-17T11:56:04.5870101Z info shellExecute - [all ] Connected on socket mThDtiipM7bblAw2AAAB with id 66922093
2023-01-17T11:56:04.8187189Z error shellExecute - [all ] Chrome Headless 109.0.5414.74 (Linux x86_64) ERROR
2023-01-17T11:56:04.8189946Z info shellExecute - [all ] Uncaught ReferenceError: sap is not defined
2023-01-17T11:56:04.8192756Z info shellExecute - [all ] at /home/vsts/work/1/s/Skill/tests/ui-integration/node_modules/karma-ui5/lib/client/autorun.js:16:2

2023-01-17T11:56:04.8195077Z info shellExecute - [all ]
2023-01-17T11:56:04.8197735Z info shellExecute - [all ] ReferenceError: sap is not defined
2023-01-17T11:56:04.8200451Z info shellExecute - [all ] at /home/vsts/work/1/s/Skill/tests/ui-integration/node_modules/karma-ui5/lib/client/autorun.js:16:2
2023-01-17T11:56:04.8202969Z info shellExecute - [all ] at /home/vsts/work/1/s/Skill/tests/ui-integration/node_modules/karma-ui5/lib/client/autorun.js:22:3

2023-01-17T11:56:04.8247702Z info shellExecute - [all ]
2023-01-17T11:56:04.8248765Z info shellExecute - [all ] Finished in 0.236 secs / 0 secs @ 11:56:04 GMT+0000 (Coordinated Universal Time)
2023-01-17T11:56:04.8251184Z info shellExecute - [all ]
2023-01-17T11:56:04.8253763Z info shellExecute - [all ] SUMMARY:
2023-01-17T11:56:04.8256381Z info shellExecute - [all ] ✔ 0 tests completed
2023-01-17T11:56:04.8568062Z info shellExecute - [all ] Warning: Task "karma:ci" failed.� Use --force to continue.
2023-01-17T11:56:04.8570337Z info shellExecute - [all ]
2023-01-17T11:56:04.8572971Z info shellExecute - [all ] Aborted due to warnings.

Could you please help with this?

Hi @sKeer89,

I removed the SAP-internal URL from your issue description. Could you please make sure that URL is reachable from your computer? Maybe that's already what's causing your issue.

Best regards,
Merlin

Hey @RandomByte

<MB: Removed image>
Here, I'm able to access the content.

Could you please check why this issue is occuring with karma?

Please note that this is a public forum. Do not share SAP-internal URLs in text or screenshots. I have removed your screenshot.

With the provided information, it is hard to provide you with support. First of all, you should validate whether the issue also occurs with a stable (non-SNAPSHOT) version of UI5. Could you please try reproducing the issue with bootstrap URL https://sapui5.hana.ondemand.com/?

No, with this URL, stable version, the issue doesn't occur. But we need to use the nightly version for our task.

Thanks for confirming.

The error sap is not defined is often indicating issues with loading UI5 resources.

I see that you are running Karma in a Docker container. Could you please test whether the URL you want to use can be accessed from within this Docker container. The network of a Docker container is often restricted or isolated, so it might be different from your local browser.

Based on the provided information I don't think this issue is actually related to karma-ui5. Therefore I will close this issue. For further support on your matter, please use SAP internal channels.