def test_apply_parenthesis_on_single_datasource(self):
        section = self.__class__.__name__
        project_name = self.configAB[section]["project_name"]
        audience_name = self.configAB[section]["audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)

        audience_page = AudiencePage(self.webdriver, self.config)
        WebDriverWait(self.webdriver, 50).until(
            EC.presence_of_element_located(
                (By.XPATH, "//div[text()='Age between 18, 36']"))).click()
        self.webdriver.find_element_by_xpath(
            "//div[text()='Income Level in Greater than $124,999']").click()
        audience_page.click_parenthesis_icon()
        self.webdriver.find_element_by_xpath(
            "//div[@class='paren ng-scope paren-criteria']").click()
        sleep(10)
        self.webdriver.find_element_by_xpath(
            "//div[@class='paren ng-scope paren-criteria selected']/img"
        ).click()
    def test_apply_parenthesis_on_multiple_datasources(self):
        section = self.__class__.__name__
        project_name = self.configAB[section]["project_name"]
        audience_name = self.configAB[section]["audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        sleep(15)
        audience_page = AudiencePage(self.webdriver, self.config)
        WebDriverWait(self.webdriver, 50).until(
            EC.presence_of_element_located(
                (By.XPATH, "//div[text()='Demographic Data']"))).click()
        WebDriverWait(self.webdriver, 50).until(
            EC.presence_of_element_located(
                (By.XPATH, "//div[text()='Location Data']"))).click()
        audience_page.click_parenthesis_icon()
        self.webdriver.find_element_by_xpath(
            "//div[@class='paren ng-scope']").click()
        sleep(10)
        self.webdriver.find_element_by_xpath(
            "//div[@class='paren ng-scope selected']/img").click()
Ejemplo n.º 3
0
    def test_create_purchase_data_audiences(self):

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects("Test_US_Automation")
        sleep(10)
        # Audience Creation using Advanced Audience Data
        proj_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Purchase_Audience')
        audience_page.add_dataSource('Purchase Behavior')
        criteria_label = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'header-label ng-binding ui-draggable-handle')]"
        ).text
        print(criteria_label)
        source = self.webdriver.find_element_by_xpath(
            "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'"
            + criteria_label + "')]")
        target = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
        )
        mouse = ActionChains(self.webdriver)
        mouse.drag_and_drop(source, target).perform()
        audience_page.create_purchase_data_criteria('Category',
                                                    'AIR FRESHENERS')
        # audience_page.add_criteria_plusicon().click()
        # audience_page.create_advanced_audience_data_criteria('In-Market Audiences', 'Beauty and Wellness', 'Personal Care', 'Hair Care')
        sleep(5)
        # self.webdriver.find_element_by_xpath("//div[contains(@class ,'text ng-binding') and contains(@ng-bind,'i.value')]").click()
        # sleep(5)
        # self.webdriver.find_element_by_xpath("//div[contains(@class ,'ng-binding ng-scope') and contains(text(),'OR')]").click()
        audience_page.save_and_create_button().click()
        sleep(10)
