def test02_002_DefaultSettings_StartTab(self): ''' :Test Cases: - Check Default Setting for Background Image. - Check Default Setting for Most Visited Websites. - Check Default Setting for News. :return: ''' self.log("Check 'Default Settings'.", "testsuite") PFT = FreshTab(self.settings) PSM = Settings(self.settings) PTO = TabsOverview(self.settings) PFT.disableAddressBar() PFT.goToSettings() if self.isPlatform('android'): PSM.openOrClickSetting("general") self.sleep(1) if self.isPlatform('android'): self.assertIsEqual( PSM.getStatusValueForSetting('backgroundImage')['switch'], PSM.getDefaultForSetting('backgroundImage'), "Check Default Setting for Background Image.") self.assertIsEqual( PSM.getStatusValueForSetting('mostVisitedWebsites')['switch'], PSM.getDefaultForSetting('mostVisitedWebsites'), "Check Default Setting for Most Visited Websites.") self.assertIsEqual( PSM.getStatusValueForSetting('news')['switch'], PSM.getDefaultForSetting('news'), "Check Default Setting for News.") PSM.goOutOfSettings() if self.isPlatform("android"): PFT.openTabsOverview() PTO.closeAllTabs()
def test06_001_SearchResultsFor(self): ''' :Test Cases: - Check Backend for Germany. - Check Backend for France. - Check Backend for United States. :return: ''' PFT = FreshTab(self.settings) PTO = TabsOverview(self.settings) PSM = Settings(self.settings) self.log("Check 'Search Results For' Feature.", "testsuite") testData = PSM.getSearchResultsForTestData() for country in testData: testPassStatus = None PFT.disableAddressBar() PFT.goToSettings() if self.isPlatform('android'): PSM.openOrClickSetting("general") PSM.openOrClickSetting("searchResultsFor") PSM.setSearchResultsFor(country) PSM.goOutOfSettings() for key, value in testData[country].iteritems(): result = PFT.getAutoCompletedValue(key, timeout=2) self.log("(" + value + ") in (" + result + ")") testPassStatus = True if value in result else False PFT.clearAndCancelAddressBar() self.assertIsEqual(testPassStatus, True, "Check Backend for " + country + ".") PFT.openTabsOverview() PTO.closeAllTabs()
def test01_002_FirstLaunch(self): ''' :Test Cases: - Check if App Starts with Address Bar. - Check if URL Bar exists. - Check if Address Bar does not exist. - Check that Keyboard is already Minimized. - Check if Address Bar exists. :return: ''' self.log("Check 'First Launch'.", "testsuite") PFT = FreshTab(self.settings) Onboarding(self.settings).startBrowsing() self.assertNotEqual(PFT.getAddressBar(), None, "Check if App Starts with Address Bar.", noException=True) PFT.disableAddressBar() self.assertIsEqual(PFT.getAddressBar(), None, "Check if Address Bar does not exist.") urlBar = PFT.getURLBar() self.assertNotEqual(urlBar, None, "Check if URL Bar exists.") self.assertIsEqual(self.minimizeKeyboard(), False, "Check that Keyboard is already Minimized.", noException=True) urlBar.click() self.assertNotEqual(PFT.getAddressBar(), None, "Check if Address Bar exists.")
def test06_002_ComplementarySearch(self): ''' :Test Cases: - Check `google` provider. - Check `bing` provider. - Check `duckduckgo` provider. - Check `amazon` provider. - Check `twitter` provider. - Check `wikipedia` provider. :return: ''' PFT = FreshTab(self.settings) PTO = TabsOverview(self.settings) PSM = Settings(self.settings) self.log("Check 'Complementary Search' Feature.", "testsuite") testData = PSM.getComplementarySearchEngines() for engine in testData: self.log("Testing Engine: " + engine) PFT.disableAddressBar() PFT.goToSettings() if self.isPlatform('android'): PSM.openOrClickSetting("general") PSM.openOrClickSetting("complementarySearch") PSM.setComplementarySearchEngine(engine) PSM.goOutOfSettings() link = PFT.openWebpage(self.generateRandomString()) self.assertIsIn(engine, link, "Check `" + engine + "` provider.") PFT.openTabsOverview() PTO.closeAllTabs()
def test05_002_GhosteryCCAdBlocking(self): ''' :Test Cases: - Check if Enhanced Options can be Expanded. - Check if Enhanced Options can be Collapsed. - Check if the AdBlocker Checkbox/Switch is Default Checked/Enabled. - Check if the Checkbox/Switch Changes status on Click. - Check if AD Block Status is as per the setting of the Feature. - Check if AD Block Status is as per the setting of the Feature after it is Changed. :return: ''' PFT = FreshTab(self.settings) PTO = TabsOverview(self.settings) self.log("Check 'Ghostery Control Center - AD Blocking' Feature.", "testsuite") # Check USB Debugging. Enable If not already Enabled. PFT.disableAddressBar() PFT.goToSettings() PSM = Settings(self.settings) PSM.openOrClickSetting("advanced") self.sleep(1) if PSM.getStatusValueForSetting('enableRemoteDebugging')['switch'] == False: PSM.openOrClickSetting("enableRemoteDebugging") self.sleep(1) PSM.goOutOfSettings() # Verified / Enabled USB Debugging. PFT.openWebpage(adBlockLink, loadTimeout=7) PGV = GeckoView(self.settings) blockStatus = PGV.isADBlocked() ghosty = PFT.getGhostyButton() ghosty.click() PGCC = GhosteryCC(self.settings) ghosteryCC = PGCC.getGhosteryCC() notch = PGCC.getGhosteryNotch(ghosteryCC) PGCC.expandEnhancedOptions(notch) self.assertIsEqual(PGCC.isEnhancedOptionsExpanded(), True, "Check if Enhanced Options can be Expanded.") PGCC.collapseEnhancedOptions() self.assertIsEqual(PGCC.isEnhancedOptionsExpanded(), False, "Check if Enhanced Options can be Collapsed.") PGCC.expandEnhancedOptions() switch = PGCC.getGhosteryAdBlockerSwitch() attrib = "value" if self.isPlatform("ios") else "checked" featureStatus = self.convertToBool(switch.get_attribute(attrib)) self.assertIsEqual(blockStatus, featureStatus, "Check if AD Block Status is as per the setting of the Feature.") self.assertIsEqual(featureStatus, defaultSettings['AdBlocking'], "Check if the AdBlocker Checkbox/Switch is Default Checked/Enabled.") switch.click() self.sleep(1) featureStatus = self.convertToBool(switch.get_attribute(attrib)) self.sleep(1) self.assertIsEqual(featureStatus, not defaultSettings['AdBlocking'], "Check if the Checkbox/Switch Changes status on Click.") ghosty.click() PFT.openWebpage(adBlockLink, loadTimeout=7) blockStatus = PGV.isADBlocked() self.assertIsEqual(blockStatus, featureStatus, "Check if AD Block Status is as per the setting of the Feature after it is Changed.") PFT.openTabsOverview() PTO.closeAllTabs()
def test02_001_DefaultSettings_Search(self): ''' :Test Cases: - Check if you can open the Settings Menu. - Check Default Setting for Search Results For. - Check Default Setting for Block Explicit Content. - Check Default Setting for Human Web. - Check Default Setting for Enable Autocompletion. - Check Default Setting for Quick Search. - Check Default Setting for Complementary Search. :return: ''' self.log("Check 'Default Settings'.", "testsuite") PFT = FreshTab(self.settings) PSM = Settings(self.settings) PFT.disableAddressBar() if self.isPlatform('ios'): PFT.enableAddressBar() PFT.goToSettings() self.assertIsEqual(PSM.isSettingsMenu(), True, "Check if you can open the Settings Menu.") if self.isPlatform('android'): PSM.openOrClickSetting("general") self.sleep(1) self.assertIsIn( PSM.getStatusValueForSetting('searchResultsFor')['summary'], PSM.getDefaultForSetting('searchResultsFor'), "Check Default Setting for Search Results For.") self.assertIsEqual( PSM.getStatusValueForSetting('blockExplicitContent')['switch'], PSM.getDefaultForSetting('blockExplicitContent'), "Check Default Setting for Block Explicit Content.") if self.isPlatform('ios'): self.assertIsEqual( PSM.getStatusValueForSetting('humanWeb')['summary'], PSM.getDefaultForSetting('humanWeb'), "Check Default Setting for Human Web.") else: self.assertIsEqual( PSM.getStatusValueForSetting('enableAutocompletion')['switch'], PSM.getDefaultForSetting('enableAutocompletion'), "Check Default Setting for Enable Autocompletion.") self.assertIsEqual( PSM.getStatusValueForSetting('quickSearch')['switch'], PSM.getDefaultForSetting('quickSearch'), "Check Default Setting for Quick Search.") self.assertIsEqual( PSM.getStatusValueForSetting('complementarySearch')['summary'], PSM.getDefaultForSetting('complementarySearch'), "Check Default Setting for Complementary Search.", skipIf="android", skipMessage="No Default Complementary Search for Android.") PSM.goOutOfSettings()
def test03_002_HistoryList(self): ''' :Test Cases: - Check if only 1 History entry is generated. - Check if the URL is correctly generated in History. - Check if the History is Empty. :return: ''' PFT = FreshTab(self.settings) PTO = TabsOverview(self.settings) self.log("Check 'History' Feature on Fresh Tab.", "testsuite") PFT.getHistoryButton().click() self.sleep(2) initialList = PFT.getHistoryList() PFT.getTopSitesButton().click() webpage = PFT.openWebpage() self.log(webpage) PFT.openTabsOverview() PTO.closeAllTabs() PFT.disableAddressBar() self.sleep(2) PFT.getHistoryButton().click() newHistory = self.listDiff(initialList, PFT.getHistoryList()) self.assertIsEqual(len(newHistory), 1, "Check if only 1 History entry is generated.") self.assertIsIn(webpage, newHistory[0]['url'], "Check if the URL is correctly generated in History.") if self.isPlatform("ios"): PFT.goToSettings() PSM = Settings(self.settings) PSM.openOrClickSetting("clearPrivateData") PSM.clearData("browsingHistory") PSM.goOutOfSettings() else: PFT.quickClearHistory() self.sleep(3) PFT.getFavoritesButton().click() PFT.getHistoryButton().click() self.sleep(3) finalList = PFT.getHistoryList() self.assertIsEqual(finalList, [], "Check if the History is Empty.") PFT.getTopSitesButton().click()
def test03_003_TopSites(self): ''' :Test Cases: - Check for Top Sites Section. - Visit Test Webpage and Check if TopSite is added. - Check if the Domain of the Test Webpage is correct. - Visit Ask.com and Check if TopSite is added. - Check if the Domain of Ask.com is correct. - Check if a TopSite can be removed. - Check if only the correct TopSite is removed and the other remains. - Check if Clearing History removes the TopSites as well. :return: ''' PFT = FreshTab(self.settings) PTO = TabsOverview(self.settings) PSM = Settings(self.settings) PFT.disableAddressBar() PFT.goToSettings() if self.isPlatform('android'): PSM.openOrClickSetting("general") self.sleep(1) if PSM.getStatusValueForSetting('mostVisitedWebsites')['switch'] != True: PSM.changeSettingStatus("mostVisitedWebsites", True) self.sleep(1) PSM.goOutOfSettings() '''if self.isPlatform("ios"): PSM.openOrClickSetting("clearPrivateData") PSM.clearData("browsingHistory") PSM.goOutOfSettings() else: PSM.goOutOfSettings() PFT.getHistoryButton().click() PFT.quickClearHistory() self.sleep(3) PFT.getFavoritesButton().click() PFT.getTopSitesButton().click()''' initialData = PFT.getTopSitesData() for count in range(0, 4): PFT.openWebpage() PFT.openTabsOverview() PTO.closeAllTabs() PFT.disableAddressBar() self.assertNotEqual(PFT.getTopSitesSection(), None, "Check for Top Sites Section.") intermediateData = PFT.getTopSitesData() newTopSite = self.listDiff(initialData, intermediateData) self.assertIsEqual(len(newTopSite), 1, "Visit Test Webpage and Check if TopSite is added.") self.assertIsIn("test" if self.isPlatform("android") else "cliqz", newTopSite[0].lower(), "Check if the Domain of the Test Webpage is correct.") for count in range(0, 4): PFT.openWebpage(askLink) PFT.openTabsOverview() PTO.closeAllTabs() PFT.disableAddressBar() finalData = PFT.getTopSitesData() newTopSite = self.listDiff(intermediateData, finalData) self.assertIsEqual(len(newTopSite), 1, "Visit Ask.com and Check if TopSite is added.") self.assertIsIn("ask", " ".join(finalData).lower(), "Check if the Domain of Ask.com is correct.") '''if self.isPlatform("ios"): PFT.deleteTopSite(PFT.getAllTopSites()[0]) self.sleep(3) tempData = PFT.getTopSitesData() self.log("Final Data: "+str(finalData)+"["+str(len(finalData))+"]") self.log("Temp Data: " + str(tempData) + "[" + str(len(tempData)) + "]") self.assertIsEqual(len(finalData)-len(tempData), 1, "Check if a TopSite can be removed.") self.assertIsEqual(tempData[0], finalData[1], "Check if only the correct TopSite is removed and the other remains.") PFT.goToSettings() PSM = Settings(self.settings) PSM.openOrClickSetting("clearPrivateData") PSM.clearData("browsingHistory") PSM.goOutOfSettings() else: PFT.getHistoryButton().click() PFT.quickClearHistory() PFT.quickClearHistory() self.sleep(3) PFT.getFavoritesButton().click() PFT.getTopSitesButton().click()''' PFT.openTabsOverview() PTO.closeAllTabs() PFT.disableAddressBar()
def test01_004_TabsOverview(self): ''' :Test Cases: - Check if only 1 Tab exists in the list. - Check Address Bar is not present. - Check Tabs Panel Element is present. - Check Tabs Panel has a Header Bar. - Check Tabs Panel Header Bar has a Tabs Button. - Check Tabs Panel Header Bar has a Private Button. - Check Tabs Panel Header Bar has a Add Tab Button. - Check Tabs Panel Header Bar has a Menu Button. - Check if the tabs count is as per the number of tabs. - Check if Private Tabs List is Empty. - Check if FreshTab is opened after removing all tabs. :return: ''' self.log("Check 'Tabs Overview'.", "testsuite") PFT = FreshTab(self.settings) tabsCount = PFT.getTabsCount() self.assertIsEqual(tabsCount, 1, "Check if only 1 Tab exists in the list.", skipIf="ios", skipMessage="Tabs Counter is not present for iOS.") PFT.openTabsOverview() PTO = TabsOverview(self.settings) self.assertIsEqual(PFT.getAddressBar(), None, "Check Address Bar is not present.") tabsPanel = PTO.getTabsPanel() self.assertNotEqual(tabsPanel, None, "Check Tabs Panel Element is present.") tabsPanelHeaderBar = PTO.getHeaderBar(tabsPanel) self.assertNotEqual(tabsPanelHeaderBar, None, "Check Tabs Panel has a Header Bar.") self.assertNotEqual(PTO.getTabsButton(tabsPanelHeaderBar), None, "Check Tabs Panel Header Bar has a Tabs Button.", skipIf="ios", skipMessage="No Back Button for iOS.") self.assertNotEqual(PTO.getNavNormalTabsButton(), None, "Check Tabs Panel Header Bar has a Tabs Button.", skipIf="ios", skipMessage="No Tabs Button for iOS.") self.assertNotEqual( PTO.getNavPrivateTabsButton(), None, "Check Tabs Panel Header Bar has a Private Button.") self.assertNotEqual( PTO.getNavAddTabButton(tabsPanelHeaderBar), None, "Check Tabs Panel Header Bar has a Add Tab Button.", noException=True) self.assertNotEqual(PTO.getNavTabsMenuButton(tabsPanelHeaderBar), None, "Check Tabs Panel Header Bar has a Menu Button.", skipIf="ios", skipMessage="No Menu Button for iOS.") self.assertIsEqual( len(PTO.getTabsList(tabsPanel)), tabsCount, "Check if the tabs count is as per the number of tabs.", skipIf="ios", skipMessage="Tabs Counter is not present for iOS.") self.assertIsEqual(PTO.isPrivateTabsEmpty(tabsPanel), True, "Check if Private Tabs List is Empty.", noException=True) PTO.closeAllTabs() self.assertIsEqual( PFT.disableAddressBar().text, "Search or enter address", "Check if FreshTab is opened after removing all tabs.")