-
Notifications
You must be signed in to change notification settings - Fork 0
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 #28 from fscherf/fscherf/dev/master
add support for external sites
- Loading branch information
Showing
36 changed files
with
1,507 additions
and
384 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,41 @@ | ||
FROM mcr.microsoft.com/playwright:v1.38.1-jammy | ||
|
||
ARG UID=1000 GID=1000 | ||
|
||
# install pyenv dependencies | ||
RUN apt update && apt upgrade -y && \ | ||
# tzdata (required by pyenv dependencies) \ | ||
DEBIAN_FRONTEND=noninteractive TZ=Gmt/UTC apt install -y tzdata && \ | ||
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment \ | ||
apt install -y git build-essential libssl-dev zlib1g-dev libbz2-dev \ | ||
libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils \ | ||
tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev && \ | ||
# milan dependencies \ | ||
apt install -y socat | ||
|
||
# setup pyenv | ||
RUN git clone https://github.com/yyuu/pyenv.git .pyenv | ||
ENV PYENV_ROOT $HOME/.pyenv | ||
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH | ||
|
||
RUN pyenv install 3.8:latest | ||
RUN pyenv install 3.9:latest | ||
RUN pyenv install 3.10:latest | ||
RUN pyenv install 3.11:latest | ||
|
||
RUN pyenv global `pyenv versions --bare` | ||
|
||
# setup commandline tools | ||
RUN pip3.8 install --upgrade pip tox | ||
RUN pyenv rehash | ||
FROM ubuntu:focal | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG PYTHON_VERSIONS="3.7 3.8 3.9 3.10 3.11 3.12" | ||
ARG PYTHON_VERSION="3.11" | ||
|
||
# setup /milan | ||
RUN mkdir /milan | ||
|
||
COPY ./milan /milan/milan | ||
COPY ./bin /milan/bin | ||
COPY ./pyproject.toml /milan/pyproject.toml | ||
|
||
# Ubuntu dependencies | ||
RUN apt update && \ | ||
apt-get install -y software-properties-common && \ | ||
add-apt-repository ppa:deadsnakes/ppa && \ | ||
apt update && \ | ||
for version in ${PYTHON_VERSIONS}; do \ | ||
apt install -y \ | ||
python${version} \ | ||
python${version}-dev \ | ||
python${version}-venv && \ | ||
python${version} -m ensurepip --upgrade \ | ||
; done | ||
|
||
# python dependencies | ||
RUN python${PYTHON_VERSION} -m pip install /milan[docker] | ||
|
||
# setup playwright | ||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright | ||
|
||
RUN python${PYTHON_VERSION} -m playwright install-deps | ||
RUN python${PYTHON_VERSION} -m playwright install | ||
|
||
RUN chmod -R 777 /ms-playwright | ||
|
||
# setup user | ||
RUN adduser milan | ||
|
||
USER milan |
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,14 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
|
||
from milan.cli.cli import cli | ||
|
||
|
||
if __name__ == '__main__': | ||
exit_code = cli( | ||
argv=sys.argv, | ||
setup_logging=True, | ||
) | ||
|
||
sys.exit(exit_code) |
File renamed without changes.
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,16 @@ | ||
def main(browser, cli_args): | ||
|
||
# navigate to view | ||
browser.navigate('localhost:8080') | ||
browser.await_element('h1') | ||
browser.await_text('h1', 'Milan Demo Application') | ||
|
||
# fill out form | ||
browser.fill('#text-input', 'foo') | ||
browser.select('#select', label='Option 17') | ||
browser.check('#check-box', True) | ||
|
||
# open popup | ||
browser.click('#open') | ||
browser.fill('#text-input-2', 'bar') | ||
browser.click('#close') |
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,11 @@ | ||
def main(browser, cli_args): | ||
|
||
# open first popup | ||
browser.navigate('localhost:8080', window=0) | ||
browser.click('#open', window=0) | ||
browser.fill('#text-input-2', 'foo', window=0) | ||
|
||
# open second popup | ||
browser.navigate('localhost:8080', window=1) | ||
browser.click('#open', window=1) | ||
browser.fill('#text-input-2', 'bar', window=1) |
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,5 @@ | ||
def open_trending_movies(browser, cli_args): | ||
browser.navigate('youtube.com') | ||
browser.click('#guide-button') | ||
browser.click('[title=Trending]') | ||
browser.click('[tab-title=Movies]') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,7 +1,34 @@ | ||
import logging | ||
|
||
from milan.chromium import Chromium # NOQA | ||
from milan.firefox import Firefox # NOQA | ||
from milan.webkit import Webkit # NOQA | ||
from milan.errors import * # NOQA | ||
|
||
VERSION = (0, 0, 0) | ||
VERSION_STRING = '.'.join(str(i) for i in VERSION) | ||
|
||
BROWSER = { | ||
'chromium': Chromium, | ||
'chrome': Chromium, | ||
'firefox': Firefox, | ||
'webkit': Webkit, | ||
'safari': Webkit, | ||
} | ||
|
||
logger = logging.getLogger('milan') | ||
|
||
|
||
def get_browser_by_name(name): | ||
logging.debug('searching for a browser by name "%s"', name) | ||
|
||
_name = name.strip().lower() | ||
|
||
if _name not in BROWSER: | ||
raise RuntimeError(f'No browser with name "{name}" found') | ||
|
||
browser = BROWSER[_name] | ||
|
||
logging.debug('%s found', browser) | ||
|
||
return browser |
Oops, something went wrong.