Code Monkey home page Code Monkey logo

toolium's Introduction

Toolium

Build Status Coverage Status CodeClimate Documentation Status

Toolium is a Python wrapper tool of Selenium and Appium libraries to test web and mobile applications in a single 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.

Getting Started

Run pip install toolium to install the latest version from PyPi. It's highly recommendable to use a virtualenv.

The main dependencies are:

  • Selenium: to test web applications in major browsers (Firefox, Chrome, Internet Explorer, Edge or Safari)
  • Appium-Python-Client: to test mobile applications (native, hybrid or web) in Android or iOS devices/emulators.
  • requests: to test APIs

Using toolium-template

The easiest way of getting started is to clone toolium-template project, run the example test and add your own tests and configuration.

$ git clone [email protected]:Telefonica/toolium-template.git
$ cd toolium-template
$ pip install -r requirements.txt

Now, just follow toolium-template instructions to know how to start your testing project.

Running toolium-examples

You can also clone toolium-examples to get more examples about how to use the library to test web, Android or iOS applications, in different scenarios.

$ git clone [email protected]:Telefonica/toolium-examples.git
$ cd toolium-examples
$ pip install -r requirements.txt

Now, just follow toolium-examples instructions to run the examples of the tests.

Contributing

If you want to collaborate in Toolium development, feel free of forking it and asking for a pull request.

Don't forget to run unit tests:

$ git clone [email protected]:<your_github_user>/toolium.git
$ cd toolium
$ pip install -r requirements.txt
$ pip install -r requirements_dev.txt
$ python -m pytest

Finally, before accepting your contribution, we need you to sign our Contributor License Agreement and send it to [email protected].

Main Features

Documentation

Further information about features and fixes included in each release: CHANGELOG.

Complete library reference and documentation available at ReadTheDocs.

toolium's People

Contributors

abellosovic avatar alainmiranda avatar alvarolgn avatar angel-ram avatar cgarmor avatar dependabot[bot] avatar fachrulch avatar franciscocanotid avatar franjpl-tel avatar hesteban-tuenti avatar iariasleon avatar jaimemrjm avatar jframos avatar lmcalvo avatar manzanero avatar mariahdezl avatar marivipelaez avatar neolithera avatar pabloge avatar qky666 avatar raulmaroto avatar rgonalo avatar rmescandon avatar robertomier avatar rubenramper1 avatar txescko avatar vladimirpodolian avatar vmpuerto avatar zometlfca avatar

Stargazers

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

Watchers

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

toolium's Issues

Parent argument for elements doesn't work properly for some cases

Example of html code:
https://61377283aa57c.htmlsave.net/

Case1:
In this case first input will be filled, but we selected second element by xpath:

`class Page(PageObject):
group_show_block = PageElement(By.XPATH, "//div[@Class='modes-block'][2]")
topic_input = InputText(By.XPATH, "//input[contains(@Class, 'mode-input')]", parent=group_show_block)

Page().topic_input.text = "Hello"`

Case2:
Parent argument doesn't work, you can write class that not exist in group_show_block and first input wil be filled,

`class GroupTicketShowModal(Group):
group_show_block = PageElement(By.XPATH, "//div[@Class='modes-block'][2]")
topic_input = InputText(By.XPATH, "//input[contains(@Class, 'mode-input')]", parent=group_show_block)

class Page(PageObject):
group_ticket_show_modal = GroupTicketShowModal(By.XPATH, "//div[contains(@Class, 'modal-body')]")`