Ejemplo n.º 4
0
    def test_fetch_audience_data(self):
        project_name = self.configAB["Lotame_Viz"]["project_name"]
        path = os.path.join('testdata', 'sidebar.json')
        print("location:" + path)

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)

        with open(path) as file:
            data = json.load(file)
        for item in range(len(data)):
            link = data[item]["link"]
            # Project selection
            new_project_name = project_name + '_' + link
            print(new_project_name)
            sleep(5)
            home_page.searchProjects(new_project_name)
            sleep(10)
            num_aud_panel = len(self.webdriver.find_elements_by_xpath("//div[@class = 'audiences-section']//audience-panel"))
            print(num_aud_panel)
            for i in range (1,num_aud_panel+1):
                audience_name       = self.webdriver.find_element_by_xpath("(//div[@class = 'audience-title ng-binding'])[position()="+str(i)+"]").text
                individual_count    = self.webdriver.find_element_by_xpath("(//div[@class = 'audiences-section']//audience-panel//span[@class = 'id-count ng-binding'])[position()= "+str(i)+"]").text
                household_count     = self.webdriver.find_element_by_xpath("(//div[@class = 'audiences-section']//audience-panel//span[@class = 'hh-count ng-binding'])[position()= "+str(i)+"]").text
                device_count        = self.webdriver.find_element_by_xpath("(//div[@class = 'audiences-section']//audience-panel//span[@class = 'device-count ng-binding'])[position()= "+str(i)+"]").text
                print(individual_count)
                file_path = os.path.abspath("Datafile.xlsx")
                print(file_path)
                rows = XLUtils.getRowCount(file_path, "aud_data")
                print(rows)

                converted_indi          = audience_page.convert_str_to_number(individual_count)
                print(converted_indi)
                converted_house         = audience_page.convert_str_to_number(household_count)
                print(converted_house)
                converted_device        = audience_page.convert_str_to_number(device_count)
                print(converted_device)

                XLUtils.WriteData(file_path, "aud_data", rows + 1, 1, new_project_name)
                XLUtils.WriteData(file_path, "aud_data", rows + 1, 2, audience_name)

                #To get the number in human readable format for e.g 1000 to 1k
                # XLUtils.WriteData(file_path, "aud_data", rows+1, 3 , individual_count)
                # XLUtils.WriteData(file_path, "aud_data", rows+1, 4 , household_count)
                # XLUtils.WriteData(file_path, "aud_data", rows+1, 5 , device_count)


                #To get the number in long format for e.g 1k to 1000, 1M to 1000000
                XLUtils.WriteData(file_path, "aud_data", rows + 1, 3, converted_indi)
                XLUtils.WriteData(file_path, "aud_data", rows + 1, 4, converted_house)
                XLUtils.WriteData(file_path, "aud_data", rows + 1, 5, converted_device)

            sleep(10)
            # Navigating to home screen
            self.webdriver.switch_to_default_content()
            home_page.lbl_Audience_Explorer_omni().click()
            sleep(10)
            iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
            self.webdriver.switch_to.frame(iframe)
    def test_save_and_create_disable(self):
        project_name = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        audience_name = 'Test Aud'+my_random_string(3)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.audience_name_textbox().send_keys(audience_name)
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(5)
        proj_page.audience_menu_icon(audience_name).click()
        proj_page.audienceEditIcon(audience_name)
        sleep(30)
        status = audience_page.save_and_create_button().get_attribute('disabled')
        self.assertEqual(status,'true','save and create disable feature not working')
        self.webdriver.find_element_by_css_selector(".back").click()

        proj_page.audience_menu_icon(audience_name).click()
        proj_page.audience_delete_icon(audience_name).click()
        proj_page.AlertOkButton().click()
Ejemplo n.º 6
0
    def test_verify_numbers(self):
        project_name = self.configAB["individual_count"]["project_name"]
        audience_name = self.configAB["individual_count"]["audience_name"]
        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        project_page = ProjectPage(self.webdriver, self.config)
        sleep(10)
        project_page.selectAudiences(audience_name)
        sleep(5)
        lbl_individual = audience_page.lbl_individuals(audience_name).text
        print("This is the value of individuals on the right " +
              lbl_individual)
        sleep(10)
        lbl_panelindividuals = audience_page.lbl_PanelIndividuals(
            audience_name).text
        print("This is the value of individuals on the left div " +
              lbl_panelindividuals)
        self.assertEqual(lbl_individual, lbl_panelindividuals)

        lbl_households = audience_page.lbl_household(audience_name).text
        print("This is the value of household on the right " + lbl_households)
        sleep(10)
        lbl_householdpanel = audience_page.lbl_PanelHousehold(
            audience_name).text
        print("This is the value of households on the left div " +
              lbl_householdpanel)
        self.assertEqual(lbl_households, lbl_householdpanel)

        lbl_device = audience_page.lbl_devices(audience_name).text
        print("This is the value of devices on the right " + lbl_device)
        sleep(10)
        lbl_devicepanel = audience_page.lbl_PanelDevice(audience_name).text
        print("This is the value of device on the left div " + lbl_devicepanel)
        self.assertEqual(lbl_device, lbl_devicepanel)
Ejemplo n.º 7
0
    def test_purchase_behaviour_subcategory(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Subcategory']").click()
        sleep(5)
        self.webdriver.find_element_by_xpath("//an-typeahead").click()
        sleep(5)
        try:
            self.webdriver.find_elements_by_xpath("//an-typeahead/div/ul/li")
            audience_page.aud_back_arrow().click()
        except NoSuchElementException:
            assert False
    def test_copy_audience_multiple_criteria_to_other_audience(self):
        section = self.__class__.__name__
        project_name = self.configAB[section]["project_name"]
        audience_name_multiple_source = self.configAB[section][
            "audience_name_multiple_source"]
        audience_name_multiple_dest = self.configAB[section][
            "audience_name_multiple_dest"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name_multiple_source).click()
        project_page.audienceEditIcon(audience_name_multiple_source)

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.copy_multiple_audience_criteria_within_self()

        self.webdriver.find_element_by_xpath(
            "//div[@class='sources-panel']/div[1]").click()

        project_page.audience_menu_icon(audience_name_multiple_dest).click()
        project_page.audienceEditIcon(audience_name_multiple_dest)
        sleep(5)

        self.webdriver.find_element_by_xpath(
            "//div[text()='Insert Copied Criteria']").click()
        audience_page.delete_audience_criteria("Demographic Data")
        audience_page.delete_audience_criteria("Location Data")
Ejemplo n.º 9
0
    def test_create_demographic_data_audiences(self):

        proj_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects("Test_US_Automation")
        sleep(10)
        # Audience Creation using Advanced Audience Data
        proj_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Demographic_Audience')
        audience_page.add_dataSource('Demographic Data')
        criteria_label = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'header-label ng-binding ui-draggable-handle')]"
        ).text
        print(criteria_label)
        source = self.webdriver.find_element_by_xpath(
            "//div[contains(@class,'header-label ng-binding ui-draggable-handle') and contains(text(),'"
            + criteria_label + "')]")
        target = self.webdriver.find_element_by_xpath(
            "//div[contains(@class, 'criteria-panel-header') and contains(text(),'Define Your Audience')]"
        )
        mouse = ActionChains(self.webdriver)
        mouse.drag_and_drop(source, target).perform()
        audience_page.create_demographic_data_criteria('Age')
        sleep(5)
        # audience_page.save_and_create_button().click()
        sleep(10)
