SAP-archive / cloud-s4-sdk-pipeline

The Cloud SDK pipeline uses the Cloud SDK continuous delivery server for building, checking, and deploying extension applications. Projects based on the SAP Cloud SDK archetype will automatically use this pipeline.
Apache License 2.0
65 stars 25 forks source link

Supported browsers for e2e-testing #11

Closed goeblj closed 4 years ago

goeblj commented 6 years ago

Hi,

is it possible to run e2e-tests with multiple browsers (chrome, firefox, ie, ...) in the build pipeline?

Thanks Jürgen

daniel-kurzynski commented 6 years ago

Hi Jürgen,

Thanks for your request. The browsers used in the e2e tests can be configured in the nightwatchjs configuration. However, currently the pipeline uses by default a docker image which only includes chromium to execute the tests. Based on this issue, I suggest extending that image by also including firefox. Including other browsers is difficult because of licenses.

If you want to use other browsers you can always change the docker image by replacing the node docker image as follows:

steps:
  executeNpm:
    dockerImage: 'my-docker-image'

Furthermore, I suggest adding documentation how to configure nightwatch to use multiple browsers.

Best,

Daniel

goeblj commented 6 years ago

Hi Daniel,

Thanks for your answer. Is it possible to add a chapter in the planned documentation to describe how a customer can build his own docker image including other browsers and how nightwatch has to be configured to use it correctly?

Thanks Jürgen

daniel-kurzynski commented 6 years ago

We now have a docker image with firefox and chromium. You can use it with the following configuration. It will also become the default image with the next pipeline release.

steps:
  executeNpm:
    dockerImage: 's4sdk/docker-node-browsers'

Documentation will follow. It is in the backlog.

testmim commented 6 years ago

Hello Daniel, which firefox driver should be used in external.globals.js file for starting and stopping the browser? Thanks Mirjana

daniel-kurzynski commented 6 years ago

For nightwatch and to control Firefox, geckodriver is the recommended way. Unfortunately, we tried it with our example application and had problems to get the tests running. We will investigate and will come back to you as soon as possible.

fwilhe commented 6 years ago

Hello @testmim,

sorry it took us so long to follow up on this issue.

Here is a branch with what we think this could be implemented: https://github.com/SAP/cloud-s4-sdk-examples/compare/e2e-firefox

This does not work locally in a container or in the pipeline, this seems to be an issue with geckodriver. Here is a log expert from my tests.

INFO Request: POST /wd/hub/session
 - data:  {"desiredCapabilities":{"browserName":"firefox","javascriptEnabled":true,"acceptSslCerts":true,"platform":"ANY","acceptInsecureCerts":true,"marionette":true}}
 - headers:  {"Content-Type":"application/json; charset=utf-8","Content-Length":158}
ERROR Response 500 POST /wd/hub/session (1509ms) { value:
   { message: 'Process unexpectedly closed with status: 1\nBuild info: version: \'3.9.1\', revision: \'63f7b50\', time: \'2018-02-07T22:42:28.403Z\'\nSystem info: host: \'4c17480a08e2\', ip: \'172.17.0.2\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.9.60-linuxkit-aufs\', java.version: \'1.8.0_151\'\nDriver info: driver.version: unknown\nremote stacktrace: stack backtrace:\n   0:           0x4edb3c - backtrace::backtrace::trace::hc4bd56a2f176de7e\n   1:           0x4edb72 - backtrace::capture::Backtrace::new::he3b2a15d39027c46\n   2:           0x440ac8 - webdriver::error::WebDriverError::new::ha0fbd6d1a1131b43\n   3:           0x4487ce - geckodriver::marionette::MarionetteHandler::create_connection::hf0532ddb9e159684\n   4:           0x428570 - <webdriver::server::Dispatcher<T, U>>::run::h2119c674d7b88193\n   5:           0x4029b9 - std::sys_common::backtrace::__rust_begin_short_backtrace::h21d98a9ff86d4c25\n   6:           0x40be65 - std::panicking::try::do_call::h5cff0c9b18cfdbba\n   7:           0x5e6a6c - panic_unwind::__rust_maybe_catch_panic\n                        at /checkout/src/libpanic_unwind/lib.rs:99\n   8:           0x41eb22 - <F as alloc::boxed::FnBox<A>>::call_box::h413eb1d9d9f1c473\n   9:           0x5df13b - alloc::boxed::{{impl}}::call_once<(),()>\n                        at /checkout/src/liballoc/boxed.rs:692\n                         - std::sys_common::thread::start_thread\n                        at /checkout/src/libstd/sys_common/thread.rs:21\n                         - std::sys::imp::thread::{{impl}}::new::thread_start\n                        at /checkout/src/libstd/sys/unix/thread.rs:84',
     error: 'unknown error' },
  status: 13 }

