webrtc / KITE

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

How to compile and run KITE test in Linux ? #88

Closed KiteTesting closed 4 years ago

KiteTesting commented 4 years ago

Im about to start writing KITE tests in Linux. This is the Dockerfile i created:

FROM ubuntu as KiteBase

RUN apt update RUN apt install -y default-jre default-jdk openjdk-8-jdk maven git gcc build-essential RUN git clone https://github.com/webrtc/KITE.git KITE

WORKDIR /KITE/scripts/linux

RUN chmod +x *.sh ./setupLocalGrid.sh

COPY ./utils/google-chrome.list /etc/apt/sources.list.d/google-chrome.list

RUN apt install wget -y RUN wget https://dl.google.com/linux/linux_signing_key.pub RUN apt-key add linux_signing_key.pub RUN apt update RUN apt install google-chrome-stable -y RUN apt install npm nodejs -y RUN nodejs -v

ENV KITE_HOME=/KITE ENV MAVEN_HOME =/usr/share/maven ENV JAVA_HOME =/usr/share/Java

FROM KiteBase

COPY ./scripts/linux/setupLocalGrid.sh .

COPY ./KITE-Example-Test .

I am able to create the localgrid in linux like this:

image

Im able to go into the project folder like in the picture below :

image

Now I'm asking if i should at first compile the project and then run it ?! If yes, how can I do the compiling and running the project, because the commands provided in this tutorial are not working :

image

Thanks!

namvuCosmo commented 4 years ago

Hi, After cloning KITE, you can run our configuring scripts (depends on your OS):

This will set the env variables for KITE, including the path to the scripts (KITE/scripts/os/path/) for:

After this you can use the commands in the tutorials. We do recommend you running the configure script, but alternatively, you can use these followings:

*Firefox profile is optional, however, we do provide a default profile with h264 plugin pre-installed, this might be needed for some WebRTC application. **For classpath, on Linux and Mac, the jars are separated by ":", and on Windows by ";"

Cheers,

KiteTesting commented 4 years ago

I did all the instructions you said and i copied the project , and now I want to run the KITE-Example test, but im stucked with this error :

image

image

image

image

namvuCosmo commented 4 years ago

Did you compile the KITE Engine before cd into KITE-Example-Test and call c?

If you already call c int KITE/, it compiles all of the modules including KITE-Example-Test, there's no need to compile the test module individually unless you're making changes to it.

After that you can just call r to run your test.

KiteTesting commented 4 years ago

When im trying to compile the entire KITE folder , it is showing this :

image

While in Windows, I didnt have these kind of errors.. Also, how to install and set the env variables for JAVA_HOME and MAVEN_HOME in Dockerfile?!

namvuCosmo commented 4 years ago

I'm trying to reproduce your errors, but can't. This is on a virtual machine with Ubuntu 18.04, maybe you're using a different variation of Linux?

image

Java and Maven version: image

KiteTesting commented 4 years ago

I cant compile the project :

image

Can you provide me steps how to resolve this and how to run the project. In windows i used to run the project by : r configs/js.example.config.json (javascript tutorial) , how can i do same thing here in linux now ?

namvuCosmo commented 4 years ago

I can't really help if I can't reproduce the issue here.

I followed your set of commands in both of your docker files and I got:

For me, on Ubuntu 18.04, these commands should be enough to compile KITE:

sudo apt-get install git openjdk-8-jdk maven
git clone https://github.com/webrtc/KITE KITE
cd KITE
cp scripts/linux/path/* ./ (if you don't want to add this to you $PATH)
./c 

Which variation of LINUX are you using?

KiteTesting commented 4 years ago

But probably it should be an alternative to run tests or to recognize the 'r' command :

image

FROM ubuntu as KiteBase

RUN apt update RUN apt install -y default-jre default-jdk openjdk-8-jdk maven git gcc build-essential nodejs npm

RUN apt-get install -y wget RUN wget https://dl.google.com/linux/linux_signing_key.pub

KITE

RUN git clone https://github.com/webrtc/KITE.git KITE RUN mvn --version RUN java --version

WORKDIR /KITE/

RUN chmod +x *.sh ./configureLinux.sh

WORKDIR /KITE/scripts/linux RUN chmod +x *.sh ./setupLocalGrid.sh

COPY ./utils/google-chrome.list /etc/apt/sources.list.d/google-chrome.list

RUN apt install wget -y RUN wget https://dl.google.com/linux/linux_signing_key.pub RUN apt-key add linux_signing_key.pub RUN apt update RUN apt install google-chrome-stable -y

ENV KITE_HOME=/KITE ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64

RUN export JAVA_HOME=/opt/java/jdk-11.0.1 RUN export PATH=$PATH:$JAVA_HOME/bin ENV MAVEN_HOME /opt/maven RUN export MAVEN_HOME

FROM KiteBase

COPY ./scripts/linux/setupLocalGrid.sh . COPY ./scripts/linux/gridConfig.sh . COPY ./scripts/linux/path/c . COPY ./scripts/linux/path/r . COPY ./scripts/linux/path/t . COPY ./scripts/linux/path/a . COPY ./scripts/linux/path/kite_init .

WORKDIR /KITE-Example-Test .

COPY ./KITE-Example-Test .

namvuCosmo commented 4 years ago

There is of course, the r command is just a quick way to do it instead of:

java (-Dkite.firefox.profile="PATH_TO_FIREFOX_PROFILE") (-Dkite.chrome.extension="PATH_TO_CHROME_EXTENSION")  -cp "PATH_TO_kite-jar-with-dependencies.jar:PATH_TO_YOUR_TEST_JAR" org.webrtc.kite.Engine PATH_TO_YOUR_CONFIG_FILE
tmatth commented 4 years ago

@KiteTesting can you share your actual docker commands (docker build etc.)

tmatth commented 4 years ago

FWIW I was able to build the image with your Dockerfile with this modification (not strictly necessary but it's a good idea to pin distro versions):

FROM ubuntu:bionic-20191029 as KiteBase

and

KITE$ cat utils/google-chrome.list 
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
KiteTesting commented 4 years ago

I've been able at first to launch the grid, then to compile and run the project in nodes

image

But I keep getting those erros about webdriver, any help about that ?

This is the dockerfile im using :

FROM ubuntu:bionic-20191029 as KiteBase

RUN apt update RUN apt install -y default-jre default-jdk openjdk-8-jdk maven git gcc build-essential nodejs npm RUN apt-get install nano -y RUN apt-get install -y wget RUN wget https://dl.google.com/linux/linux_signing_key.pub

KITE

RUN git clone https://github.com/webrtc/KITE.git KITE RUN mvn --version RUN java --version WORKDIR /KITE/

WORKDIR /KITE/ RUN chmod +x *.sh ./configureLinux.sh

COPY ./utils/google-chrome.list /etc/apt/sources.list.d/google-chrome.list

RUN wget https://dl.google.com/linux/linux_signing_key.pub RUN apt-key add linux_signing_key.pub RUN apt update RUN apt install google-chrome-stable -y

ENV KITE_HOME=/KITE RUN export KITE_HOME ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

RUN export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin

RUN export PATH=$PATH:$JAVA_HOME/bin

ENV MAVEN_HOME=/opt/maven RUN export MAVEN_HOME

FROM KiteBase COPY ./KITE-Engine . COPY ./KITE-Framework . COPY ./KITE-Engine . COPY ./scripts/linux/setupLocalGrid.sh . COPY ./scripts/linux/gridConfig.sh . COPY ./scripts/linux/path/c . COPY ./scripts/linux/path/r . COPY ./scripts/linux/path/t . COPY ./scripts/linux/path/a . COPY ./scripts/linux/path/kite_init . ADD pom.xml /KITE/pom.xml

WORKDIR ./KITE-Engine .

COPY ./KITE-Engine .

WORKDIR KITE/KITE-MessengerLogin-Test . COPY ./KITE-MessengerLogin-Test .

namvuCosmo commented 4 years ago

Hi, I'll try to reproduce that error with Js test next week and get back to you. Normally if your grid has chrome on linux, there should not be this error.

However we are not currently using docker, so I will test it only with ubuntu 18.

KiteTesting commented 4 years ago

Now, with this version of dockerfile, im getting this error:

FROM ubuntu as KiteBase

RUN apt update RUN apt install -y default-jre default-jdk openjdk-8-jdk maven git gcc build-essential nodejs npm RUN apt-get install nano -y RUN apt-get install -y wget dpkg unzip

KITE

RUN git clone https://github.com/webrtc/KITE.git KITE RUN mvn --version RUN java --version

WORKDIR /KITE/

RUN chmod +x *.sh ./configureLinux.sh

ENV KITE_HOME=/KITE RUN export KITE_HOME ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

RUN export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin

RUN export PATH=$PATH:$JAVA_HOME/bin

ENV MAVEN_HOME=/usr/share/maven RUN export MAVEN_HOME

FROM KiteBase COPY ./KITE-Engine . COPY ./KITE-Framework . COPY ./KITE-Engine . COPY ./scripts/linux/setupLocalGrid.sh . COPY ./scripts/linux/gridConfig.sh . COPY ./scripts/linux/path/c . COPY ./scripts/linux/path/r . COPY ./scripts/linux/path/t . COPY ./scripts/linux/path/a . COPY ./scripts/linux/path/kite_init . COPY ./scripts/linux/createFolderLocalGrid.sh . COPY ./scripts/linux/installChrome.sh . COPY ./scripts/linux/installFirefox.sh . COPY ./scripts/linux/installSelenium.sh . COPY ./scripts/linux/installMaven.sh . COPY ./scripts/linux/interactiveInstallation.sh .

ADD pom.xml /KITE/pom.xml

WORKDIR KITE/KITE-MessengerLogin-Test . COPY ./KITE-MessengerLogin-Test .

Check the errors here https://prnt.sc/qg0j6n https://prnt.sc/qg0jfj https://prnt.sc/qg0kd9

I know the errors are about the drivers versions, but could you help us a little here ?

namvuCosmo commented 4 years ago

Can you tell me how you setup your grid? and the browser configuration that you are calling with KITE.

KiteTesting commented 4 years ago

FROM ubuntu as KiteBase

RUN apt update RUN apt install -y default-jre default-jdk openjdk-8-jdk maven git gcc build-essential RUN apt-get install nano -y RUN apt-get install -y sudo wget dpkg unzip xvfb

KITE

RUN git clone https://github.com/webrtc/KITE.git KITE RUN mvn --version RUN java --version

WORKDIR /KITE/

RUN chmod +x *.sh ./configureLinux.sh

ENV KITE_HOME=/KITE RUN export KITE_HOME ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/bin

RUN export PATH=$PATH:$JAVA_HOME/bin

ENV MAVEN_HOME=/usr/share/maven RUN export MAVEN_HOME

FROM KiteBase COPY ./KITE-Engine . COPY ./KITE-Framework . COPY ./KITE-Engine . COPY ./scripts/linux/setupLocalGrid.sh . COPY ./scripts/linux/gridConfig.sh . COPY ./scripts/linux/path/c . COPY ./scripts/linux/path/r . COPY ./scripts/linux/path/t . COPY ./scripts/linux/path/a . COPY ./scripts/linux/path/kite_init . COPY ./scripts/linux/createFolderLocalGrid.sh . COPY ./scripts/linux/installChrome.sh . COPY ./scripts/linux/installFirefox.sh . COPY ./scripts/linux/installSelenium.sh . COPY ./scripts/linux/installMaven.sh . COPY ./scripts/linux/installDrivers.sh . COPY ./scripts/linux/interactiveInstallation.sh .

ADD pom.xml /KITE/pom.xml

WORKDIR KITE/KITE-Login-Test . COPY ./KITE-Login-Test .

From this dockerfile i launch the grid by this command RUN chmod +x *.sh ./configureLinux.sh .

the script installChrome.sh::

!/bin/bash

set +v . ./gridConfig.sh google-chrome-stable -version >chrome.txt chromeFile="chrome.txt" chrome=$(cat "$chromeFile")

if [[ $chrome == $CHROME_VERSION ]]; then echo Chrome version $CHROME_VERSION was found else echo Chrome version $CHROME_VERSION was not found, installing it.

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dpkg -i google-chrome-stable_current_amd64.deb apt-get fonts-liberation apt --fix-broken install rm -f google-chrome-stable_current_amd64.deb fi

rm -f chrome.txt

exit

the script setupLocalGrid.sh :

!/bin/bash

set +v . ./gridConfig.sh

echo $KITE_HOME cd $KITE_HOME/scripts/linux

function startGrid() { cd $KITE_HOME/localGrid if [ "$DESKTOP_ENVIRONMENT" = "TRUE" ] then x-terminal-emulator -e ./startGrid.sh & else ./startGrid.sh & fi }

if [[ "$DESKTOP_ENVIRONMENT" = "TRUE" ]] then apt-get -y upgrade -f gnome-terminal fi

./createFolderLocalGrid.sh

if [[ "$INSTALL_BROWSERS" = "TRUE" ]] then ./installChrome.sh ./installFirefox.sh else echo "Skipping Chrome and Firefox installation" fi

./installDrivers.sh ./installSelenium.sh

read -p "Do you want to start the Grid (y/n)? " yn

case $yn in

startGrid

;;

# [Nn]* )
 #      echo " "
  #     ;;
 #* ) echo "Please answer yes or no.";;

esac

startGrid

echo "Setup completed."

gridConfig.sh script:

!/bin/bash

Grid setup configuration for Ubuntu

#

Please check the Firefox and Chrome versions installed on your computer. If none installed, this script will download and install them.

#

Please check and update the corresponding chromedriver and geckodriver versions from:

http://chromedriver.chromium.org/downloads

https://github.com/mozilla/geckodriver/releases

#

Please check the selenium version from: https://selenium-release.storage.googleapis.com/

Set to TRUE to install Chrome and Firefox, or FALSE to skip this step if the correct versions are already installed.

export INSTALL_BROWSERS=TRUE

Set to TRUE/FALSE to enable/disable the CAPABILITY MATCHER

export USE_CAPABILITY_MATCHER=FALSE

Set to TRUE if this is a full desktop environment, FALSE if it's without any display

export DESKTOP_ENVIRONMENT=FALSE

Set to TRUE to use localhost or FALSE to use the host's IP address

export LOCALHOST=FALSE

ChromeDriver and GeckoDriver versions

export GECKO_VERSION=v0.26.0 export CHROMEDRIVER_VERSION=79.0.3945.36

Selenium version

export SELENIUM_VERSION_SHORT=3.141 export SELENIUM_VERSION=3.141.59

Browser versions

export FIREFOX_VERSION=70 export CHROME_VERSION=79

Capability Matcher

export KITE_EXTRAS_VERSION=0.1.4 export GRID_UTILS_VERSION=0.0.1

namvuCosmo commented 4 years ago

And on the grid's console UI (http://HUB_IP:HUB_PORT/grid/console), do you have all the browsers listed, with the correct config that you're calling ? Something like this: (never mind the gateway and binary path) image

image

and same for firefox

KiteTesting commented 4 years ago

Im testing only with Chrome and this is what i get :

image

namvuCosmo commented 4 years ago

Looks like you do have a node registered with chrome 79. Does you config file look like this, for the grid and clients? image

Can the machine/container on which you're running KITE connect to http://172.17.0.2:4444/wd/hub

Please provide the exact info that I require and make sure that your comments are easy to read. It seems that every time you are providing a lot of irrelevant stuff which make it difficult to understand your process and to resolve your issue.

KiteTesting commented 4 years ago

image

image

KiteTesting commented 4 years ago

issue is solved

Lazarus404 commented 4 years ago

@KiteTesting what was your eventual Dockerfile? I have built one myself, but I can't seem to get Chrome to run headless.