Skip to content

Commit 982b5b0

Browse files
committed
Update to docker-compose.yml
1 parent 436c8bf commit 982b5b0

File tree

7 files changed

+36
-31
lines changed

7 files changed

+36
-31
lines changed

Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,12 @@ RUN apt-get install -y libnss3 \
3737
libxss1 \
3838
libasound2
3939

40-
RUN mkdir /playwright_tests
41-
WORKDIR /playwright_tests
42-
COPY * /playwright_tests/
40+
ADD requirements.txt /
4341

4442
RUN pip install --upgrade pip && \
4543
pip install virtualenv && \
4644
virtualenv --python=/usr/bin/python3 /opt/venv && \
4745
. /opt/venv/bin/activate && \
4846
python3.7 -m pip install -r requirements.txt --quiet
4947

50-
ADD . /playwright_tests
51-
52-
CMD . /opt/venv/bin/activate && sh execute_tests.sh
48+
WORKDIR /app

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ Just a [Playwright Python](https://github.com/Microsoft/playwright-python) tool
88
I didn't enjoy this tool, cause it's very complicated. It totally looks like it just has been translated
99
from JS Playwright and need to wright on Python usign JS style. So annoying. But this tools is pretty
1010
fast.
11-
###
11+
1212
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

1616
## Docker (need to finish)
17-
Execute tests - `run_docker.sh`
17+
Execute tests - `docker-compose run tests`
18+
19+
Rebuild container - `docker-compose build --no-cache setup`

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
services:
3+
tests:
4+
image: playw_python
5+
command: ./execute_tests.sh
6+
depends_on:
7+
- setup
8+
volumes:
9+
- .:/app
10+
setup:
11+
build:
12+
context: .
13+
dockerfile: Dockerfile
14+
image: playw_python

execute_tests.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/usr/bin/env bash
2-
rm -r allure-results/*
2+
source venv/bin/activate
3+
echo "Installing dependeincies"
4+
pip install -r requirements.txt --quiet
5+
6+
echo "Removing old Allure results"
7+
rm -r allure-results/* || echo "No results"
8+
39
HEADLESS=true
10+
11+
echo "Start tests"
412
pytest -n auto tests --alluredir allure-results
13+
echo "Test finished"
514

6-
allure generate allure-results --clean -o allure-report
15+
echo "Generating report"
16+
allure generate allure-results --clean -o allure-report
17+
echo "Execute 'allure serve' in the command line"

run_docker.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def event_loop():
2121

2222
@pytest.fixture(scope='session')
2323
async def page():
24-
browser = await chromium.launch(headless=os.getenv('HEADLESS', False))
24+
headless = True if os.getenv('HEADLESS').lower() == 'true' else False
25+
browser = await chromium.launch(headless=headless)
2526
page = await browser.newPage()
2627
global PAGE
2728
PAGE = page

tests/test_shop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import allure
2+
import pytest
23
from allure_commons._allure import step
34

45
from page_objects.registation.registration_object import RegistrationPage

0 commit comments

Comments
 (0)