Make changes as per the code review
Browse filesFiles changed (4)
- .gitignore+2
- e2e_tests/__init__.pyAdded
- e2e_tests/test_sauce_labs.py+14-25
- e2e_tests/utils.pyAdded+24
12345**/*.swp**/*.env.vscodepuppet.dbnode_modules/1234567**/*.swp**/*.env__pycache__.vscodepuppet.dbnode_modules/
7 unmodified lines891011121342 unmodified lines565758596061626 unmodified lines697071727374757677782 unmodified lines818283848586878889909192939495969798991001011021031041051061071081091101117 unmodified linesfrom appium.webdriver.common.appiumby import AppiumByfrom selenium.webdriver.remote.webdriver import WebDriverfrom dotenv import load_dotenvload_dotenv()42 unmodified lineselse:connection_url = APPIUM_SERVER_URLreturn webdriver.Remote(connection_url, capabilities)6 unmodified linesdef save_server_settings(driver: WebDriver):element = driver.find_element(by=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/settingsButton")element.click()element = driver.find_element(by=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/serverUrlEditText")2 unmodified linesby=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/uuidEditText")element.send_keys(TEST_UUID)element = driver.find_element(by=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/saveButton")element.click()def wait_for_element(driver: WebDriver, by_selector: str, selector_value: str, timeout: int = 2):from selenium.webdriver.support.wait import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECtry:element = WebDriverWait(driver, timeout).until(EC.presence_of_element_located((by_selector, selector_value)))except:element = Nonefinally:return elementdef enable_privacy_settings(driver: WebDriver):driver.find_element(by=AppiumBy.XPATH, value='//*[@text="puppet"]').click()primary_checkbox = driver.find_element(by=AppiumBy.ID, value="android:id/switch_widget")7 unmodified lines89101112131442 unmodified lines5758596061626 unmodified lines69707172737475767778792 unmodified lines8283848586878889909192939495969798991007 unmodified linesfrom appium.webdriver.common.appiumby import AppiumByfrom selenium.webdriver.remote.webdriver import WebDriverfrom dotenv import load_dotenvfrom utils import wait_for_element, find_and_clickload_dotenv()42 unmodified lineselse:connection_url = APPIUM_SERVER_URLreturn webdriver.Remote(connection_url, capabilities)6 unmodified linesdef save_server_settings(driver: WebDriver):element = find_and_click(driver,by_selector=AppiumBy.ID,selector_value=f"{APP_PACKAGE_NAME}:id/settingsButton",)element = driver.find_element(by=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/serverUrlEditText")2 unmodified linesby=AppiumBy.ID, value=f"{APP_PACKAGE_NAME}:id/uuidEditText")element.send_keys(TEST_UUID)element = find_and_click(driver,by_selector=AppiumBy.ID,selector_value=f"{APP_PACKAGE_NAME}:id/saveButton",)def enable_privacy_settings(driver: WebDriver):element = find_and_click(driver,by_selector=AppiumBy.XPATH,selector_value=f"//*[@text='puppet']",)primary_checkbox = driver.find_element(by=AppiumBy.ID, value="android:id/switch_widget")
123456789101112131415161718192021222324from selenium.webdriver.remote.webdriver import WebDriver
def wait_for_element( driver: WebDriver, by_selector: str, selector_value: str, timeout: int = 2): from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC
try: element = WebDriverWait(driver, timeout).until( EC.presence_of_element_located((by_selector, selector_value)) )
except: element = None finally: return element
def find_and_click(driver: WebDriver, by_selector: str, selector_value: str): element = driver.find_element(by=by_selector, value=selector_value) element.click() return element.gitignore+2
e2e_tests/__init__.pyAdded
e2e_tests/test_sauce_labs.py+14-25
e2e_tests/utils.pyAdded+24