Page().group_ticket_show_modal.topic_input.text = "Hello"`

Nosectionerror

In this code:
def _unify_values(self, section, vars):
"""Create a sequence of lookups with 'vars' taking priority over
the 'section' which takes priority over the DEFAULTSECT.

    """
    sectiondict = {}
    try:
        sectiondict = self._sections[section]
    except KeyError:
        if section != self.default_section:
            raise NoSectionError(section) from None
    # Update with the entry specific variables
    vardict = {}
    if vars:
        for key, value in vars.items():
            if value is not None:
                value = str(value)
            vardict[self.optionxform(key)] = value
    return _ChainMap(vardict, sectiondict, self._defaults)

This error is occured:
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/karana/Downloads/toolium-master/toolium-master/toolium/test/test_driver_wrapper.py", line 304, in
test_abcd()
File "C:/Users/karana/Downloads/toolium-master/toolium-master/toolium/test/test_driver_wrapper.py", line 300, in test_abcd
dr = new_driver_wrapper.connect()
File "C:\Users\karana\PycharmProjects\untitled3\venv\lib\site-packages\toolium\driver_wrapper.py", line 205, in connect
if not self.config.get('Driver', 'type') or self.config.get('Driver', 'type') in ['api', 'no_driver']:
File "C:\Users\karana\AppData\Local\Programs\Python\Python37\lib\configparser.py", line 780, in get
d = self._unify_values(section, vars)
File "C:\Users\karana\AppData\Local\Programs\Python\Python37\lib\configparser.py", line 1146, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'Driver'

Installation fails due to conflicting selenium version

Hi, users are unable to run toolium due to dependency conflict with selenium package.

As shown in the following full dependency graph of toolium , toolium requires selenium >=2.53.6,while appium-python-client requires selenium=3.14.1,<4.

According to pip’s “first found wins” installation strategy, selenium 4.0.0a1 is the actually installed version. However, selenium 4.0.0a1 does not satisfy >=3.14.1,<4.

Dependency tree--

toolium<version range:>
| +-appium-python-client<version range:>=0.24>
| | +-selenium<version range:>=3.14.1,<4>
| +-behave<version range:==1.2.5>
| +-coverage<version range:==4.3.1>
| +-coveralls<version range:==1.1>
| +-docutils<version range:==0.14>
| +-lettuce<version range:==0.2.23>
| | +-fuzzywuzzy<version range:>
| | +-python-subunit<version range:>
| | +-sure<version range:>
| | | +-mock<version range:>
| | | +-six<version range:>
| +-mock<version range:==2.0.0>
| +-needle<version range:==0.5.0>
| +-pygments<version range:==2.2.0>
| +-pytest<version range:==2.9.2>
| +-requests<version range:>=2.12.4>
| +-requests-mock<version range:==1.2.0>
| +-screeninfo<version range:>
| +-selenium<version range:>=2.53.6>
| +-six<version range:>=1.10.0>
| +-sphinx<version range:==1.5.1>

Solution

Could you change the version range of selenium from >=2.53.6 to >=2.53.6,<4?

Thanks for your help.
Best,
Neolith

[Appium-Android] Teardown taking longer time due to getting huge "bugreport" log

The Problem

Given my test is failing, then my test runner session is freeze some minutes before execution aborted, I'm debugging the codes find out that as part of teardown process toolium will automatically getting log (event not seeing config setting, since toolium.driver_wrappers_pool.DriverWrappersPool.save_all_webdriver_logs condition if driver_wrapper.config.getboolean_optional('Server', 'logs_enabled') or not test_passed: always return True for failing test)

It impacted in getting big data of bugreport, here are the process in my appium server:

[HTTP] --> POST /wd/hub/session/0d78ddf2-16a3-4796-a42a-1265b9bf4a47/log [HTTP] {"type":"bugreport"} [debug] [W3C (0d78ddf2)] Calling AppiumDriver.getLog() with args: ["bugreport","0d78ddf2-16a3-4796-a42a-1265b9bf4a47"] [debug] [BaseDriver] Retrieving 'bugreport' logs [debug] [BaseDriver] Retrieving supported log types [debug] [ADB] Running '/Users/fachrulch/Library/Android/sdk/platform-tools/adb -P 5037 -s 520021f0fec984c1 bugreport' [debug] [W3C (0d78ddf2)] Responding to client with driver.getLog() result: [{"timestamp":1597125881669,"level":"ALL","message":"/data/user_de/0/com.android.shell/files/bugreports/bugreport-2020-08-11-13-03-00.zip: 1 file pulled. 31.1 MB/s (7403500 bytes in 0.227s)"}] [HTTP] <-- POST /wd/hub/session/0d78ddf2-16a3-4796-a42a-1265b9bf4a47/log 200 103499 ms - 202 [HTTP]

What I did

  • I attempted to run command adb logcat -c before test run to make all log clear and getting the log will much become faster, but apparently this command not clearing bugreport, getting bugreport is still huge (31 MB in my
  • I've googled to find how to clean bugreport data before test run, but not found any clue other thatn adb logcat -c (which not works)

Possible solution

I'm thinking it will be good if:

  • toolium can takes only desired log_types in .cfg files (dont call directly selenium.webdriver.remote.webdriver.WebDriver.log_types in toolium.utils.Utils.save_webdriver_logs)

Thank you

Error when use special character (ñ) in feature file

The error is caused by logger format (don't use u"...".format()) in behave/environment.py

Exception UnicodeEncodeError: 'ascii' codec can't encode character u'ñ' in position 42: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/local/bin/behave", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/behave/__main__.py", line 109, in main
    failed = runner.run()
  File "/usr/local/lib/python2.7/site-packages/behave/runner.py", line 672, in run
    return self.run_with_paths()
  File "/usr/local/lib/python2.7/site-packages/behave/runner.py", line 693, in run_with_paths
    return self.run_model()
  File "/usr/local/lib/python2.7/site-packages/behave/runner.py", line 483, in run_model
    failed = feature.run(self)
  File "/usr/local/lib/python2.7/site-packages/behave/model.py", line 523, in run
    failed = scenario.run(runner)
  File "/usr/local/lib/python2.7/site-packages/behave/model.py", line 919, in run
    runner.run_hook('after_scenario', runner.context, self)
  File "/usr/local/lib/python2.7/site-packages/behave/runner.py", line 405, in run_hook
    self.hooks[name](context, *args)
  File "environment.py", line 46, in after_scenario
    toolium_after_scenario(context, scenario)
  File "/usr/local/lib/python2.7/site-packages/toolium/behave/environment.py", line 136, in after_scenario
    bdd_common_after_scenario(context, scenario, scenario.status)
  File "/usr/local/lib/python2.7/site-packages/toolium/behave/environment.py", line 154, in bdd_common_after_scenario
    context_or_world.logger.info("The scenario '{0}' has passed".format(scenario.name))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 42: ordinal not in range(128)

Restart driver when the test fail

I think that it's interesting the possibility to restart the selenium driver when the test fails and you have the reuse_driver option set to true. The most clear case is when you are logged in a website and your test fails (e.g. a lot of tests with login, validations and logout). In one error situation, the normal exit with a logout process is not performed and the next tests always fails because the login process always fails.
I use behave and solve this situation with a workaround in the bdd_common_after_scenario function:

    else:
        test_status = 'Fail'
        test_comment = "The scenario '{0}' has failed".format(scenario.name)
        context_or_world.logger.error(test_comment)
        # Capture screenshot and save logs on error
        DriverWrappersPool.capture_screenshots(scenario_file_name)
        DriverWrappersPool.save_all_webdriver_logs(scenario.name)

        ### Restart driver. Workaround
        # Read new configuration value -restart_fail-
        restart_driver_fail = context_or_world.toolium_config.getboolean_optional('Driver', 'restart_fail')
        if restart_driver_fail:
            # Close driver
            DriverWrappersPool.close_drivers_and_download_videos(scenario_file_name, status == 'passed', False)
            # Start "clean" driver
            create_and_configure_wrapper(context_or_world)
            connect_wrapper(context_or_world)
        ### End of workaround

Could be interesting add this functionality natively?

docs: bdd_integration.rst page

ON INSPECTION (reading the page):
First example for behave w/ hooks does not look correct to me (import-statement), like: toolium_before_all() function should be unknown because it is imported as before_all (and internally overwritten by the environment function).

HINT:
Behave fixtures should also make the setup/teardown hooks easier to use.

Toolium output / report options

When running tests, output is generated on the console and in the toolium.log

  • toolium.log is a more generic log file and new output is appended to this file.
  • there is no default report file generated

What's a preferred way of generating reports? Is this meant to be handled by the test framework used (unittest, pytest, etc.)?

Are there any built-in report options other than logging and the visual test ouput?

How to specify configuration when using Mobile Page Objects?

I applied the Mobile Page Object pattern for iOS and Android (with base, android and ios folders) which works great.

Now, to make things more portable I need to load a specific driver configuration (ios or android) at runtime.

For now, when running a test on the command line I just set a environment variable and evaluate that in the setUp function. If it's ios I tell config_files.set_config_properties_filenames to load iOS specific config files (we currently use the default unittest framework, no pytest or nose)

Is this the way to go or is there some built-in logic?

Is it possible to override settings of configuration file before browser session created

Hi,
Thanks for this useful library. I have a question I wonder if you could help answer.

I'm using the following code to provide a method of controlling the path to the configuration files:

class TooliumSession(test_cases.SeleniumTestCase):
    """Toolium Session."""

    def setUp(self, configuration_directory=None):
        """Override setUp function to enable config file directory to be configured.

        :param configuration_directory: path to config file location
        """
        self.config_files.set_config_properties_filenames(
            "properties.cfg", "local-properties.cfg"
        )
        if configuration_directory:
            self.config_files.set_config_directory(str(configuration_directory))
        else:
            conf_dir = Path(getcwd(), "conf")
            if not Path.exists(conf_dir):
                conf_dir = Path(getcwd(), "draytekwebadmin", "conf")
            if Path.exists(conf_dir):
                self.config_files.set_config_directory(str(conf_dir))
        super(TooliumSession, self).setUp()

I'd also like to be able to set other properties programmatically, for example, the type, gecko_driver_path, chrome_driver_path, headless and perhaps other properties like wait durations. Allowing these to override settings that may be in the configuration file.

I'm unclear if this is possible or how to go about it, as once the config file is read the session webdriver starts, which is too late.

Any help/guidance gratefully received.
Martin

Unable to run test suite from a clean copy

Hi there!
I've just forked this project and want to run the test suite on my laptop... I'm wondering if there is some extra setup step that I'm missing.

If that's the case, I may revise the README.md and begin contributing to this project 😃

What I've done so far

✅ 1. fork and clone the repo
✅ 2. create a virtual env and install the dependencies from requirements.txt and requirements_dev.txt with pip install -r
🔴 3. Run python setup.py test (I've tried also python -m pytest .)

Helpful things

  1. this a freeze of my current env:
$» pip freeze
alabaster==0.7.12
Appium-Python-Client==0.50
Babel==2.8.0
behave==1.2.5
certifi==2019.11.28
chardet==3.0.4
coverage==4.3.1
coveralls==1.1
docopt==0.6.2
docutils==0.14
extras==1.0.0
fixtures==3.0.0
fuzzywuzzy==0.18.0
idna==2.9
imagesize==1.2.0
Jinja2==2.11.1
lettuce==0.2.23
linecache2==1.0.0
MarkupSafe==1.1.1
mock==2.0.0
needle==0.5.0
nose==1.3.7
parse==1.15.0
parse-type==0.5.2
pbr==5.4.4
Pillow==7.0.0
py==1.8.1
Pygments==2.2.0
pytest==2.9.2
python-mimeparse==1.6.0
python-subunit==1.4.0
pytz==2019.3
requests==2.23.0
requests-mock==1.2.0
screeninfo==0.3.1
selenium==3.141.0
six==1.14.0
snowballstemmer==2.0.0
Sphinx==1.5.1
sure==1.4.11
testtools==2.4.0
traceback2==1.4.0
typing==3.7.4.1
unittest2==1.1.0
urllib3==1.25.8
  1. The failing tests are from toolium/test/test_visual_test.py
[...]
toolium/test/test_visual_test.py ....................FF.....FFF.FFF..FF....FF..
[...]
================================== 12 failed, 316 passed, 1 error in 39.14 seconds ===================================
  1. Some failing example outputs
self = <needle.engines.imagemagick_engine.Engine object at 0x1059c3190>
output_file = '/Users/martero/workspace/bundle/toolium/toolium/test/output/visualtests/2020-03-24_151907_firefox/01_screenshot_ios_web__screenshot_suffix.png'
baseline_file = '/Users/martero/workspace/bundle/toolium/toolium/test/resources/ios_web_exclude.png', threshold = 0.1

    def assertSameFiles(self, output_file, baseline_file, threshold=0):
        diff_file = output_file.replace('.png', '.diff.png')

        compare_cmd = self.compare_command.format(
            compare=self.compare_path,
            baseline=baseline_file,
            new=output_file,
            diff=diff_file)
        process = subprocess.Popen(compare_cmd, shell=True,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
        compare_stdout, compare_stderr = process.communicate()

>       difference = float(compare_stderr.split()[1][1:-1])
E       ValueError: could not convert string to float: b'ompare'

or

self = <needle.engines.imagemagick_engine.Engine object at 0x10591f510>
output_file = '/Users/martero/workspace/bundle/toolium/toolium/test/output/visualtests/2020-03-24_151907_firefox/01_screenshot_ios__screenshot_suffix.png'
baseline_file = '/Users/martero/workspace/bundle/toolium/toolium/test/resources/ios_excluded.png', threshold = 0.1

    def assertSameFiles(self, output_file, baseline_file, threshold=0):
        diff_file = output_file.replace('.png', '.diff.png')

        compare_cmd = self.compare_command.format(
            compare=self.compare_path,
            baseline=baseline_file,
            new=output_file,
            diff=diff_file)
        process = subprocess.Popen(compare_cmd, shell=True,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
        compare_stdout, compare_stderr = process.communicate()

>       difference = float(compare_stderr.split()[1][1:-1])
E       ValueError: could not convert string to float: b'ompare'

=== EDIT ===

Python version

I suspect it's related to python3 since running 2to3 writes some changes,

Python 3.7.5
$» pip --version
pip 20.0.2 from /Users/martero/.virtualenvs/toolium/lib/python3.7/site-packages/pip (python 3.7)

thanks!

Is it possible to inherite from class that inheritance from Group/Button etc?

Hello, as I see now, it's not possible to use self.driver_wrapper.config.get('Driver', 'type').split('-')[0] inside "Element" class. Maybe you know a different way to solve it?

https://pastebin.com/twMuqsq7

And it raising and exception(I simplify a little bit code in example):

`_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../page_object/admin_panel/General/Table/UsersTable.py:161: in block
self.block_modal.apply_block_reason(reason)
../../../../page_object/admin_panel/General/Modal/BlockModal.py:36: in apply_block_reason
self.add_additional_information(additional_info)
../../../../page_object/admin_panel/General/Modal/BaseModal.py:20: in apply
self.submit_button.click()
../../../../page_object/base_page_object/page_elements/Button.py:41: in click
if self.driver_wrapper.is_ios_web_test():
/Library/Python/3.8/site-packages/toolium/driver_wrapper.py:323: in is_ios_web_test
return self.is_ios_test() and self.is_web_test()
/Library/Python/3.8/site-packages/toolium/driver_wrapper.py:294: in is_ios_test
return self.utils.get_driver_name() in ('ios', 'iphone')
/Library/Python/3.8/site-packages/toolium/utils/driver_utils.py:42: in get_driver_name
return self.driver_wrapper.config.get('Driver', 'type').split('-')[0]
/Library/Python/3.8/site-packages/toolium/config_parser.py:187: in get
return super().get(section, self._encode_option(option), *args, **kwargs)
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py:781: in get
d = self._unify_values(section, vars)