Ejemplo n.º 10
0
    def test_purchase_behaviour_category(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        sleep(5)
        try:
            self.webdriver.find_element_by_xpath(
                "//input[@placeholder='Begin typing to search...']").click()
            self.webdriver.find_element_by_xpath(
                "//li[contains(text(),'AIR FRESHENERS')]").click()
            audience_page.aud_back_arrow().click()
        except NoSuchElementException:
            assert False
Ejemplo n.º 11
0
    def test_error_message_at_viz_canvas(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(10)
        project_page.AudienceName('Test Audience').click()
        message = self.webdriver.find_element_by_xpath("//div[@class='spinner-wrapper']//following::p[1]").text
        self.assertEqual(message,"Your audience is being built.","Incorrect message is getting displayed at Viz Canvas")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
Ejemplo n.º 12
0
    def test_distribution_icon_disabled(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath("//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath("//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath("//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath("//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]")
        self.webdriver.execute_script("arguments[0].click();", criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_and_create_button().click()
        sleep(10)
        project_page.AudienceName('Test Audience').click()
        distribution_icon = project_page.audience_share_icon('Test Audience')
        if distribution_icon.is_enabled():
            print("Distribution Icon is disabled")
        else:
            print("Distribution Icon is not disabled")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
Ejemplo n.º 13
0
    def test_tag_at_history_panel(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        sleep(5)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_audience_button().click()
        sleep(10)

        project_page.AudienceName('Test Audience').click()
        project_page.HistoryTab().click()
        sleep(10)
        tag = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[2]"
        ).text

        now = datetime.datetime.now()
        todays_date = now.strftime("%b %d, %Y").replace(' 0', ' ')
        date = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[3]"
        ).text

        # Verify today's time with log time
        time = self.webdriver.find_element_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul[1]/li[4]"
        ).text
        tag_time_value = int(time[:-3].replace(":", ""))
        curr_time_value = int(now.strftime("%I") + now.strftime("%M"))

        assert (curr_time_value -
                tag_time_value) < 45, 'Time displayed in log seems incorrect'
        self.assertEqual(date, todays_date, "created tag date incorrect")
        self.assertEqual(tag, "Created", "created tag incorrect")

        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
    def test_time_period_criteria(self):
        project_name = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()

        audience_page = AudiencePage(self.webdriver, self.config)
        time_period = audience_page.get_time_period().text
        self.assertEqual(time_period, "Q1 2020", "Default Time period incorrect")

        audience_page.click_edit_time_period().click()
        sleep(5)
        time_period_list = self.webdriver.find_element_by_xpath(
            "//div[text()='Select Time Period*']/following::select[contains(@ng-model,'selectedTimePeriodsNew')]/option[contains(@value,'object')]").text
    def test_verify_agerange_starts_from_eighteen_advance_audience(self):
        project_name    = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource("Advanced Audience Data")
        showing_age_list = audience_page.check_advance_age()
        print(showing_age_list)
        str =showing_age_list.replace("\n", "\t").replace("Age Range in Household - ","").replace("Age - Head of Household","")\
            .replace("Age - Input Individual","").replace("18-24","").replace("25-34","").replace("35-44","").replace("45-54","").replace("55-64","").replace("65-74","")\
            .replace("75+","").replace(" - Male","").replace(" - Female","").replace(" - Unknown Gender","").replace("-","").strip()

        self.assertEqual(str, "", "Age attributes are not correct")
    def test_project_objective_field(self):
        project_name      = self.configAB["Objective_Field_Test"]["project_name"]
        project_objective = self.configAB["Objective_Field_Test"]["objective"]
        # data_env = self.configAB["CreatePrivateProject"]["data_env"]

        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)
        project_page = ProjectPage(self.webdriver, self.config)
        project_page.project_menu_icon(project_name).click()
        home_page.project_edit_icon(project_name).click()
        # project_page.AddObjective().send_keys("Test 123")
        project_page.AddObjective().send_keys(project_objective)
        audience_page.icon_cross_objective().click()
        project_page.project_menu_icon(project_name).click()
        home_page.project_edit_icon(project_name).click()
        Prefilled_objective = audience_page.lbl_project_objective().text
        print("This is the prefilled value of objective " + Prefilled_objective)
    def test_created_audience_timestamp(self):
        project_name = self.configAB["audience_timestamp"]["project_name"]
        audience_name = self.configAB["audience_timestamp"]["audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        sleep(10)
        actual_timestamp = self.webdriver.find_element_by_xpath("//div[contains(@class,'edit-when ng-scope')]").text
        # print("This is the actual timestamp " + actual_timestamp)
        date_time = audience_page.lbl_date_time().text
        user = audience_page.lbl_User().text
        data_env = audience_page.lbl_data_env().text
        expected_timestamp = "Last Created" + " " + date_time + " By " + user + " " + data_env
        assert actual_timestamp.startswith("Last Created")
        self.assertEqual(actual_timestamp, expected_timestamp)
Ejemplo n.º 18
0
    def test_save_and_create_all_aud(self):
        # project_name = self.configAB["Conceptual"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects('Lotame_Switzerland_30-08-2019')
        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        aud_name_list = []
        aud_list = WebDriverWait(self.webdriver, 100).until(
            EC.presence_of_all_elements_located(
                (By.XPATH, "//div[contains(@class ,'audience-title')]")))
        for aud in aud_list:
            audience_name = str(aud.text)
            aud_name_list.append(audience_name)

        for aud_name in aud_name_list:
            try:
                sleep(5)
                project_page.audience_menu_icon(aud_name).click()
                project_page.audienceEditIcon(aud_name)
            except Exception as e:
                print(aud_name, e)
                continue
            try:
                sleep(5)
                audience_page.save_and_create_button().click()
            except Exception as e:
                print(aud_name, e)
                audience_page.aud_back_arrow().click()
Ejemplo n.º 19
0
    def test_infoviz_getting_displayed_after_editing(self):
        section = self.__class__.__name__
        project_name = self.configAB[section]["project_name"]
        audience_name = self.configAB[section]["audience_name"]
        new_audience_name = self.configAB[section]["new_audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)

        home_page.searchProjects(project_name)
        project_page.AudienceName(audience_name).click()
        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        audience_page.audience_rename(new_audience_name)
        sleep(10)
        Info_Viz = self.webdriver.find_element_by_xpath("//div[contains(@id,'dataVisualizations')]")
        # info_Viz_Icon = self.webdriver.find_element_by_xpath("//button[contains(@ng-click,'$ctrl.selectChartType(1)')]")
        if Info_Viz.is_displayed():
            print("Infoviz is getting displayed")
        else:
            print("Infoviz is not getting displayed")

        # renaming to original one
        project_page.AudienceName(new_audience_name).click()
        project_page.audience_menu_icon(new_audience_name).click()
        project_page.audienceEditIcon(new_audience_name)
        audience_page.audience_rename(audience_name)
Ejemplo n.º 20
0
    def test_purchase_behaviour_product_name(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        sleep(5)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource(ds_type)
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Product Name']").click()
        sleep(5)
        self.webdriver.find_element_by_xpath("//an-typeahead").click()
        sleep(5)
        list = self.webdriver.find_elements_by_xpath(
            "//an-typeahead/div/ul/li")
        p_name = ""
        for i in list:
            product_name = i.text
            if "category" in product_name:
                p_name = product_name

        self.assertEqual(p_name, "", "Product names list contain category")
Ejemplo n.º 21
0
    def test_purchase_behaviour(self):
        project_name = self.configAB["purchase_behaviour"]["project_name"]
        ds_type = self.configAB["purchase_behaviour"]["ds_type"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource(ds_type)
        sleep(5)
        cols = self.webdriver.find_elements_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]/option")
        col = ""
        for i in cols:
            col = i.text + col

        print(col)
        self.assertEqual(col, "QuintileProduct NameSubcategoryCategory",
                         "Purchase behaviour column list incorrect")
 def test_public_project_other_user(self):
     rand = my_random_string(3)
     home_page = HomePage(self.webdriver, self.config)
     project_page = ProjectPage(self.webdriver, self.config)
     audience_page = AudiencePage(self.webdriver, self.config)
     project_name = 'Test Proj' + rand
     print ("This is the project name created " + project_name)
     home_page.createProject(project_name, 'NA - United States')
     sleep(10)
     self.webdriver.switch_to_default_content()
     # actions = ActionChains(self.webdriver)
     # actions.move_to_element(project_page.img_profile()).perform()
     home_page.img_profile().click()
     sleep(5)
     home_page.link_signout().click()
     sleep(15)
     login_page = LoginPage(self.webdriver, self.config)
     login_page.login('ADMINQA.test', 'Welcome@321')
     sleep(15)
     WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//button[@class='header_nav_btn']"))).click()
     sleep(5)
     WebDriverWait(self.webdriver, 100).until(EC.visibility_of_element_located((By.XPATH, "//span[text()='Audience Explorer (Omni)']"))).click()
     sleep(5)
     iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
     self.webdriver.switch_to.frame(iframe)
     home_page.searchProjects(project_name)
     project_page.project_menu_icon(project_name).click()
     home_page.project_edit_icon(project_name).click()
     # project_page.AddObjective().send_keys("Test 123")
     project_page.AddObjective().clear()
     project_page.AddObjective().send_keys('Test run time objective')
     sleep(5)
     audience_page.icon_greentick_objective().click()
     sleep(3)
     project_page.project_menu_icon(project_name).click()
     project_page.project_delete_icon(project_name).click()
     sleep(3)
     project_page.AlertOkButton().click()
     sleep(5)
Ejemplo n.º 23
0
    def test_verify_activation_rate_and_CPM_value(self):
        section = self.__class__.__name__
        project_name = self.configAB["cpm_rate"]["project_name"]
        audience_name = self.configAB["cpm_rate"]["audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)

        home_page.searchProjects(project_name)

        project_page.audience_menu_icon(audience_name).click()
        project_page.audience_share_icon(audience_name).click()
        self.webdriver.find_element_by_xpath(
            "//*[text()='" + audience_name +
            "']//following::div[contains(@class ,distribute-dd-menu)]/div[contains(text(),'Trade Desk')]"
        ).click()
        CPM_rate = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//table[@class='rate-card-table']/tbody/tr/th/span"))).text
        print(CPM_rate)
        self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'btn.onClick()')]//following::span[text()='Cancel']"
        ).click()

        project_page.audience_menu_icon(audience_name).click()
        project_page.audienceEditIcon(audience_name)
        activation_rate = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.XPATH, "//span[contains(@class,'cost')]"))).text
        print(activation_rate)

        self.assertEqual(activation_rate, CPM_rate,
                         'Activation rate & CPM rate is not same')
        audience_page.aud_back_arrow().click()
