Created
November 28, 2018 09:29
-
-
Save werdan/2f36e18c8c4ba0a89c55fc08d4dbfd8c to your computer and use it in GitHub Desktop.
JJFarms test base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import platform | |
import sys | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import WebDriverWait | |
def _get_platform(): | |
# On Android sys.platform returns 'linux2', so prefer to check the | |
# presence of python-for-android environment variables (ANDROID_ARGUMENT | |
# or ANDROID_PRIVATE). | |
if 'ANDROID_ARGUMENT' in sys.platform: | |
return 'android' | |
else: | |
return 'ios' | |
def test_add_product(driver): | |
print _get_platform() | |
loginInput = driver.find_element_by_accessibility_id('Login input') | |
loginInput.click() | |
driver.implicitly_wait(1) | |
loginInput.send_keys('180TEST') | |
driver.hide_keyboard() | |
passwordInput = driver.find_element_by_accessibility_id('Password input') | |
passwordInput.click() | |
driver.implicitly_wait(1) | |
passwordInput.send_keys('180test') | |
driver.hide_keyboard() | |
# loginInput.submit() | |
loginButton = driver.find_element_by_accessibility_id('Sign in') | |
loginButton.click() | |
WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Start shopping'))) | |
driver.implicitly_wait(5) | |
startShoppingButton = driver.find_element_by_accessibility_id('Start shopping') | |
startShoppingButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'All products'))) | |
driver.implicitly_wait(5) | |
allProductsButton = driver.find_element_by_accessibility_id('All products') | |
allProductsButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Product 1'))) | |
driver.implicitly_wait(5) | |
product1Button = driver.find_element_by_accessibility_id('Product 1') | |
product1Button.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Increase quantity'))) | |
driver.implicitly_wait(5) | |
increaseQuantityButton = driver.find_element_by_accessibility_id('Increase quantity') | |
increaseQuantityButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Add to cart'))) | |
driver.implicitly_wait(5) | |
addToCartButton = driver.find_element_by_accessibility_id('Add to cart') | |
addToCartButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Back'))) | |
driver.implicitly_wait(5) | |
backButton = driver.find_element_by_accessibility_id('Back') | |
backButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Review'))) | |
driver.implicitly_wait(5) | |
reviewButton = driver.find_element_by_accessibility_id('Review') | |
reviewButton.click() | |
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ACCESSIBILITY_ID, 'Check Out'))) | |
# assertIsNotNone(buttonMenu) | |
assert 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment