-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_e2e.py
More file actions
44 lines (35 loc) · 1.62 KB
/
test_e2e.py
File metadata and controls
44 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pytest
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from pageObjects.CheckoutPage import CheckOutPage
from pageObjects.HomePage import HomePage
from utilities.BaseClass import BaseClass
class TestOne(BaseClass):
def test_e2e(self):
log = self.getLogger()
homePage = HomePage(self.driver)
checkoutpage = homePage.shopItems()
log.info("getting all the card titles")
cards = checkoutpage.getCardTitles()
i = -1
for card in cards:
i = i + 1
cardText = card.text
log.info(cardText)
if cardText == "Blackberry":
checkoutpage.getCardFooter()[i].click()
self.driver.find_element_by_css_selector("a[class*='btn-primary']").click()
confirmpage = checkoutpage.checkOutItems()
log.info("Entering country name as ind")
self.driver.find_element_by_id("country").send_keys("ind")
# time.sleep(5)
self.verifyLinkPresence("India")
self.driver.find_element_by_link_text("India").click()
self.driver.find_element_by_xpath("//div[@class='checkbox checkbox-primary']").click()
self.driver.find_element_by_css_selector("[type='submit']").click()
textMatch = self.driver.find_element_by_css_selector("[class*='alert-success']").text
log.info("Text received from application is "+textMatch)
assert ("Success! Thank you!" in textMatch)