Skip to content

Commit

Permalink
Add source code from current branch, not clone from master.
Browse files Browse the repository at this point in the history
Signed-off-by: kkanova <kkanova@redhat.com>
  • Loading branch information
Katka92 committed Jun 19, 2019
1 parent ba89a2d commit b277ac7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
10 changes: 2 additions & 8 deletions dockerfiles/e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENV LANG=en_US.utf8 \
FABRIC8_USER_NAME=fabric8

COPY google-chrome.repo /etc/yum.repos.d/google-chrome.repo
COPY e2e /root/e2e
RUN yum install --assumeyes epel-release && \
yum update --assumeyes && \
yum install --assumeyes google-chrome-stable && \
Expand All @@ -30,15 +31,8 @@ RUN yum install --assumeyes epel-release && \
chromedriver_version=$(curl -s -g https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${chrome_version}) && \
$(curl -sS -g https://chromedriver.storage.googleapis.com/${chromedriver_version}/chromedriver_linux64.zip > chromedriver_linux64.zip) && \
unzip chromedriver_linux64.zip && mv chromedriver /usr/bin/chromedriver && chmod +x /usr/bin/chromedriver && rm chromedriver_linux64.zip && \
# Clone e2e from eclipse/che repo.
cd root && \
git init && \
git remote add upstream https://github.com/eclipse/che.git && \
git config core.sparsecheckout true && \
echo "e2e/*" >> .git/info/sparse-checkout && \
git pull --depth=1 upstream master && \
# Download all dependencies for e2e tests
cd e2e && \
cd /root/e2e && \
npm --silent i

WORKDIR /root/
Expand Down
19 changes: 9 additions & 10 deletions dockerfiles/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,34 @@ installed Docker on your machine.
These tests serves for testing Che 7 happy path. You can see description about these tests here: https://github.com/eclipse/che/tree/master/e2e.

## How to run it
The easiest way is to run them via Docker. To build&run locally you have go to this folder and execute following command:
The easiest way is to run them via Docker. To build locally you have go to ` dockerfiles ` folder and execute following command:

```
docker build -t che7_tests .
./e2e/build.sh
```
This command builds docker
image named ` che7_tests `.
Once image is build, you can run the tests inside this docker image. You have to set URL of running Che and increase shared memory size (low shared memory makes chrome driver crash).
This command builds docker image named ` eclipse/che-e2e:nightly `. This image is build nightly and pushed to registry, so you don't have to build that image locally.
You can run the tests inside this docker image. You have to set URL of running Che and increase shared memory size (low shared memory makes chrome driver crash).

```
docker run --shm-size=256m -e THEIA_SELENIUM_BASE_URL=$URL che7_tests
docker run --shm-size=256m -e THEIA_SELENIUM_BASE_URL=$URL eclipse/che-e2e:nightly
```

If you want to gather screenshots of fallen tests, you have to mount a volume to the docker file. Create a folder, when you want to have the screenshots saved. Then run
a command:

```
docker run --shm-size=256m -v /full/path/to/your/folder:/root/e2e/report:Z -e THEIA_SELENIUM_BASE_URL=$URL che7_tests
docker run --shm-size=256m -v /full/path/to/your/folder:/root/e2e/report:Z -e THEIA_SELENIUM_BASE_URL=$URL eclipse/che-e2e:nightly
```

###Debugging
####Running own code
If you have done some changes locally and you want to test them, you can mount your code directly to the Docker. If you do so, your mounted code will be executed instead of the code from master.
If you have done some changes locally and you want to test them, you can mount your code directly to the Docker. If you do so, your mounted code will be executed instead of the code that is already in an image.

```
docker run --shm-size=256m -v /full/path/to/your/e2e/folder:/root/local_tests:Z -e THEIA_SELENIUM_BASE_URL=$URL che7_tests
docker run --shm-size=256m -v /full/path/to/your/e2e/folder:/root/local_tests:Z -e THEIA_SELENIUM_BASE_URL=$URL eclipse/che-e2e:nightly
```

NOTE: If you want to run your own code and gather screenshots, you have to change the mount from ` /root/e2e/report:Z ` to ` /root/local_tests/report:Z `.

####Watching Chrome
If you want to see what is going on in chrome inside a docker, you can use VNC. When running a docker, you can see API where you can connect. This API is on the first line of output and can look like that: ` You can wath localy using VNC with IP: 172.17.0.2 `. Then you can easily join VNC using this API: ` 172.17.0.2:0 `.
If you want to see what is going on in chrome inside a docker, you can use VNC. When running a docker, you can see API where you can connect. This API is on the first line of output and can look like that: ` You can watch locally using VNC with IP: 172.17.0.2 `. Then you can easily join VNC using this API: ` 172.17.0.2:0 `.
27 changes: 27 additions & 0 deletions dockerfiles/e2e/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Copyright (c) 2017 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

base_dir=$(cd "$(dirname "$0")"; pwd)
. "${base_dir}"/../build.include

E2E_DIR="${base_dir}/../../e2e"
LOCAL_E2E_DIR="${base_dir}/e2e"

if [ -d $LOCAL_E2E_DIR ]; then
rm -rf $LOCAL_E2E_DIR
fi

echo "Copying source code ${E2E_DIR} --> ${LOCAL_E2E_DIR}"
cp -r "${E2E_DIR}" "${LOCAL_E2E_DIR}"

init --name:e2e "$@"
build

# cleanup
rm -rf $LOCAL_E2E_DIR
6 changes: 3 additions & 3 deletions dockerfiles/e2e/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ x11vnc -display :1.0 > /dev/null 2>&1 &
export DISPLAY=:1.0

hostname=$(hostname -I)
echo "You can wath localy using VNC with IP: $hostname"
echo "You can watch locally using VNC with IP: $hostname"

if mount | grep 'local_tests'; then
echo "The local scripts are mounted. Executing local scripts."
echo "The local code is mounted. Executing local code."
cd local_tests
npm i
else
echo "Executing e2e tests from master branch."
echo "Executing e2e tests from an image."
cd e2e
fi

Expand Down

0 comments on commit b277ac7

Please sign in to comment.