webrtc / KITE

KITE is a test engine designed to test WebRTC interoperability across browsers
Apache License 2.0
464 stars 125 forks source link

How do I use KITE to test Electron App #153

Open ss7424Refar opened 3 years ago

ss7424Refar commented 3 years ago

Hi! How do I use KITE to test the following situations:

  1. electron APP
  2. Package MainPage into static index.html, and use asar command to package resource / app as app.asar.
  3. The page seems cannot be accessed by local chrome.exe because it has packaged to app.asar.

    I saw on KITE-Sample-Tests seems to open a webRTC URL (like jitsi, mediasoup) in the Step, so that the next test can be carried out.

If there is any good method, please let me know. Thank you!

namvuCosmo commented 3 years ago

Hi,

Normally the step to open an URL is done for browsers only, it can also be call for electron app acting as a browser, but I think this defeats the purpose of electron being an app on its own. If the index.html is the default page for your app, which appears when the app is open, then calling this step is not necessary.

It's been a while since my last attempt at electron app. For electron, there are a few things that need to be configured differently from the normal chrome:

I'm not sure if this will still work. Can you share your setup to test your scenario?

ss7424Refar commented 3 years ago

Hi!

Thank you for reply! I will try your advise. but can you show how to set chrome_binary in where?

I search chrome_binary keyword in KITE-Sample-Test, then cannot find this setting. I think it in here , if i am right .

Can you show me how to write this configuration file in simply?

namvuCosmo commented 3 years ago

It's when you setup the node in the grid which you use to run the test.

This is a sample command line to setup the node on WINDOWS for example:

java -Dwebdriver.chrome.driver="C:/Selenium/chrome-stable/chromedriver.exe" -jar "C:\Selenium\selenium.jar" -role node -hub http://localhost:4445/grid/register/ -port 5001 -remoteHost http://localhost:5001 -browser browserName=chrome,version=84,platform=WINDOWS,chrome_binary="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",maxInstances=5
ss7424Refar commented 3 years ago

Hi!

Sorry for the late reply. because I have been wondering about the command you gave me: chrome_binary. Why the value is chrome.exe ...

According to your opinion, this value should be the electron executable path ?

For example. such as MyApp.exe . The following is the file structure of electron app I want to test.

My-Project-win32-x64
├── MyApp.exe
├── locales
├── resources
│   ├── app.asar

KITE said that it supports Electron App . The function that appears in my mind should be that KITE can start-up MyApp.exe, find HTML element in the application and do keyboard action like Selenium Framework. I'm not sure if my understanding is correct.

I was found startNode.sh in KITE which similar to the script you provided. But I installed KITE to Ubuntu . I think I need to rebuild a new test environment on windows .

namvuCosmo commented 3 years ago

The command I mentioned was just an example cmd to setup chrome node, the value for chrome_binary can be to any chrome-base executable, which in your case will be to your MyApp.exe.

It should be the same whether you are on Ubuntu or Windows. As long as you have the correct driver and the app can be opened, anything after that can be automated with Selenium framework.

ss7424Refar commented 3 years ago

Hi!

I takes several times to check the command work or not. The result is I think chrome_binary can start Electron App window, but seem cannot find HTML element by CSS selector and cannot use selenium-driver's function (such as getTitle()). i thought a simple case to Test it . The following is my Test steps. My code is in here.

Timeout Pic