def setUp(self):
     lock.acquire()
     self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',
                              self.param)
     self.driver = self.device.getDeriver()
     lock.release()
     self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
     try:
         self.myDriver.findElement("id", "qaConfig").click()
     except Exception:
         print("Config is not qa!")
Beispiel #2
0
 def setUp(self):
     lock.acquire()
     self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',self.param)
     self.driver = self.device.getDeriver()
     lock.release()
     self.myDriver = MyFindElement(self.driver,"elementsConfig\\nba.yaml")
     try:
         self.myDriver.findElement("id","qaConfig").click()
     except Exception:
         print("Config is not qa!")
     self.myDriver.findElement("id", "skipButton").click()
     try:
         self.myDriver.findElement("id", "sysButton2").click()
     except Exception:
         print("Device has google service!")
     self.myDriver.findElement("id", "enterMyAccount").click()
Beispiel #3
0
class testSuit_onboarding_UI(ParametrizedTestCase):
    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',
                                 self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")
            pass

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    # @unittest.skip("not need")
    def test_onboarding_DL(self):
        for i in range(3):
            for i in range(2):
                location = self.myDriver.findElement_location("id", "DL")
                x = location['x']
                y = location['y']
                width = location['width']
                self.driver.swipe(x + width * 0.8, y, x, y, 500)
                time.sleep(2)
            for i in range(2):
                location = self.myDriver.findElement_location("id", "DL")
                x = location['x']
                y = location['y']
                width = location['width']
                self.driver.swipe(x, y, x + width * 0.8, y, 500)
                time.sleep(2)

    # @unittest.skip("not need")
    @data(["*****@*****.**", "111111"])
    @unpack
    def test_onboarding_myFavoriteTeam(self, user, psw):
        #login an account
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        #Enter to my favorite team page, remove my fav team
        try:
            counter = 0
            while True:
                self.myDriver.findElement("xpath", "favTeam").click()
                counter += 1
                # print("Remove a team successfully!")
        except Exception as eMsg:
            errorMsg = self.myDriver.findElement("id", "myFavTeamText").text
            msgRef = "No content is available at this time. Please check back later."
            msgRef_ = "You currently have no \"Favorite\" teams.  Tap a team to \"Favorite\"."
            if counter > 0:
                self.assertEqual(errorMsg,
                                 msgRef_,
                                 msg="Error Message is worng!")
            else:
                self.assertEqual(errorMsg,
                                 msgRef,
                                 msg="Error Message is worng!")
        #add my fav team
        for i in range(6):
            self.myDriver.findElement("xpath", "team").click()
            # print("Add a team successfully!")
        self.myDriver.is_toast_exist("maxFavTeam")

    # @unittest.skip("no need")
    @data(["*****@*****.**", "111111"])
    @unpack
    def test_onboarding_notifications(self, user, psw):
        # login an account
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        # enter to notification page
        self.myDriver.findElement("id", "continueButton").click()
        self.myDriver.findElement("id", "allow").click()
        elements = self.myDriver.findElements("id", "notificationSwitch")
        for i in range(len(elements)):
            elements[i].click()
        location = self.myDriver.findElement_location("id", "notificationRoll")
        self.driver.swipe(location['x']+location['width']/2,location['y'] + location['height']*0.8\
                ,location['x']+location['width']/2, location['y'], 500)
        elements = self.myDriver.findElements("id", "notificationSwitch")
        for i in range(len(elements)):
            elements[i].click()
        self.myDriver.findElement("id", "continueButton").click()