Ejemplo n.º 24
0
    def test_project_searchable_admin_page_export(self):
        project_name = self.configAB["check_admin_import"]["project_name"]
        project_objective = self.configAB["check_admin_import"]["objective"]
        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)

        home_page.searchProjects(project_name)
        project_page = ProjectPage(self.webdriver, self.config)
        project_page.project_menu_icon(project_name).click()
        home_page.project_edit_icon(project_name).click()
        project_page.AddObjective().clear()
        sleep(3)
        audience_page.icon_greentick_objective().click()
        sleep(5)
        self.webdriver.switch_to_default_content()
        home_page.lbl_Audience_Explorer_omni().click()
        sleep(20)
        iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
        self.webdriver.switch_to.frame(iframe)
        home_page.cog_button().click()
        sleep(10)
        home_page.chk_admin_audience_setting().click()
        sleep(5)
        home_page.drp_admin_project().click()
        sleep(10)
        self.webdriver.find_element_by_xpath("//option[text()='" +
                                             project_name + "']").click()
        home_page.drp_admin_project().click()
        self.webdriver.switch_to_default_content()
        home_page.lbl_Audience_Explorer_omni().click()
        iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
        self.webdriver.switch_to.frame(iframe)
        sleep(10)
        home_page.searchProjects(project_name)
        project_page.project_menu_icon(project_name).click()
        home_page.project_edit_icon(project_name).click()
        project_page.AddObjective().send_keys(project_objective)
        sleep(5)
        audience_page.icon_greentick_objective().click()
        sleep(5)
        self.webdriver.switch_to_default_content()
        home_page.lbl_Audience_Explorer_omni().click()
        sleep(20)
        iframe = self.webdriver.find_elements_by_tag_name('iframe')[0]
        self.webdriver.switch_to.frame(iframe)
        home_page.cog_button().click()
        sleep(10)
        home_page.chk_admin_audience_setting().click()
        sleep(5)
        home_page.drp_admin_project().click()
        sleep(10)
        self.webdriver.find_element_by_xpath("//option[text()='" +
                                             project_name + "']").click()
        home_page.drp_admin_project().click()
    def test_audience_history_tag_title(self):
        rand = my_random_string(3)
        home_page = HomePage(self.webdriver, self.config)
        home_page.createProject('Test Proj' + rand, 'NA - United States')
        sleep(10)
        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        project_page.add_audience_button().click()
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        # audience_page.criteria_createButton().click()
        sleep(5)
        audience_page.save_audience_button().click()
        sleep(10)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.AudienceName('Test Audience').click()
        project_page.HistoryTab().click()
        project_page.close_history().click()
        sleep(5)
        project_page.HistoryTab().click()

        list = self.webdriver.find_elements_by_xpath(
            "//audience-history-list/ul/li/audience-history-item/ul/li[1]")

        for item in list:
            assert item.text == 'Test Audience'
        project_page.project_menu_icon('Test Proj' + rand).click()
        project_page.project_delete_icon('Test Proj' + rand).click()
        project_page.AlertOkButton().click()
    def test_compare_trigger_disabled_single_audience(self):
        new_project_name = self.configAB["CreateProject"]["new_project_name"]
        data_env = self.configAB["CreateProject"]["data_env"]

        home_page = HomePage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        proj_page = ProjectPage(self.webdriver, self.config)

        home_page.searchProjects(new_project_name)
        string = my_random_string(3)
        new_project_name = new_project_name + string
        proj_page.createProject(new_project_name, data_env)
        sleep(10)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page.audience_name_textbox().send_keys('Test Audience')
        audience_page.add_dataSource('Purchase Behavior')
        self.webdriver.find_element_by_xpath(
            "//select[contains(@ng-model,'criteriaColumnSelector')]").click()
        self.webdriver.find_element_by_xpath(
            "//option[text()='Category']").click()
        self.webdriver.find_element_by_xpath(
            "//input[@placeholder='Begin typing to search...']").click()
        self.webdriver.find_element_by_xpath(
            "//li[contains(text(),'AIR FRESHENERS')]").click()
        criteria_createButton = self.webdriver.find_element_by_xpath(
            "//button[contains(@ng-click,'$ctrl.criteriaApply()') and (@class='red-btn')]"
        )
        self.webdriver.execute_script("arguments[0].click();",
                                      criteria_createButton)
        sleep(5)
        audience_page.save_audience_button().click()
        element = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.CSS_SELECTOR, ".compare-trigger")))
        trigger = element.get_attribute("class")

        self.assertEqual(trigger, "compare-trigger disabled",
                         "Compare trigger is not disabled")
        proj_page.deleteProject(new_project_name)
    def test_verify_agerange_starts_from_eighteen(self):
        project_name = self.configAB["CreateAudience"]["project_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name)

        proj_page = ProjectPage(self.webdriver, self.config)
        proj_page.add_audience_button().click()
        sleep(10)
        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.add_dataSource("Demographic Data")
        sleep(5)
        audience_page.filter_col_dropdown().click()
        audience_page.webdriver.find_element_by_xpath("//option[text()='Age']").click()
        age_range = self.webdriver.find_element_by_xpath("//div[@class='criteria-edit-label slider-value-label']").text
        self.assertEqual(age_range, "Between 18 and 100", "Age range incorrect for demographic data")
    def test_download_audiences(self):
        project_name = self.configAB["Aqfer"]["project_name"]
        path = os.path.join('testdata', 'sidebar.json')
        print("location:" + path)

        project_page = ProjectPage(self.webdriver, self.config)
        audience_page = AudiencePage(self.webdriver, self.config)
        home_page = HomePage(self.webdriver, self.config)

        with open(path) as file:
            data = json.load(file)
        for item in range(len(data)):
            link = data[item]["link"]
            # Project selection
            new_project_name = project_name + '_' + link + '_QA'
            print(new_project_name)
            sleep(5)
            home_page.searchProjects(new_project_name)
            sleep(10)
            num_aud_panel = len(
                self.webdriver.find_elements_by_xpath(
                    "//div[@class = 'audiences-section']//audience-panel"))
            print(num_aud_panel)
            for i in range(1, num_aud_panel + 1):
                audience_name = self.webdriver.find_element_by_xpath(
                    "(//div[@class = 'audience-title ng-binding'])[position()="
                    + str(i) + "]").click()
                # download_link    = self.webdriver.find_element_by_xpath("(//div[@class = 'audiences-section']//div[contains(@class,'download-button')])[position()= "+str(i)+"]")
                # download_link.click()
                # audience_menu_icon = self.webdriver.find_element_by_xpath("//div[text()='" + audience_name + "']//following::div[1]")
                self.webdriver.execute_script(
                    "arguments[0].click();",
                    project_page.audience_menu_icon(audience_name))
                self.webdriver.execute_script(
                    "arguments[0].click();",
                    project_page.audience_download_icon(audience_name))
                self.webdriver.execute_script(
                    "arguments[0].click();",
                    project_page.audience_data(audience_name))
    def test_copy_audience_single_criteria(self):
        section = self.__class__.__name__
        project_name = self.configAB[section]["project_name"]
        audience_name_single = self.configAB[section][
            "audience_name_single_source"]

        home_page = HomePage(self.webdriver, self.config)
        project_page = ProjectPage(self.webdriver, self.config)

        home_page.searchProjects(project_name)
        project_page.audience_menu_icon(audience_name_single).click()
        project_page.audienceEditIcon(audience_name_single)

        audience_page = AudiencePage(self.webdriver, self.config)
        audience_page.copy_audience_criteria_within_self("Demographic Data")
        self.webdriver.find_element_by_xpath(
            "//div[text()='Insert Copied Criteria']").click()
        audience_page.delete_audience_criteria("Demographic Data")
Ejemplo n.º 30
0
    def test_verify_activation_rate_on_copy_criteria(self):
        section = self.__class__.__name__
        project_name_act_rate = self.configAB["cpm_rate"][
            "project_name_act_rate"]
        source_audience_name = self.configAB["cpm_rate"][
            "source_audience_name"]

        home_page = HomePage(self.webdriver, self.config)
        home_page.searchProjects(project_name_act_rate)

        project_page = ProjectPage(self.webdriver, self.config)
        project_page.audience_menu_icon(source_audience_name).click()
        project_page.audienceEditIcon(source_audience_name)

        audience_page = AudiencePage(self.webdriver, self.config)

        activation_rate1 = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.XPATH, "//span[contains(@class,'cost')]"))).text
        audience_page.copy_audience_criteria_within_self("Location Data")
        self.webdriver.find_element_by_xpath(
            "//div[@class='sources-panel']/div[1]").click()

        #Opening criteria builder page
        project_page.AddAudienceButton().click()
        sleep(5)
        self.webdriver.find_element_by_xpath(
            "//div[text()='Insert Copied Criteria']").click()

        activation_rate2 = WebDriverWait(self.webdriver, 50).until(
            EC.visibility_of_element_located(
                (By.XPATH, "//span[contains(@class,'cost')]"))).text

        self.assertEqual(activation_rate1, activation_rate2,
                         'Activation rate differ after copy')
        audience_page.aud_back_arrow().click()