GithubHelp home page GithubHelp logo

netzulo / qacode Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 1.78 MB

Main Library written on python to execute functional tests throught selenium API coded down w3c webdriver specification

License: GNU General Public License v3.0

Python 99.33% Makefile 0.29% Batchfile 0.39%
selenium selenium-python functional testing tests webscrapper chrome-headless firefoxdriver chromedriver headless-chrome

qacode's Introduction

QA Code

Issues on Github

Pull Request opened on Github

Release version on Github

Release date on Github

Branch Linux Deploy Windows Deploy CircleCI - Docker CodeClimate

master

image image image image

Python tested versions

3.7 3.6 3.5 <=3.4

Supported

Supported

Supported

Not Supported

How to install ?

  • Install from PIP : pip install qacode
  • Install from setup.py file : python setup.py install

Documentation

How to exec tests ?

  • Tests from setup.py file : python setup.py test
  • Install from PIP file : pip install tox
  • Tests from tox : tox -l && tox -e TOX_ENV_NAME ( see tox.ini file to get environment names )
TOX Env name Env description
py35,py36,py37 Python supported versions
flake8 Exec linter in qalab/ tests/
coverage Generate XML and HTML reports
docs Generate doc HTML in /docs

Configuration File

{
  "bot": {
    "log_output_file": "logs/",
    "log_name": "qacode",
    "log_level": "DEBUG",
    "mode": "remote",
    "browser": "chrome",
    "options": { "headless": false },
    "url_hub": "http://localhost:11000/wd/hub",
    "drivers_path": "../qadrivers",
    "drivers_names": [
      "chromedriver_32.exe",
      "chromedriver_64.exe",
      "chromedriver_32",
      "chromedriver_64",
      "firefoxdriver_32.exe",
      "firefoxdriver_64.exe",
      "firefoxdriver_64.exe",
      "firefoxdriver_32",
      "phantomjsdriver_32.exe",
      "phantomjsdriver_64.exe",
      "phantomjsdriver_32",
      "phantomjsdriver_64",
      "iexplorerdriver_32.exe",
      "iexplorerdriver_64.exe",
      "edgedriver_32.exe",
      "edgedriver_64.exe"
    ]
  }
}

Getting Started

Just starting example of usage before read Usage Guide (or refer to `QAcode's Documentation`_).

from qacode.core.bots.bot_base import BotBase
from qacode.core.webs.controls.control_base import ControlBase
from qacode.utils import settings


SETTINGS = settings(
    file_path="/home/user/config/dir/",
    file_name="settings.json"
)


try:
    bot = BotBase(**SETTINGS)
    bot.navigation.get_url("http://the-internet.herokuapp.com/login")
    ctl_config = { "selector": "input[name='username']"}
    ctl = ControlBase(bot, **ctl_config)
    # END
    import pdb; pdb.set_trace() # TODO, remove DEBUG lane
    print(ctl)
except Exception as err:
    print("ERROR: {}".format(err))
finally:
    bot.close()

qacode's People

Contributors

netzulo avatar terseus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

orenault

qacode's Issues

document about add support to Android/IOS , native and hybrid apps

Appium library doc: https://appium.io/slate/en/master/?python#mobile-chrome-on-emulator-or-real-device

  • Reading about: https://github.com/appium/appium-desktop
  • SYS : Implement new server Appium
  • DEV: include new remote drivers for Appium
  • DEV: create new tests base classes inheritance for mobile devices
  • DEV: create new funciontals tests for Appium remote and local drivers
  • DEV: add new functionality to settings JSON file
  • DEV: update README

ControlForm

Before this issue

  • renoum all modules for library #84

SPECs

  • For instantiation
    • must contain valid tags configurable for each ControlForm | REQUIRED
    • must contain valid html attrs configurable for each ControlForm | Optional
    • must contain valid css rules configurable for each ControlForm | Optional

MOVED TO #121

  • must contain valid js events handlers configurable for each ControlForm | Optional

Tests

  • Create Test for ControlForm, instance by element
  • Create Test for ControlForm, instance by selector
  • Create Test for ControlForm, instance raises if search is False

TODO ControlBase Class

Requisites for ControlBase class

  • Can be instanced with one selector
  • Can be instanced with one WebElement instanced element

Methods

  • type() : must exec send_keys from selenium
  • click(): just OnClick over element
  • text() : must return element content text
  • attrs(attr_names=[]): find a list of attributes on WebElement with this name
  • attr(attr_name, attr_value=None):
    • attr_name : find an attribute on WebElement with this name
    • attr_value: if value it's not None, then validate value

BUG CoreException useless param : cause

#26

