def __init__(self, appium_server_url, path_to_apk, step_with_screenshot, device_name):
     deviceDesiredCapabilities = {"deviceName": device_name,
                                  "platformName": 'Android',
                                  "allowTestPackages": True,
                                  "app": get_path(path_to_apk)}
     self.driver = webdriver.Remote(appium_server_url, deviceDesiredCapabilities)
     self.driver.step_with_screenshot = step_with_screenshot
     self.driver.implicitly_wait(15)
Пример #2
0
from pytest_bdd import scenarios, given, then, parsers
import pytest, allure, time
from lib.tools.getPath import get_path
from lib.core.sharedDriver import SharedDriverClass

scenarios((get_path('tests/bdd/unordered')))
# TODO implement video recorder


@then(parsers.parse('Tap on "{LOCATOR}", By "{BY}"'))
def click_on_by(driver_init, LOCATOR, BY):
    with allure.step(f"Tap BY : {BY} LOCATOR: {LOCATOR}"):
        SharedDriverClass(driver_init)._click(LOCATOR, BY)


@then(parsers.parse('Validate element is presented "{LOCATOR}", By "{BY}"'))
def validate_displayed(driver_init, LOCATOR, BY):
    with allure.step(
            f'Validate element is presented LOCATOR : {LOCATOR}, By : {BY}'):
        SharedDriverClass(driver_init)._isDisplayed(LOCATOR, BY)


@then(parsers.parse('In field "{LOCATOR}" type "{STRING}", By "{BY}"'))
def send_keys(driver_init, LOCATOR, BY, STRING):
    with allure.step(
            f"Send Keys by : {BY} LOCATOR: {LOCATOR}  TYPE : {STRING}"):
        SharedDriverClass(driver_init)._send(LOCATOR, STRING, BY)


@then(parsers.parse('Validate text "{LOCATOR}", "{STRING}", By "{BY}"'))
def validate_text(driver_init, LOCATOR, BY, STRING):
Пример #3
0
import pytest, allure
from pytest_bdd import scenario, given, when, then
from lib.core.first_page import FirstPage
from lib.tools.getPath import get_path

step_2 = "Click on button"
step_3 = "validate middle text"


@scenario(get_path('/tests/bdd/first_page.feature'), 'Login Validation')
def test_login(driver_init, video_recorder):
    """This test for Onboarding"""


@then(step_2)
def step_test_2(driver_init):
    with allure.step(step_2):
        FirstPage(driver_init).click_on_button()


@then(step_3)
def step_test_3(driver_init):
    with allure.step(step_3):
        FirstPage(driver_init).validatdate_is_middle_text()
from pytest_bdd import given, then, when, scenario, parsers
from lib.tools.getPath import get_path
from lib.core.core_api import ApiRequest
import allure
import pytest


@scenario(get_path('tests/bdd/api.feature'), 'API test')
def test_dynamic(_base_url):
    """ Test body """


@given('Initialize request body')
def init_request(_base_url, _method, _name, _json, _URL):
    global test
    test = ApiRequest(_base_url=_base_url,
                      _name=_name,
                      _method=_method,
                      _URL=_URL,
                      _json=_json)


@then(parsers.parse("Response validation"))
def send_and_validate(_status_code, _method, _name, _base_url, _URL, _json):
    with allure.step("Initialize request body     |    NAME : " + _name +
                     "   |   METHOD : " + _method + "   |   LINK : " +
                     _base_url + _URL + "   |   JSON : " + _json):
        with allure.step("Response validation : " + _status_code):
            test.make_request()
            test.validate_status_code(_status_code)
Пример #5
0
from appium import webdriver
from lib.tools.getPath import get_path


deviceName = '5758554638573398'
appiumServerUrl = 'http://127.0.0.1:4723/wd/hub'
platformName = 'Android'
deviceDesiredCapabilities = { "deviceName": deviceName,
                            "platformName": platformName,
                            "androidInstallTimeout": 300000,
                              "allowTestPackages": True,
                            "app": get_path("apk/testApp.apk")}



driver = webdriver.Remote(appiumServerUrl, deviceDesiredCapabilities)
driver.implicitly_wait(15)
try:
    driver.find_element_by_accessibility_id('Right').click()
    print(driver.find_element_by_accessibility_id('Center').is_displayed())
    driver.quit()
except:
    driver.quit()
    print(False)