Skip to main content

Python-Client

Getting the Optimus Python client

There are three ways to install and use the Optimus Python client.

  1. Install from PyPi, as Optimus-Python-Client

    pip install Optimus-Python-Client
    
  2. Install from source, via PyPi. From Optimus-Python-Client, download and unarchive the source tarball (Optimus-Python-Client-X.X.tar.gz).

    tar -xvf Optimus-Python-Client-X.X.tar.gz
    cd Optimus-Python-Client-X.X
    python setup.py install
    
  3. Install from source via GitHub.

    git clone <path>
    cd python-client
    python setup.py install
    

Run Tests

  1. With Python's unittest

    • Create setUp and tearDown method inside a class.

      import unittest
      
      from remote.OptimusCloudDriver import OptimusCloudDriver
      from remote.OptimusCloudManager import OptimusCloudManager
      
      class BaseTest(unittest.TestCase):
          def setUp(self) -> None:
              desired_caps = {
                  'platformName': 'Android',
                  'appPackage': 'com.cleartrip.android',
                  'appActivity': 'com.cleartrip.android.activity.common.SplashActivity'
              }
              self.mobileDriverDetails = OptimusCloudDriver().createDriver(desiredCapabilities=desired_caps)
              self.driver = self.mobileDriverDetails.mobileDriver
      
          def tearDown(self) -> None:
              OptimusCloudManager().releaseSession(self.mobileDriverDetails)
      
    • Write the test.

      class TestFile(BaseTest):
          def test_page_title(self):
              sleep(3)
              self.driver.find_element_by_id("classic_bottom_navigation_icon").click()
              assert self.driver.find_element_by_id("headerTxt").text == "Search Flights"
      
    • Run the tests

  2. With pytest

    • Write setup and teardown method in a class

      import pytest
      
      from remote.OptimusCloudDriver import OptimusCloudDriver
      from remote.OptimusCloudManager import OptimusCloudManager
      
      class DriverFactory(object):
          @pytest.fixture(scope='function', autouse=True)
          def setUp(self) -> None:
              desired_caps = {
                  'platformName': 'Android',
                  'appPackage': 'com.cleartrip.android',
                  'appActivity': 'com.cleartrip.android.activity.common.SplashActivity'
              }
              self.mobileDriverDetails = OptimusCloudDriver().createDriver(desiredCapabilities=desired_caps)
              self.driver = self.mobileDriverDetails.mobileDriver
      
          @pytest.fixture(scope='function', autouse=True)
          def tearDown(self) -> None:
              OptimusCloudManager().releaseSession(self.mobileDriverDetails)
      

      Read more about fixtures here

    • Write the Test class

      from time import sleep
      
      from test.DriverFactory import DriverFactory
      
      class TestPageTitle(DriverFactory):
          def test_page_title(self):
              sleep(3)
              self.driver.find_element_by_id("classic_bottom_navigation_icon").click()
              assert self.driver.find_element_by_id("headerTxt").text == "Search Flights"
      
    • Run the test

      pytest TestPageTitle.py 
      

Run tests in parallel

  • Parallelization can be achieved by using pytest-xdist

    • Install it via pip or pip3

      pip install pytest-xdist

      pip3 install pytest-xdist

    • Write multiple tests or test in multiple files

    • Run the test

      pytest -n <number of thread>

      pytest -n 2
      

Metadata

Release files for Optimus-Python-Client 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Optimus-Python-Client 0.3.5
File Size Uploaded Provenance
Optimus-Python-Client-0.3.5.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for Optimus-Python-Client 0.3.5
File Interpreter ABI Platform
Optimus_Python_Client-0.3.5-py2-none-any.whl Python 2 none any Details

Total release size: 26.5 kB

Release files / Optimus-Python-Client-0.3.5.tar.gz

Download URL Optimus-Python-Client-0.3.5.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ab92aa03dba4a50535bfbde33be7e4a61ec2a12000bd2e9e584a11aa59dd30b3
BLAKE2b-256 checksum
How to use checksums
c5cb62550ef58132ad828070ce3c600121f3cf2cb9eedadfaa7bce847a8c5152
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

Release files / Optimus_Python_Client-0.3.5-py2-none-any.whl

Download URL Optimus_Python_Client-0.3.5-py2-none-any.whl
Size 17.6 kB
Tags Python 2
SHA-256 checksum
How to use checksums
4d8ed8f409840cd4cff6988df6dbdf05426b9c447fc0c6aa1b762b0294b0b940
BLAKE2b-256 checksum
How to use checksums
b7ef3ba6901c1d97d8ab1780ddfd76c073360d2551ad54260986076652f2e6ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

Security for Optimus-Python-Client 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page