Skip to content

Commit a732ebe

Browse files
committed
Finish docker execution
1 parent 982b5b0 commit a732ebe

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Anyway, I won't recommend this tool to young Python AQA engineers.
1313

1414
### [Video](https://drive.google.com/file/d/1K2uUlXASjPOiCbCbYkqmuHN26em7bPHs/view?usp=sharing)
1515

16-
## Docker (need to finish)
16+
## Docker
1717
Execute tests - `docker-compose run tests`
1818

1919
Rebuild container - `docker-compose build --no-cache setup`

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ services:
77
- setup
88
volumes:
99
- .:/app
10+
environment:
11+
- DOCKER_RUN=True
1012
setup:
1113
build:
1214
context: .

execute_tests.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
#!/usr/bin/env bash
22
source venv/bin/activate
3-
echo "Installing dependeincies"
3+
echo "-> Installing dependeincies"
44
pip install -r requirements.txt --quiet
55

6-
echo "Removing old Allure results"
6+
echo "-> Removing old Allure results"
77
rm -r allure-results/* || echo "No results"
88

9-
HEADLESS=true
9+
echo "-> Start tests"
10+
pytest -n auto tests --alluredir allure-results
11+
echo "-> Test finished"
1012

11-
echo "Start tests"
12-
pytest -n auto tests --alluredir allure-results
13-
echo "Test finished"
14-
15-
echo "Generating report"
13+
echo "-> Generating report"
1614
allure generate allure-results --clean -o allure-report
17-
echo "Execute 'allure serve' in the command line"
15+
echo "-> Execute 'allure serve' in the command line"

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ def event_loop():
2121

2222
@pytest.fixture(scope='session')
2323
async def page():
24-
headless = True if os.getenv('HEADLESS').lower() == 'true' else False
25-
browser = await chromium.launch(headless=headless)
24+
if os.getenv('DOCKER_RUN'):
25+
browser = await chromium.launch(headless=True, args=['--no-sandbox'])
26+
else:
27+
browser = await chromium.launch(headless=False)
2628
page = await browser.newPage()
2729
global PAGE
2830
PAGE = page

0 commit comments

Comments
 (0)