Skip to content

Commit

Permalink
Merge branch 'master' into feat-add-new-function-wait_until_ajax_requ…
Browse files Browse the repository at this point in the history
…est_completed
  • Loading branch information
franjpl-tel committed Mar 11, 2021
2 parents b11794f + 153fa39 commit e3eac93
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 56 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,59 @@
name: build

on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage
run: |
coverage run --source=toolium -m pytest toolium/test
- name: Publish on coveralls.io
if: ${{ matrix.python-version != '2.7' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: Python ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
coveralls --service=github
coveralls:
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade coveralls
- name: Finalize publishing on coveralls.io
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --finish
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -7,6 +7,9 @@ v1.9.1
*Release date: In development*

- Added new method wait_until_ajax_request_completed to driver utils class
- Move CI from Travis to Github Actions
- Fix string conversion in dataset utilities
- Add upper/lower conversion to replace param method

v1.9.0
------
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -7,8 +7,8 @@ Toolium is a Python wrapper tool of Selenium and Appium libraries to test web an
project. It provides a way of choosing and configuring the driver through a configuration file, implements a Page Object
pattern and includes a simple visual testing solution.

.. |Build Status| image:: https://travis-ci.org/Telefonica/toolium.svg?branch=master
:target: https://travis-ci.org/Telefonica/toolium
.. |Build Status| image:: https://github.com/Telefonica/toolium/workflows/build/badge.svg
:target: https://github.com/Telefonica/toolium/actions
.. |Documentation Status| image:: https://readthedocs.org/projects/toolium/badge/?version=latest
:target: http://toolium.readthedocs.org/en/latest
.. |Coverage Status| image:: https://coveralls.io/repos/Telefonica/toolium/badge.svg?branch=master&service=github
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -70,7 +70,7 @@

# General information about the project.
project = u'Toolium'
copyright = u'2015-2018, Telefónica I+D'
copyright = u'2015-2021, Telefónica I+D'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
21 changes: 11 additions & 10 deletions requirements_dev.txt
@@ -1,12 +1,13 @@
Sphinx==1.5.1
behave==1.2.5
Sphinx==1.8.5 ; python_version < '3.0'
Sphinx==3.* ; python_version >= '3.5'
lettuce==0.2.23
pytest==2.9.2 ; python_version < '3.9'
pytest==6.1.2 ; python_version >= '3.9'
coverage==4.3.1
mock==2.0.0
requests-mock==1.2.0
coveralls==1.1
pytest==4.6.11 ; python_version < '3.0'
pytest==6.* ; python_version >= '3.5'
coverage==5.*
coveralls==3.* ; python_version >= '3.5'
mock==3.*
requests-mock==1.*
needle==0.5.0
docutils==0.14
Pygments==2.2.0
docutils==0.*
Pygments==2.*
flake8==3.*
22 changes: 21 additions & 1 deletion toolium/test/utils/test_dataset_utils.py
Expand Up @@ -85,12 +85,18 @@ def test_replace_param_false():
assert param is False


def test_replace_param_str():
def test_replace_param_str_int():
param = replace_param("[STR:28]")
assert type(param) == str
assert param == "28"


def test_replace_param_str():
param = replace_param("[STR:abc]")
assert type(param) == str
assert param == "abc"


def test_replace_param_int():
param = replace_param("[INT:28]")
assert type(param) == int
Expand Down Expand Up @@ -201,3 +207,17 @@ def test_replace_param_float_with_length():
def test_replace_param_float_array_with_length():
param = replace_param("[FLOAT_ARRAY_WITH_LENGTH_4]")
assert param == "[FLOAT_ARRAY_WITH_LENGTH_4]"


def test_replace_param_upper():
param = replace_param("[UPPER:test]")
assert param == "TEST"
param = replace_param("[UPPER:TeSt]")
assert param == "TEST"


def test_replace_param_lower():
param = replace_param("[LOWER:TEST]")
assert param == "test"
param = replace_param("[LOWER:TeSt]")
assert param == "test"
16 changes: 14 additions & 2 deletions toolium/utils/dataset.py
Expand Up @@ -59,6 +59,9 @@ def replace_param(param, language="es"):
type_mapping_regex = "\[(DICT|LIST|INT|FLOAT|STR):(.*)\]"
type_mapping_match_group = re.match(type_mapping_regex, param)

string_format_regex = '\[(UPPER|LOWER):(.*)\]'
string_format_match_group = re.match(string_format_regex, param)

if "[MISSING_PARAM]" in param:
new_param = None
elif "[EMPTY]" in param:
Expand All @@ -81,8 +84,11 @@ def replace_param(param, language="es"):
return None
elif type_mapping_match_group and type_mapping_match_group.group(1) in \
["LIST", "DICT", "INT", "FLOAT", "STR"]:
exec(u"exec_param = {type}({value})".format(type=type_mapping_match_group.group(1).lower(),
value=type_mapping_match_group.group(2)))
if type_mapping_match_group.group(1) == "STR":
return type_mapping_match_group.group(2)
else:
exec(u"exec_param = {type}({value})".format(type=type_mapping_match_group.group(1).lower(),
value=type_mapping_match_group.group(2)))
return locals()["exec_param"]
elif date_matcher and len(date_matcher.groups()) == 3:
configuration = dict([(date_matcher.group(3).lower(), int(date_matcher.group(2).replace(
Expand All @@ -92,6 +98,12 @@ def replace_param(param, language="es"):
replace_value = reference_date + datetime.timedelta(**configuration)
return replace_value.strftime(date_format) if now else replace_value.strftime(
date_day_format)
elif string_format_match_group and string_format_match_group.group(1) in ["UPPER", "LOWER"]:
if string_format_match_group.group(1) == "UPPER":
return string_format_match_group.group(2).upper()
elif string_format_match_group.group(1) == "LOWER":
return string_format_match_group.group(2).lower()

else:
new_param = generate_fixed_length_param(param)
logger.debug("Input param: %s, output param: %s" % (param, new_param))
Expand Down
11 changes: 0 additions & 11 deletions tox.ini

This file was deleted.

0 comments on commit e3eac93

Please sign in to comment.