One change is that our s4sdk/docker-node-browsers image (tag latest) now contains a JVM, so Selenium can be run in it. If you adapt the branch I linked for your project, you should be able to try this for yourself.

Best regards, Florian

testmim commented 6 years ago

Hello Florian, thanks a lot for your answer. I implemented it as described in link you posted. After e2e test ist started (locally), firefox also starts, but the page cannot be opened - here is my log:

INFO Request: POST /wd/hub/session/2a6c593c-635b-4e3c-a435-d32cfe517951/url -data: {"url":"correct url"} -headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":75} ERROR Response 500 POST /wd/hub/session/2a6c593c-635b-4e3c-a435-d32cfe517951/url (42317ms) { state: 'unknown error', sessionId: null, hCode: 1672930733, value: { additionalInformation: '\nDriver info: driver.version: unknown', localizedMessage: 'Reached error page: about:neterror?e=netTimeout&u="MY URL"&c=UTF-8&f=regular&d=Der%20Server%20unter%20"MY URL"%20braucht%20zu%20lange%2C%20um%20eine%20Antwort%20zu%20senden.\ nBuild info: version: \'3.9.1\', revision: \'63f7b50\', ...'\nDriver info: driver.version: unknown', supportUrl: null, systemInformation: 'System info: host: \'HOST\', ip: \'IP\', os.name: \'Windows 7\', os.arch: \'amd64\', os.version: \'6.1\', java.version: \'1.8.0_152\'', cause: null, suppressed: [], message: 'Reached error page: about:neterror?e=netTimeout&u="MY URL&c=UTF-8&f=regular&d=Der%20Server%20unter%20"MY URL"%20braucht%20zu%20lange%2C%20um%20eine%20Antwort%20zu%20senden.\nBuild in fo: version: \'3.9.1\', revision: \'63f7b50\', time: \'2018-02-07T22:42:28.403Z\'\nSystem info: host: \'HOST\', ip: \'IP\', os.name: \'Windows 7\', os.arch: \'amd64\', os.version: \'6.1\', java.version: \'1.8.0_152\'\nDriver info: driver.version: unknown', hCode: 65452347, class: 'org.openqa.selenium.WebDriverException', buildInformation: null }, class: 'org.openqa.selenium.remote.Response', status: 13 } LOG → Completed command url (42360 ms) LOG → Completed command useCss (1 ms)

Do you have a clue why it doesn't work?

Best regards Mirjana

fwilhe commented 6 years ago

Hello Mirjana,

if I see this correct from your log, there is a time out. Did you try again in the meantime? Is the server reachable?

I don't think we can do much here, this is not related to our pipeline.

I would be curious to know if you can reproduce the geckodriver issue when running this in the pipeline.

Best regards, Florian

fwilhe commented 6 years ago

Hi,

I have opened an issue in geckodriver for this: https://github.com/mozilla/geckodriver/issues/1189

Can you verify you get the same issue with this minimal working example project? https://github.com/fwilhe/geckodriver-issue

Best regards, Florian

daniel-kurzynski commented 4 years ago

Cleaning up this old issue. Chrome and Firefox should be working meanwhile. IE will not be possible in the current docker setup. Instead it should be possible with a Windows based agent and an extension.