Compare commits
4 commits
main
...
playwright
Author | SHA1 | Date | |
---|---|---|---|
8990d1ed01 | |||
6b7c707135 | |||
1bc481ffca | |||
9d64bd3bcb |
|
@ -1,4 +1,4 @@
|
|||
name: Python Tests
|
||||
name: All Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
@ -13,7 +13,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build the Stack
|
||||
run: docker-compose -f docker-compose-dev.yaml build
|
||||
|
@ -21,18 +21,11 @@ jobs:
|
|||
- name: Start containers
|
||||
run: docker-compose -f docker-compose-dev.yaml up -d
|
||||
|
||||
- name: List containers
|
||||
run: docker ps
|
||||
|
||||
- name: Sleep for 60 seconds
|
||||
run: sleep 60s
|
||||
shell: bash
|
||||
|
||||
- name: Run Django Tests
|
||||
run: docker-compose -f docker-compose-dev.yaml exec --env TESTING=True -T web pytest
|
||||
|
||||
# Run with coverage, saves report on htmlcov dir
|
||||
# run: docker-compose -f docker-compose-dev.yaml exec --env TESTING=True -T web pytest --cov --cov-report=html --cov-config=.coveragerc
|
||||
# - name: Ensure browsers are installed
|
||||
# run: docker-compose -f docker-compose-dev.yaml exec --env TESTING=True -T web python -m playwright install chrome --with-deps
|
||||
|
||||
- name: Run all tests
|
||||
run: docker-compose -f docker-compose-dev.yaml exec --env TESTING=True -T web pytest
|
||||
|
||||
- name: Tear down the Stack
|
||||
run: docker-compose -f docker-compose-dev.yaml down
|
|
@ -1,4 +1,4 @@
|
|||
FROM mediacms/mediacms:latest
|
||||
FROM brunneis/python:3.8.6-ubuntu-focal AS compile-image
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
|
@ -7,10 +7,76 @@ ENV VIRTUAL_ENV=/home/mediacms.io
|
|||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
ENV PIP_NO_CACHE_DIR=1
|
||||
|
||||
RUN cd /home/mediacms.io && python3 -m venv $VIRTUAL_ENV
|
||||
RUN mkdir -p /home/mediacms.io/mediacms/{logs} && cd /home/mediacms.io && python3 -m venv $VIRTUAL_ENV
|
||||
|
||||
COPY requirements.txt .
|
||||
COPY requirements-dev.txt .
|
||||
RUN pip install -r requirements-dev.txt
|
||||
|
||||
RUN set -x \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
gcc libc6-dev wget unzip
|
||||
|
||||
# Install dependencies:
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . /home/mediacms.io/mediacms
|
||||
WORKDIR /home/mediacms.io/mediacms
|
||||
|
||||
RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip && \
|
||||
unzip Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip -d ../bento4 && \
|
||||
mv ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux/* ../bento4/ && \
|
||||
rm -rf ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux && \
|
||||
rm -rf ../bento4/docs && \
|
||||
rm Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip
|
||||
|
||||
############ RUNTIME IMAGE ############
|
||||
FROM brunneis/python:3.8.6-ubuntu-focal AS runtime-image
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# See: https://github.com/celery/celery/issues/6285#issuecomment-715316219
|
||||
ENV CELERY_APP='cms'
|
||||
|
||||
# Use these to toggle which processes supervisord should run
|
||||
ENV ENABLE_UWSGI='yes'
|
||||
ENV ENABLE_NGINX='yes'
|
||||
ENV ENABLE_CELERY_BEAT='yes'
|
||||
ENV ENABLE_CELERY_SHORT='yes'
|
||||
ENV ENABLE_CELERY_LONG='yes'
|
||||
ENV ENABLE_MIGRATIONS='yes'
|
||||
|
||||
# Set up virtualenv
|
||||
ENV VIRTUAL_ENV=/home/mediacms.io
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
COPY --chown=www-data:www-data --from=compile-image /home/mediacms.io /home/mediacms.io
|
||||
|
||||
RUN apt-get update -y && apt-get -y upgrade && apt-get install --no-install-recommends \
|
||||
supervisor nginx imagemagick procps wget xz-utils -y && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt-get purge --auto-remove && \
|
||||
apt-get clean
|
||||
|
||||
RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
|
||||
mkdir -p ffmpeg-tmp && \
|
||||
tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components 1 -C ffmpeg-tmp && \
|
||||
cp -v ffmpeg-tmp/ffmpeg ffmpeg-tmp/ffprobe ffmpeg-tmp/qt-faststart /usr/local/bin && \
|
||||
rm -rf ffmpeg-tmp ffmpeg-release-amd64-static.tar.xz
|
||||
|
||||
WORKDIR /home/mediacms.io/mediacms
|
||||
|
||||
COPY requirements-dev.txt .
|
||||
|
||||
RUN pip install -r requirements-dev.txt
|
||||
|
||||
RUN playwright install chrome --with-deps
|
||||
|
||||
|
||||
EXPOSE 9000 80
|
||||
|
||||
RUN chmod +x ./deploy/docker/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["./deploy/docker/entrypoint.sh"]
|
||||
|
||||
CMD ["./deploy/docker/start.sh"]
|
||||
|
|
|
@ -12,3 +12,4 @@ pytest-cov
|
|||
pytest-django
|
||||
pytest-factoryboy
|
||||
Faker
|
||||
pytest-playwright==0.3.0
|
40
tests/e2e/test_actions.py
Normal file
40
tests/e2e/test_actions.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
import re
|
||||
from playwright.sync_api import Page, expect
|
||||
|
||||
|
||||
def test_register_link(page: Page):
|
||||
page.goto("https://demo.mediacms.io/")
|
||||
|
||||
# Expect a title "to contain" a substring.
|
||||
expect(page).to_have_title(re.compile("MediaCMS"))
|
||||
|
||||
# create a locator
|
||||
get_started = page.get_by_role("link", name="REGISTER")
|
||||
|
||||
# Expect an attribute "to be strictly equal" to the value.
|
||||
expect(get_started).to_have_attribute("href", "/accounts/signup/")
|
||||
|
||||
# Click the get started link.
|
||||
get_started.click()
|
||||
|
||||
# Expects the URL to contain intro.
|
||||
expect(page).to_have_url(re.compile(".*signup"))
|
||||
|
||||
def test_login_link(page: Page):
|
||||
page.goto("https://demo.mediacms.io/")
|
||||
|
||||
# Expect a title "to contain" a substring.
|
||||
expect(page).to_have_title(re.compile("MediaCMS"))
|
||||
|
||||
# create a locator
|
||||
get_started = page.get_by_role("link", name="SIGN IN")
|
||||
|
||||
# Expect an attribute "to be strictly equal" to the value.
|
||||
expect(get_started).to_have_attribute("href", "/accounts/login/")
|
||||
|
||||
# Click the get started link.
|
||||
get_started.click()
|
||||
|
||||
# Expects the URL to contain intro.
|
||||
expect(page).to_have_url(re.compile(".*login"))
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# from django.test import TestCase
|
||||
# from selenium import webdriver
|
||||
# from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
#
|
||||
#
|
||||
# class SeleniumTest(TestCase):
|
||||
# def setUp(self):
|
||||
# self.chrome = webdriver.Remote(command_executor='http://selenium_hub:4444/wd/hub', desired_capabilities=DesiredCapabilities.CHROME)
|
||||
# self.chrome.implicitly_wait(10)
|
||||
#
|
||||
# def test_visit_site_with_chrome(self):
|
||||
# self.chrome.get('http://web/admin')
|
||||
# self.assertIn(self.chrome.title, "Log in | Django site admin")
|
Loading…
Reference in a new issue