Beispiel #4
0
class testSuit_MyAccount_teamsTap(ParametrizedTestCase):

    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml', self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")
        self.myDriver.findElement("id", "skipButton").click()
        try:
            self.myDriver.findElement("id", "sysButton2").click()
        except Exception:
            print("Device has google service!")
        self.myDriver.findElement("id", "enterMyAccount").click()
        self.myDriver.findElement("id", "myFavorites").click()

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    # @unittest.skip("not need")
    @data(["*****@*****.**","111111"])
    @unpack
    def test_teamsTap_addFavTeams(self, user, psw):
        self.myDriver.findElement("xpath", "teamsTap").click()
        self.myDriver.findElement("id", "favSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        for i in range(6):
            self.myDriver.findElement("xpath", "team").click()
        self.myDriver.is_toast_exist("maxFavTeam")

    # @unittest.skip("not need")
    @data(["*****@*****.**", "111111"])
    @unpack
    def test_teamsTap_removeFavTeams(self, user, psw):
        self.myDriver.findElement("xpath", "teamsTap").click()
        self.myDriver.findElement("id", "favSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        location = self.myDriver.findElement_location("id", "favTeamList")
        x = location["x"]
        y = location["y"]
        h = location["height"]
        self.driver.swipe(x, y, x, y + h*0.7, 3000)
        try:
            for i in range(6):
                self.myDriver.findElement("xpath", "favTeam").click()
                # self.myDriver.is_toast_exist("")
        except Exception as msg:
            emsg = self.myDriver.findElement("id", "favTeamError").text
            emsgRefer = "You currently have no \"Favorite\" teams.  Tap a team to \"Favorite\"."
            self.assertEqual(emsg, emsgRefer, msg="Error messarge is worng!")
        for i in range(2):
            self.myDriver.findElement("xpath", "team").click()
Beispiel #5
0
class testSuit_MyAccount_videosTap(ParametrizedTestCase):

    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver,"elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id","qaConfig").click()
        except Exception:
            print("Config is not qa!")
        self.myDriver.findElement("id", "skipButton").click()
        try:
            self.myDriver.findElement("id", "sysButton2").click()
        except Exception:
            print("Device has google service!")
        self.myDriver.findElement("id", "enterMyAccount").click()

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    # @unittest.skip("not need")
    @data(["*****@*****.**","111111"])
    @unpack
    def test_videosTap_videoOperation(self, user, psw):
        self.myDriver.findElement("id", "myFavorites").click()
        self.myDriver.findElement("id", "favSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        # self.myDriver.findElement("xpath", "favVideoStar").click()
        self.myDriver.findElement("xpath", "favVideoShare").click()
        time.sleep(2)
        self.driver.keyevent(4)
        for i in range(2):
            location = self.myDriver.findElement_location("id", "favVideoList")
            x = location["x"]
            y = location["y"]
            h = location["height"]
            w = location["width"]
            self.driver.swipe(x + w/2, y + h*0.8, x + w/2, y, 3000)
        items = self.myDriver.findElements("className", "favVideos")
        items[0].click()
        time.sleep(10)
        self.myDriver.screenshot()
Beispiel #6
0
class testSuit_MyAccount_playersTap(ParametrizedTestCase):

    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml', self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")
        self.myDriver.findElement("id", "skipButton").click()
        try:
            self.myDriver.findElement("id", "sysButton2").click()
        except Exception:
            print("Device has google service!")
        self.myDriver.findElement("id", "enterMyAccount").click()
        self.myDriver.findElement("id", "myFavorites").click()

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    @data(["*****@*****.**", "111111"])
    @unpack
    def test_playersTap_addPlayer(self, user, psw):
        self.myDriver.findElement("xpath", "playersTap").click()
        self.myDriver.findElement("id", "favSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        try:
            for i in range(3):
                self.myDriver.findElement("xpath", "player").click()
        except Exception as eMsg:
            errorMsg = self.myDriver.findElement("id", "favPlayerTeamError").text
            msgRef = "You currently have no \"Favorite\" teams.  Tap a team to \"Favorite\"."
            self.assertEqual(errorMsg, msgRef, msg="Error message is worng!" )
class testSuit_Account_login(ParametrizedTestCase):
    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',
                                 self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    # @unittest.skip("not need")
    @data(["*****@*****.**", "111111"], [" [email protected] ", "111111"])
    @unpack
    def test_account_loginSuccessful(self, user, psw):
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")

    # @unittest.skip("not need")
    @data(["*****@*****.**", "111111"], ["*****@*****.**", "111111"])
    @unpack
    def test_account_loginNotFound(self, user, psw):
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginNotFound")

    # @unittest.skip("not need")
    @data(["eloy", "111111"], ["*****@*****.**", ""], ["", "11111"],
          ["#$%^", "23"])
    @unpack
    def test_account_loginError(self, user, psw):
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        try:
            print(self.myDriver.findElement("id", "inputError").text)
        except Exception as errorMsg:
            print(errorMsg)

    # @unittest.skip("not need")
    @data(["*****@*****.**"], ["eloy"], ["*****@*****.**"], [""])
    @unpack
    def test_account_forgotPassword(self, user):
        self.myDriver.findElement("id", "enterSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "forgotPassword").click()
        self.myDriver.findElement("id", "forgotUsername").send_keys(user)
        self.myDriver.findElement("id", "sendButton").click()
        try:
            self.myDriver.is_toast_exist("resetFailed")
        except Exception as errorMsg:
            print(errorMsg)
        try:
            print(self.myDriver.findElement("id", "inputError").text)
        except Exception as errorMsg:
            print(errorMsg)
        try:
            self.myDriver.findElement("id", "resetSigin").click()
        except Exception as errorMsg:
            print(errorMsg)
class testSuit_Account_subscription(ParametrizedTestCase):
    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',
                                 self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")
        self.myDriver.findElement("id", "skipButton").click()
        try:
            self.myDriver.findElement("id", "sysButton2").click()
        except Exception:
            print("Device has google service!")
        self.myDriver.findElement("id", "enterMyAccount").click()

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    @data(["*****@*****.**", "111111"])
    @unpack
    def test_account_subscription(self, user, psw):
        self.myDriver.findElement("id", "menuSigin").click()
        try:
            self.myDriver.findElement("xpath", "smartLock").click()
        except Exception:
            print("APP not show smart lock")
            pass
        self.myDriver.findElement("id", "userBox").send_keys(user)
        self.myDriver.findElement("id", "passwordBox").send_keys(psw)
        self.myDriver.findElement("id", "siginButton").click()
        self.myDriver.is_toast_exist("loginSuccess")
        self.myDriver.findElement("id", "myPackages").click()
        packageTitle = self.myDriver.findElement("xpath",
                                                 "myPackagesTitle").text
        packageLabel = self.myDriver.findElement("id", "packageLabel").text
        packageName = self.myDriver.findElement("id", "packageName").text
        packageHistoryLable = self.myDriver.findElement(
            "id", "packageHistoryLable").text
        packageDescripton = self.myDriver.findElement(
            "id", "packageDescription").text
        purchaseDate = self.myDriver.findElement("id", "purchaseDate").text
        gameEvent = self.myDriver.findElement("xpath", "gameEvent").text
        gameDate = self.myDriver.findElement("xpath", "gameDate").text
        self.assertEqual(packageTitle, "My Packages", msg="Text is worng!")
        self.assertEqual(packageLabel,
                         "My Subscriptions",
                         msg="Text is worng!")
        self.assertEqual(packageName, "League Pass", msg="Text is worng!")
        self.assertEqual(packageHistoryLable,
                         "My Games",
                         msg="Text is woring!")
        self.assertEqual(packageDescripton,
                         "Description",
                         msg="Text is woring!")
        self.assertEqual(purchaseDate, "Purchase Date", msg="Text is worng!")
        self.assertEqual(gameEvent,
                         "Hornetsa lasPistonsel 18-oct-2017",
                         msg="Text is worng!")
        self.assertEqual(gameDate, "2018/09/02", msg="Text is worng!")
class testSuit_Account_regist(ParametrizedTestCase):
    user = "******" + time.strftime("%Y%m%d%H%M%S") + "@neuqa.com"

    def setUp(self):
        lock.acquire()
        self.device = initDevice('projectDeviceConfig\\nbaConfig.yaml',
                                 self.param)
        self.driver = self.device.getDeriver()
        lock.release()
        self.myDriver = MyFindElement(self.driver, "elementsConfig\\nba.yaml")
        try:
            self.myDriver.findElement("id", "qaConfig").click()
        except Exception:
            print("Config is not qa!")

    def tearDown(self):
        self.driver.close_app()
        self.driver.quit()
        pass

    @data([user, "111111"])
    @unpack
    def test_account_registSuccessful(self, username, psw):
        self.myDriver.findElement("id", "getStarted").click()
        self.myDriver.findElement("id", "userBox").send_keys(username)
        self.myDriver.findElement("id", "registerPswBox").send_keys(psw)
        location = self.myDriver.findElement_location("id", "registerScorll")
        x = location["x"]
        y = location["y"]
        h = location["height"]
        self.driver.swipe(x, y + h * 0.7, x, y, 2000)
        checkBox = self.myDriver.findElements("className", "checkBoxs")
        for i in range(3):
            checkBox[i].click()
        self.myDriver.findElement("id", "creatAccount").click()
        time.sleep(3)
        self.myDriver.is_toast_exist("creatAccountSuccess")