Esempio n. 1
0
class Test_itemCount(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.lp = LoginPage(self.driver)
        self.pdp = ProductDetailsPage(self.driver)
        self.sp = ShoppingCartPage(self.driver)
        self.cp = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_goToPDP(self):
        self.hp.goToLogin()
        credentials = json.loads(open('loginCredential.json').read())
        # l = [i for i in credentials.values()]
        username = credentials.get('username')
        password = credentials.get('password')
        self.lp.loginAmazon(username, password)
        self.hp.goToAmazonEcho()
        self.pdp.goToCart()
        before=self.cp.getTheTotalAmount()
        self.cp.removeProduct()
        after = self.cp.getTheTotalAmount()
        assert before==after,"Amount is not updated"
class Test_productDetails(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.lp = LoginPage(self.driver)
        self.pdp = ProductDetailsPage(self.driver)
        self.sp = ShoppingCartPage(self.driver)
        self.cp = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_goToPDP(self):
        self.hp.goToLogin()
        credentials = json.loads(open('loginCredential.json').read())
        username = credentials.get('username')
        password = credentials.get('password')
        self.lp.loginAmazon(username, password)
        self.hp.goToAmazonEcho()
        self.pdp.addToCart()
        self.sp.goToCart()
        before = self.cp.getTheTotalAmount()
        self.driver.close()