-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from moevm/494_selenium+docker
494 selenium+docker
- Loading branch information
Showing
29 changed files
with
492 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Selenium_tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
check_tests: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build docker-compose with docker-compose-selenium (tests) | ||
run: | | ||
cp .env_example .env | ||
cp app/VERSION_example.json app/VERSION.json | ||
docker-compose -f docker-compose.yml -f docker-compose-selenium.yml build | ||
- name: Run docker-compose with docker-compose-selenium (tests) | ||
run: | | ||
docker-compose -f docker-compose.yml -f docker-compose-selenium.yml up -d | ||
chmod +x tests/scripts/docker_check_tests.sh | ||
./tests/scripts/docker_check_tests.sh | ||
# jobs: | ||
# check_tests: | ||
# runs-on: ubuntu-20.04 | ||
|
||
# steps: | ||
# - uses: actions/checkout@v2 | ||
|
||
# - name: Simplify docker-compose file name | ||
# run: mv docker-compose-tests.yml docker-compose.yml | ||
|
||
# - name: Build system images (non-pulling) | ||
# run: | | ||
# # build base image | ||
# docker build -f Dockerfile_base -t osll/slides-base:20230202 . | ||
|
||
# - name: Run docker-compose tests | ||
# run: | | ||
# cp .env_example .env | ||
# docker-compose up -d | ||
# chmod +x tests/scripts/docker_check_tests.sh | ||
# ./tests/scripts/docker_check_tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM selenium/standalone-chrome:121.0-chromedriver-121.0-grid-4.18.0-20240220 | ||
|
||
ENV LOGIN="" | ||
ENV PASSWORD="" | ||
|
||
WORKDIR /usr/src/project | ||
|
||
USER root | ||
RUN apt-get update && \ | ||
apt-get install -y python3 python3-pip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY tests/requirements.txt tests/requirements.txt | ||
RUN pip install -r tests/requirements.txt | ||
COPY tests ./tests | ||
|
||
ENTRYPOINT python3 tests/main.py --login ${LOGIN} --password ${PASSWORD} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"commit": "", | ||
"message": "", | ||
"date": "", | ||
"version": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.8' | ||
|
||
services: | ||
selenium-tests: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile_selenium | ||
environment: | ||
- LOGIN=${ADMIN_PASSWORD} | ||
- PASSWORD=${ADMIN_PASSWORD} | ||
depends_on: | ||
- web | ||
network_mode: service:web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ echo "{ | |
\"message\": \"$COMMIT_MSG\", | ||
\"date\": \"$DATE\", | ||
\"version\": \"$VERSION\" | ||
}" | ||
}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
## For local tests: | ||
|
||
```bash | ||
$ pip install -r tests/requirements.txt | ||
``` | ||
|
||
### Run tests: | ||
|
||
use login and password from .env | ||
You can run tests with your own data: | ||
|
||
```bash | ||
|
||
$ python3 tests/main.py --host host --login login --password password --pres your press --report your report --report_doc your report doc | ||
``` | ||
|
||
or use default setting: | ||
|
||
```bash | ||
$ python3 tests/main.py --login login --password password | ||
``` | ||
|
||
## Docker: | ||
|
||
### Dockerfile | ||
You can run tests with dockerfile_selenium independently, using special flag: | ||
|
||
```bash | ||
$ docker build -t your_image_name -f Dockerfile_selenium . | ||
$ docker run -e LOGIN=your_login -e PASSWORD=your password --network="host" your_image_name | ||
|
||
``` | ||
|
||
### Docker-compose | ||
You can run docker-compose-selenium with docker-compose: | ||
|
||
```bash | ||
$ docker-compose -f docker-compose.yml -f docker-compose-selenium.yml build | ||
$ docker-compose -f docker-compose.yml -f docker-compose-selenium.yml up | ||
|
||
``` | ||
|
||
## List of tests: | ||
|
||
### Test for autorization: | ||
|
||
class AuthTestSelenium(BasicSeleniumTest) with 3 tests | ||
Tests check: if page "/login" opens, if it doesn't take wrong login/password and takes correct. | ||
|
||
### Test for open page /check_list: | ||
|
||
class StatisticTestSelenium(BasicSeleniumTest) with 1 test | ||
Test check: if page "/check_list" opens | ||
|
||
|
||
### Test for open single check card: | ||
|
||
class SingleCheckTestSelenium(BasicSeleniumTest) with 1 test | ||
Test check: if page with random single check opens (from "/check_list") | ||
|
||
### Test for open page /version: | ||
|
||
class VersionTestSelenium(BasicSeleniumTest) with 1 test | ||
Test check: if page "/version" opens and contains info from "VERSION.json" | ||
|
||
### Test for loading report and pres: | ||
|
||
class FileLoadTestSelenium(BasicSeleniumTest) with 3 tests | ||
Test check: if reports wit different extensions loads correctly | ||
use default documents from "/tests" or your own example | ||
|
||
|
Oops, something went wrong.