Code Monkey home page Code Monkey logo

sind's Introduction


A minimal framework to automate web Actions/Plans, and run them in a containerized fashion.

build status

Structure

The project is composed of :

  • drivers/ : Contains the webdrivers for both chrome & firefox.
  • tests/ : Where you puts your tests.
  • downloads/ : An optional folder in case your selenium script will need to download/save something for the web.
  • Dockerfile.chrome : Dockerfile with necessary prerequisite for chrome browser.
  • main.py : Entry file.
  • Pipefile : Dev Packages.
  • plan.py : Example plan file.
  • start.sh : bash script used as entrypoint for the docker image.

Example Scenario

You will find in the current structure an example plan in the plan.py file.

You can start and override the file directly, or create your custom plans in separate files.

Don't forget to import your plan in the main.py file.

from plan import ExecutionPlan
..
..
..

executionPlan = ExecutionPlan(browser=driver, display=display, login=LOGIN, password=PASSWORD)
executionPlan.run(URL)

Development

While on development phase, you might need to run the plan locally and see your selenium script.

Make sure to have the following points marked.

  1. Install some tools :
$ sudo apt-get install -y xvfb xserver-xephyr
$ sudo apt-get install scrot -y
  1. Setup environment & dependencies
$ pip install pipenv 
$ make shell
$ make install
  1. Run your app :
$ make run

Run your tests

$ make test

Production

Once you've finished writing your scenario, you will then start by building a docker image :

$ IMAGE_TAG=custom_image:1.0  make image

And run it like :

$ docker run custom_image:1.0 
# Or 
$ docker run -v /tmp/screens:/home/agent/screenshots custom_image:1.0 
# Or
$ docker run -v /tmp/screens:/home/agent/screenshots -v /tmp/downloads:/home/agent/screenshots custom_image:1.0 
# You can also pass environments variables at runtime
# List can be found on the dockerfile

Available Tools :

  • selenium : Trivial
  • pyautogui : When selenium is no longer enough for slightly complex actions
  • pyscreenshot : To screen the execution state.

© 2020, Ayoub Ed-dafali.

forthebadge

sind's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vucko95

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.