Coder Social home page Coder Social logo

neetjn / py-selenium-browser Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 52 KB

Decorators for provisioning tests with remote webdrivers.

Home Page: https://neetjn.github.io/py-selenium-browser/

License: MIT License

Python 98.34% Makefile 1.66%
python nose nosetests selenium provisioning browsers webdriver test

py-selenium-browser's Introduction

py-selenium-browser

build PyPI version codecov

Decorators for provisioning tests with selenium remote webdrivers.

For an all inclusive selenium framework check out py-component-controller!

About

py-selenium-browser is a very simple project based off of nose_parammeterzed. This project provides very simple and easily configurable decorators to parameterize individual tests to run against multiple browser configurations against your stack.

Usage

py-selenium-browser supports both Python 2.7 and 3.6 and can be installed with pip like so,

pip install pysbr

Import Decorators and Configure from pysbr to get started,

import os
from selenium import webdriver
from unittest import TestCase

from pysbr import Configure, Decorators


Configure.platforms(name='chrome', platforms=['WIN10'])
Configure.capabilities(name='edge', capabilities={
    'version': '5'
})
Configure.profile(name='safari', profile=None)
Configure.enable(name='firefox')
Configure.disable(name='opera')

COMMAND_EXECUTOR = os.environ.get('COMMAND_EXECUTOR')


class SampleTest(TestCase):

    @Decorators.browsers()
    def test_login(self, capabilities, profile):
        browser = webdriver.Remote(
            COMMAND_EXECUTOR, capabilities, profile)
        ...
        browser.stop_client()
        
    @Decorators.browser(name='chrome', platform='WIN10')
    def test_register(self, capabilities, profile):
        ...
        
    @Decorators.random_browser()
    def test_logout(self, capabilities, profile):
        ...

This project supports the Chrome, Firefox, Edge, Safari, and Opera browsers by default -- but other browsers can be defined like so,

from pysbr.constants import BROWSERS

BROWSERS.ANDROID = BROWSERS.BROWSER(
    name, platforms, capabilities=None, profile=None)
BROWSERS.browsers.append(BROWSERS.ANDROID)

All browsers also disabled by default, so be sure to enable them prior to use with the decorators.

Testing

All module related unit tests are in the tests subdirectory.

To setup your environment run make setup. To run the test suite, use make test.

Requirements:

  • Python 2.7, 3.6 (with pip)

Contributors

Contributing guidelines are as follows,

  • Any new features added must also be unit tested in the tests subdirectory.
  • Branches for bugs and features should be structured like so, issue-x-username.
  • Include your name and email in the contributors list.

Copyright (c) 2017 John Nolette Licensed under the MIT license.

py-selenium-browser's People

Contributors

neetjn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.