qacode/core/bots/BotBase.py

        if browser_file is None:            
            raise CoreException(message="Failed at select driver name",
                                cause="selected isn't valid : {}".format(browser_file),

@Terseus
Looks like you're putting the real cause of the error in the cause param and an unhelpful message in the message param.

Why not to put the cause value in message and get rid of the cause param here?

@netzulo
true, useless param, deleting at next version

Implement Testlink API xmlrpc calls

TODO

Systems requisites

  • Create Public Testlink
  • Create Testlink Token
  • Encrypt new token for .travis builds

Affected (exec testcases)

python setup.py test

  • Inherit class TestInfoBot
  • All Functionals testcases

Issues related

PageLogged Class

TODO

Coverage

  • coverage fixes for logger_manager
  • coverage fixes for bot_config
  • coverage fixes for nav_base

PageBase

  • is_url: check real selenium url with page loaded url

PageLogged

  • logged status must be loaded with is_login method from page_login
  • logout: do logout going to url_logout property
  • is_logged: check logged state using PageLogin instance

Tests

  • PageBase | method is_url , default params values

  • PageBase | method is_url , assert return true

  • PageBase | method is_url , assert return false ( no exceptions )

  • PageBase | method is_url , default params values (except ignore_raises as FALSE )

  • PageBase | method is_url , assert return true (except ignore_raises as FALSE )

  • PageBase | raises method is_url , assert exception PageException instead of false (except ignore_raises as FALSE )

  • PageLogged | check instance OK

  • PageLogged | check login success status throught is_logged property

  • PageLogged | check login failed status throught is_logged property

  • PageLogged | raises page_logged when param url_logged is none

  • PageLogged | raises page_logged when param url_logout is none

  • PageLogged | raises is_logged when page_login it's not instance of PageLogin class

PhantomJS remote driver it's opening FirefoxDriver Always

alway what need to open phantomjs driver over qalab server with one node configured with just phantomjs drivers, it's failing at selecting from python command line

TODOs

  • test_008_bot_remote_phantomjs must works stop lying us e25e0b1

FAILED CODE

def test_008_bot_remote_phantomjs(self):
        """Testcase: test_008_bot_remote_phantomjs"""
        self.log.debug("TestBotBase: REMOTE started for PHANTOMJS")
        self.bot_config.bot_browser = "phantomjs"
        self.bot_config.bot_mode = "remote"
        bot = BotBase(self.bot_config)
        time.sleep(WAIT_TO_CLOSE)
        bot.close()
        self.log.debug("TestBotBase: REMOTE terminated for PHANTOMJS")

WORKING CODE

def test_008_bot_remote_phantomjs(self):
        """Testcase: test_008_bot_remote_phantomjs"""
        self.log.debug("TestBotBase: REMOTE started for PHANTOMJS")
        self.bot_config.config['browser'] = "phantomjs"
        self.bot_config.config['mode'] = "remote"
        bot = BotBase(self.bot_config)
        time.sleep(WAIT_TO_CLOSE)
        bot.close()
        self.log.debug("TestBotBase: REMOTE terminated for PHANTOMJS")

add support to Opera Browser + tests

TODO

  • knows about ENV name for opera browser driver
    • test about : "-Dopera.binary="
    • test about : "-Dwebdriver.opera.driver="
  • add new drivers to module qadrivers
  • add to one public node and test it manually FAILED at 12-12-2017

Documentation

http://www.opera.com/es/computer

Tests

  • test for mode local and browser_name opera
  • test for mode remote and browser_name opera
  • manual test for mode remote and browser_name opera , opening page
  • manual test for mode remote and browser_name opera , using webelement
  • manual test for mode remote and browser_name opera , using ControlBase

Manuals

Need to test combinations for

  1. env var command lane -Dopera.binary= and -Dwebdriver.opera.driver=
    -->
  2. node browser name opera and operablink
    -->
  3. python remote browser name opera and operablink
  • var name 1 + node name 1 + python selenium code 1
  • var name 1 + node name 1 + python selenium code 2
  • var name 1 + node name 2 + python selenium code 1
  • var name 1 + node name 2 + python selenium code 2
  • var name 2 + node name 2 + python selenium code 1
  • var name 2 + node name 2 + python selenium code 2

Issues related

TODO TestInfoBot class

class inherit from TestInfoBase class that implements tearDown and setup method with opening and closing webdrivers

TODO ControlBase

Requisites

  • Must validate at instance class if tag it's HTML valid tag (ControlBase)
  • Must load properies is_{prop_name} ( is_enabled, is_visible, is_selected )

Behaviors

  • HTML: search content text ( without subtags )
  • HTML: search basic attributes
    • <tag> : must validate atribute id <tag id="value"></tag>
    • <tag> : must validate atribute class <tag class="value"></tag>

TODOs

  • Modify PageBase to accept elements or ControlBase objects
  • Modify PageLogin to use elements or ControlBase objects
  • Modify tests/functionals/Test* to make them work again with python setup.py test

Stop using nose for testing as it is deprecated

As we can see in the nose webpage:

Nose has been in maintenance mode for the past several years and will likely cease without a new person/team to take over maintainership. New projects should consider using Nose2, py.test, or just plain unittest/unittest2.

Personally I recommend py.test but it's up to you.

Keep in mind that this will not be a drop-in replacement as we're already using some from nose.tools import ... that needs to be changed when replacing nose with another testing tool.

TODO Exec tests with pytests

  • Exec tests with pytests, I+D on pytest library
  • Add pytest to sonarqube configuration files
  • Add new code metrics to README.rst

[BUG] Fix readability problem at PageLogin class

  • Make validation at ControlBase class
  • ControlBase class must be implemented first for #35
    def login(self,username,password,is_login_now=True):
        message_error = "Can't '{}' '{}' on field '{}' for class PageLogin"
        try: self.txt_username.send_keys(username)
        except Exception as err: raise PageException(message_error.format("send_keys", username, "txt_username"))
        try: self.txt_password.send_keys(password)
        except Exception as err: raise PageException(message_error.format("send_keys", password, "txt_password"))
        if is_login_now:
            try: self.txt_password.send_keys(password)
            except Exception as err: raise PageException(message_error.format("click", password, "btn_login"))

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.