Skip to content

Commit 436c8bf

Browse files
committed
Add video and docker
1 parent b7ff7fb commit 436c8bf

File tree

5 files changed

+79
-11
lines changed

5 files changed

+79
-11
lines changed

Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM ubuntu:bionic
2+
3+
# Install Python
4+
RUN apt-get update && apt-get install -y python3.7 && apt-get install -y curl
5+
RUN curl -O https://bootstrap.pypa.io/get-pip.py
6+
RUN apt-get install -y python3-pip
7+
RUN apt-get install -y python3-distutils
8+
RUN python3.7 get-pip.py
9+
RUN python3.7 -m pip install -U setuptools
10+
11+
# Install Allure.
12+
# See https://github.com/allure-framework/allure-debian/issues/9
13+
RUN apt-get update && apt-get install -y wget default-jdk && cd /opt && \
14+
(wget -c https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.7.0/allure-2.7.0.tgz -O - | tar -xz && chmod +x allure-2.7.0/bin/allure)
15+
ENV PATH="${PATH}:/opt/allure-2.7.0/bin"
16+
RUN allure --version
17+
18+
# 2. Install WebKit dependencies
19+
RUN apt-get install -y libwoff1 \
20+
libopus0 \
21+
libwebp6 \
22+
libwebpdemux2 \
23+
libenchant1c2a \
24+
libgudev-1.0-0 \
25+
libsecret-1-0 \
26+
libhyphen0 \
27+
libgdk-pixbuf2.0-0 \
28+
libegl1 \
29+
libnotify4 \
30+
libxslt1.1 \
31+
libevent-2.1-6 \
32+
libgles2 \
33+
libvpx5
34+
35+
# 3. Install Chromium dependencies
36+
RUN apt-get install -y libnss3 \
37+
libxss1 \
38+
libasound2
39+
40+
RUN mkdir /playwright_tests
41+
WORKDIR /playwright_tests
42+
COPY * /playwright_tests/
43+
44+
RUN pip install --upgrade pip && \
45+
pip install virtualenv && \
46+
virtualenv --python=/usr/bin/python3 /opt/venv && \
47+
. /opt/venv/bin/activate && \
48+
python3.7 -m pip install -r requirements.txt --quiet
49+
50+
ADD . /playwright_tests
51+
52+
CMD . /opt/venv/bin/activate && sh execute_tests.sh

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ fast.
1111
###
1212
Anyway, I won't recommend this tool to young Python AQA engineers.
1313

14-
### [Video](https://drive.google.com/open?id=1P6SXIADubK4k5EXOnd5ZSPeo4n7GEG0p)
14+
### [Video](https://drive.google.com/file/d/1K2uUlXASjPOiCbCbYkqmuHN26em7bPHs/view?usp=sharing)
1515

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

execute_tests.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/env bash
22
rm -r allure-results/*
3-
4-
source venv/bin/activate
5-
pip install -r requirements.txt --quiet
6-
3+
HEADLESS=true
74
pytest -n auto tests --alluredir allure-results
85

9-
allure serve
6+
allure generate allure-results --clean -o allure-report

run_docker.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
docker build -t playwright_test_image .
3+
docker run --name test_playwright_container -i playwright_test_image
4+
docker cp test_playwright_container:/playwright_tests/allure-results ./
5+
docker stop test_playwright_container
6+
docker rm test_playwright_container
7+
8+
9+
## Install allure
10+
## Linux
11+
#sudo apt-add-repository ppa:qameta/allure
12+
#sudo apt-get update
13+
#sudo apt-get install allure
14+
## Mac
15+
#brew install allure
16+
17+
## Open generated report
18+
19+
rm -r allure-results/*
20+
allure serve

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import os
23

34
import allure
45
import pytest
@@ -20,7 +21,7 @@ def event_loop():
2021

2122
@pytest.fixture(scope='session')
2223
async def page():
23-
browser = await chromium.launch(headless=False)
24+
browser = await chromium.launch(headless=os.getenv('HEADLESS', False))
2425
page = await browser.newPage()
2526
global PAGE
2627
PAGE = page

0 commit comments

Comments
 (0)