self = <toolium.config_parser.ExtendedConfigParser object at 0x1040d8d90>
section = 'Driver', vars = None

def _unify_values(self, section, vars):
    """Create a sequence of lookups with 'vars' taking priority over
    the 'section' which takes priority over the DEFAULTSECT.

    """
    sectiondict = {}
    try:
        sectiondict = self._sections[section]
    except KeyError:
        if section != self.default_section:
          raise NoSectionError(section) from None

E configparser.NoSectionError: No section: 'Driver'

/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py:1149: NoSectionError
`

We need to use click from iOSHelper because we are using Safari driver in appium(https://appium.io/docs/en/drivers/safari/), but it doesn't support some of selenium methods like is_visible, delete_cookies etc. so we need to override some methods, because I'm trying to use 1 test for different platforms(desktop, android, ios)

is it possible to open 2 browsers?

I looked in code and didn't find a possibility to open 2 browsers, and i don't clearly understand how it initializing in test
secure_area = LoginPageObject().open().login(user)

config files extension normalized

"logging.conf" is the unique file with extension .conf while other uses .cfg by default

Shouldn't it use .cfg for all configuration files by default?

or both with:
'logging.cfg' if os.path.isfile(os.path.join(DriverWrappersPool.config_directory, 'logging.cfg')) else 'logging.conf'

Elements not found in nested groups

When you have several nested groups the parent parameter is not correctly filled and sometimes the elements of a group cannot be found and "NoSuchElementException" is given.

Defined groups example:
class ThirdGroup(Group):
def init_page_elements(self):
self.element3 = Button(By.XPATH, './/button[@Class="three"]')

class SecondGroup(Group):
def init_page_elements(self):
self.element2 = ThirdGroup(By.XPATH, './/button[@Class="two"]')
self.test_element = Button(By.XPATH, './/button[@Class="two"]//button[@Class="three"]')

class FirstGroup(Group):
def init_page_elements(self):
self.element1 = SecondGroup(By.XPATH, './/button[@Class="first"]')

class ThisPageObject(PageObject):
def init_page_elements(self):
self.my_first_group` = FirstGroup(By.XPATH, '//div')

