From 32c3eb3a0ecc1d105c13d090a6ec1bfdb81115ea Mon Sep 17 00:00:00 2001 From: Thomas Suckow Date: Thu, 7 Jan 2021 21:43:58 -0800 Subject: [PATCH] Selenium Docker Actions --- .github/workflows/ci.yml | 8 +------- guiTests/guiTest.py | 2 +- pipeline/selenium/docker/Dockerfile | 10 ++++++++++ pipeline/selenium/docker/runner.sh | 9 +++++++++ pipeline/selenium/test.sh | 6 ++++++ 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 pipeline/selenium/docker/Dockerfile create mode 100755 pipeline/selenium/docker/runner.sh create mode 100755 pipeline/selenium/test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 962d54101..269e09899 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,12 +31,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.101 - - name: Build - run: dotnet publish -r linux-x64 -o publish/ Duplicati.sln - name: Selenium - run: docker images + run: pipeline/selenium/test.sh \ No newline at end of file diff --git a/guiTests/guiTest.py b/guiTests/guiTest.py index b635c5d11..811970b07 100644 --- a/guiTests/guiTest.py +++ b/guiTests/guiTest.py @@ -74,7 +74,7 @@ driver.implicitly_wait(10) driver.get("http://localhost:8200/ngax/index.html") if "Duplicati" not in driver.title: - raise Exception("Unable to load duplicati GUI!") + raise Exception("Unable to load duplicati GUI! Got: " + driver.title) # Create and hash random files in the source folder write_random_file(1024 * 1024, SOURCE_FOLDER + os.sep + "1MB.test") diff --git a/pipeline/selenium/docker/Dockerfile b/pipeline/selenium/docker/Dockerfile new file mode 100644 index 000000000..a565835aa --- /dev/null +++ b/pipeline/selenium/docker/Dockerfile @@ -0,0 +1,10 @@ +FROM selenium/standalone-firefox + +ENV DEBIAN_FRONTEND=noninteractive +RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O ~/packages-microsoft-prod.deb +RUN sudo dpkg -i ~/packages-microsoft-prod.deb +RUN sudo apt-get update && sudo apt-get install -y python3-pip rsync dotnet-sdk-5.0 +RUN pip3 install selenium + +ADD runner.sh / +CMD /runner.sh \ No newline at end of file diff --git a/pipeline/selenium/docker/runner.sh b/pipeline/selenium/docker/runner.sh new file mode 100755 index 000000000..bb6cd50ff --- /dev/null +++ b/pipeline/selenium/docker/runner.sh @@ -0,0 +1,9 @@ +mkdir /home/seluser/published/ +chmod +S /home/seluser/published/ +sudo dotnet publish -o /home/seluser/published/ /sources/Duplicati.sln + +cd +AUTOUPDATER_Duplicati_SKIP_UPDATE=1 "/home/seluser/published/Duplicati.Server" & +timeout 240 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; echo Checking if server started...; done' 127.0.0.1 8200 +echo Running Tests... +python3 /sources/guiTests/guiTest.py \ No newline at end of file diff --git a/pipeline/selenium/test.sh b/pipeline/selenium/test.sh new file mode 100755 index 000000000..240f08ff5 --- /dev/null +++ b/pipeline/selenium/test.sh @@ -0,0 +1,6 @@ +SCRIPTDIR=$( cd "$(dirname "$0")" ; pwd -P ) + +docker build $SCRIPTDIR/docker -t duplicati-selenium + +export MSYS_NO_PATHCONV=1 +docker run --rm -v $SCRIPTDIR/../../:/sources duplicati-selenium \ No newline at end of file