Elements accessing example:
visible1 = self.my_first_group.element1.element2.element3.web_element.is_displayed()
visible2 = self.my_first_group.element1.test_element.web_element.is_displayed()

That first line (visible1) gives a NoSuchElementException, but the last line (visible2) finds the element and returns the correct result. The element accessed in both cases has the same XPATH, but in the first case there is one more nested group than in the second one.

Reusing drive/ opening Anroid app without cache

I've implemented toolium into my tests and i've come across a very annoying problem (Appium issue).
When trying to open my android app without reinstalling the apk it deletes some of the app's data thus logging me out and makes me do the "first time in the app" tutorial.

My trials to solve this included the following things:

  • setting the noReset to true in the desired capabilities
    *setting the fullReset to false in the desired capabilities
    *opening the app with the correct activity

The only way I got it to work is to keep the driver running and do:
driver.close_app()
and then:
driver.start_activity(app, activity)

This means that I'll have to hold my driver throughout my tests.
So I went along and tried to find a way to reuse the driver on all my tests, but I noticed that toolium closes the driver in the tearDownClass() method.
image

I would really appreciate some help here.

The best thing I could think of is starting up the driver and using toolium's setup but setting in the desired caps to just open the app without logging out from the user account and without having to go through the tutorial every time (I should mention that I used appium directly with all the params that I could think and got the same thing - so this is not a toolium bug, also - manually this does NOT happen).

If that won't be possible, I would like to find a way to keep the driver running between classes too and still use toolium's setup (because I use a lot of the toolium android\iOS functionality that won't work if I skip the setUp and just use the driver.)

Any suggestions/thoughts?

crop_element method in visual_test.py doesn't work properly

Hello! I tried to assert_screenshot for a local chromedriver and it doesn't crop it properly.

As i see the problem is in crop_element method in visual_test.py
Also it works the same for appium(android and ios drivers)

page_logo

test file example:

from selenium.webdriver.common.by import By
from toolium.pageobjects.page_object import PageObject
from toolium.pageelements.page_element import PageElement

class BasicSite(PageObject):
base_url = "https://www.basicwebsiteexample.com/"
basic_site_logo = PageElement(By.ID, "page-zones__template-widgets__companyname-companyname")

def test_sample(driver_wrapper):
driver_wrapper.driver.get(BasicSite.base_url)
BasicSite().basic_site_logo.assert_screenshot("page_logo")

In test i used pytest_fixtures from toolium library.
In properties.cfg I also tried to add a browser settings like window_width and window_height, but it doesn't help

Maybe you have an idea how to solve that problem?

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.