Esempio n. 1
0
def test_mobile_obj(mobile_os_name, mobile_os_version, device_name,
                    app_package, app_activity, remote_flag, device_flag,
                    testrail_flag, tesults_flag, test_run_id, app_name,
                    app_path):

    "Return an instance of Base Page that knows about the third party integrations"
    test_mobile_obj = PageFactory.get_page_object("Zero mobile")

    #Setup and register a driver
    test_mobile_obj.register_driver(mobile_os_name, mobile_os_version,
                                    device_name, app_package, app_activity,
                                    remote_flag, device_flag, app_name,
                                    app_path, ud_id, org_id, signing_id,
                                    no_reset_flag)

    #3. Setup TestRail reporting
    if testrail_flag.lower() == 'y':
        if test_run_id is None:
            test_mobile_obj.write(
                '\033[91m' +
                "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
                + '\033[0m')
            testrail_flag = 'N'
        if test_run_id is not None:
            test_mobile_obj.register_testrail()
            test_mobile_obj.set_test_run_id(test_run_id)

    if tesults_flag.lower() == 'y':
        test_mobile_obj.register_tesults()

    yield test_mobile_obj

    #Teardown
    test_mobile_obj.wait(3)
    test_mobile_obj.teardown()
def test_boilerplate(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1
        
        #Set start_time with current time
        start_time = int(time.time())	

        #This is the test object, you can change it to the desired page with relevance to the page factory
        test_obj = PageFactory.get_page_object("main page") 
        

        #13. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter        

    except Exception as e:
        print("Exception when trying to run test: %s"%__file__)
        print("Python says:%s"%str(e))
    
    assert expected_pass == actual_pass, "Test failed: %s"%__file__
Esempio n. 3
0
def test_android_net126Music():
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1
        #1. Create a test object.
        test_obj = PageFactory.get_page_object("net126Music mobile page")
        print(test_obj.app_conf["app_package"],
              test_obj.app_conf["app_activity"])
        test_mobile_obj.start_activity(test_obj.app_conf["app_package"],
                                       test_obj.app_conf["app_activity"])
        #2. Setup and register a driver
        time.sleep(15)  #app 启动较慢
        test_obj.click_netease_userAgreement()  #点击同意用户协议
        #test_obj.click_netease_trial() #点击试用
        #test_obj.click_netease_rand() #点击排行榜,网易云音乐排行榜地域限制歌曲较少,采用搜索指定歌曲
        assert test_obj.click_netease_netease_search()  #点击搜索
        assert test_obj.input_netease_search_text("起风了")  #输入搜索文本
        assert time.sleep(2)
        assert test_obj.click_netease_search_button()  #点击搜索
        assert test_obj.click_netease_netease_search_result1()  #点击搜索结果第一条
        assert test_obj.check_result_errror()  #检查地域限制
        time.sleep(1)
        actual_pass = 1
    except Exception as e:
        print("Exception when trying to run iqiyi test:%s" % __file__)
        print("Python says:%s" % str(e))
    path = test_obj.save_screenshot("result_net126Music")
    if actual_pass == 1:
        TEST_RESULT["net163_result"] = "success"
    else:
        TEST_RESULT["net163_result"] = "failed"
    TEST_RESULT["net163_img"] = path
Esempio n. 4
0
def test_android_xiamiMusic():
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1
        #1. Create a test object.
        test_obj = PageFactory.get_page_object("xiamiMusic mobile page")
        print(test_obj.app_conf["app_package"],
              test_obj.app_conf["app_activity"])
        test_mobile_obj.start_activity(test_obj.app_conf["app_package"],
                                       test_obj.app_conf["app_activity"])
        #2. Setup and register a driver
        time.sleep(9)  #app 启动较慢
        assert test_obj.click_xiamiMusic_search()  #点击搜索
        assert test_obj.input_xiamiMusic_search_text("吴亦凡 时间煮雨")  #输入搜索文本
        time.sleep(2)
        assert test_obj.click_xiamiMusic_search_button()  #点击搜索
        assert test_obj.click_xiamiMusic_WYFJG_2()  #点击搜索结果第一条
        assert test_obj.check_result_errror()  #检查地域限制
        time.sleep(1)
        actual_pass = 1
        test_obj.save_screenshot("result_xiamiMusic")
        test_obj.close_app()
    except Exception as e:
        print("Exception when trying to run iqiyi test:%s" % __file__)
        print("Python says:%s" % str(e))
    path = test_obj.save_screenshot("result_xiamiMusic")
    if actual_pass == 1:
        TEST_RESULT["xiamiMusic_result"] = "success"
    else:
        TEST_RESULT["xiamiMusic_result"] = "failed"
    TEST_RESULT["xiamiMusic_img"] = path
Esempio n. 5
0
def test_android_tudou():
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1
        #1. Create a test object.
        test_obj = PageFactory.get_page_object("tudouVideo mobile page")
        print(test_obj.app_conf["app_package"],
              test_obj.app_conf["app_activity"])
        test_mobile_obj.start_activity(test_obj.app_conf["app_package"],
                                       test_obj.app_conf["app_activity"])
        #2. Setup and register a driver
        time.sleep(9)  #app 启动较慢
        assert test_obj.click_search_begin()
        assert test_obj.input_search_text("斗罗大陆3")
        assert test_obj.click_search_button()
        assert test_obj.select_DLDL_series()
        test_obj.play_video(10)
        time.sleep(1)
        actual_pass = 1
    except Exception as e:
        print("Exception when trying to run iqiyi test:%s" % __file__)
        print("Python says:%s" % str(e))
    path = test_obj.save_screenshot("result_tudouVideo")
    if actual_pass == 1:
        TEST_RESULT["tudouVideo_result"] = "success"
    else:
        TEST_RESULT["tudouVideo_result"] = "failed"
    TEST_RESULT["tudouVideo_img"] = path
Esempio n. 6
0
def test_android_QQMusic():
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1
        #1. Create a test object.
        test_obj = PageFactory.get_page_object("qqMusic mobile page")
        print(test_obj.app_conf["app_package"],
              test_obj.app_conf["app_activity"])
        test_mobile_obj.start_activity(test_obj.app_conf["app_package"],
                                       test_obj.app_conf["app_activity"])
        #2. Setup and register a driver
        time.sleep(9)  #app 启动较慢
        test_obj.click_qqMusic_cancleLogin()
        assert test_obj.click_qqMusic_YYG()
        assert test_obj.click_qqMusic_rand()
        assert test_obj.click_qqMusic_soaringList()
        assert test_obj.check_qqMusic_soaringList()
        time.sleep(1)
        actual_pass = 1
    except Exception as e:
        print("Exception when trying to run iqiyi test:%s" % __file__)
        print("Python says:%s" % str(e))
    path = test_obj.save_screenshot("result_QQMusic")
    if actual_pass == 1:
        TEST_RESULT["qqMusic_result"] = "success"
    else:
        TEST_RESULT["qqMusic_result"] = "failed"
    TEST_RESULT["qqMusic_img"] = path
Esempio n. 7
0
def test_login_page(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object and fill the example form.
        test_obj = PageFactory.get_page_object("index page")
        #Set start_time with current time
        start_time = int(time.time())

        # Turn on the highlighting feature
        test_obj.turn_on_highlight()

        #Turn off the highlighting feature
        #test_obj.turn_off_highlight()

        # Accepting alert
        alert = driver.switch_to.alert
        print(alert.text)

        #13. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 8
0
def test_obj(base_url, browser, browser_version, os_version, os_name,
             remote_flag, testrail_flag, tesults_flag, test_run_id,
             remote_project_name, remote_build_name, testname):
    "Return an instance of Base Page that knows about the third party integrations"
    test_obj = PageFactory.get_page_object("Zero", base_url=base_url)
    test_obj.set_calling_module(testname)
    #Setup and register a driver
    test_obj.register_driver(remote_flag, os_name, os_version, browser,
                             browser_version, remote_project_name,
                             remote_build_name)

    #Setup TestRail reporting
    if testrail_flag.lower() == 'y':
        if test_run_id is None:
            test_obj.write(
                '\033[91m' +
                "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
                + '\033[0m')
            testrail_flag = 'N'
        if test_run_id is not None:
            test_obj.register_testrail()
            test_obj.set_test_run_id(test_run_id)

    if tesults_flag.lower() == 'y':
        test_obj.register_tesults()

    yield test_obj

    #Teardown
    test_obj.wait(3)
    test_obj.teardown()
def test_example_table(base_url, browser, browser_version, os_version, os_name,
                       remote_flag, testrail_flag, test_run_id):
    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a example table page object
        test_obj = PageFactory.get_page_object("Main Page", base_url=base_url)

        #2. Setup and register a driver
        start_time = int(time.time())  #Set start_time with current time
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version)

        #3. Setup TestRail reporting
        if testrail_flag.lower() == 'y':
            if test_run_id is None:
                test_obj.write(
                    '\033[91m' +
                    "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
                    + '\033[0m')
                testrail_flag = 'N'
            if test_run_id is not None:
                test_obj.register_testrail()

        #4. Get the test details from the conf file
        name = conf.name

        #5. Print out table text neatly
        test_obj.print_table_text()

        #6. Check if a name is present in the table
        result_flag = test_obj.check_name_present(name)
        test_obj.log_result(
            result_flag,
            positive="Located the name %s in the table" % name,
            negative=
            "The name %s is not present under name column on the Page with url: %s"
            % (name, test_obj.get_current_url()))
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #Update TestRail
        case_id = testrail_file.test_example_table
        test_obj.report_to_testrail(case_id, test_run_id, result_flag)

        #7. Print out the result
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception, e:
        print "Exception when trying to run test: %s" % __file__
        print "Python says:%s" % str(e)
def test_example_table(base_url, browser, browser_version, os_version, os_name,
                       browserstack_flag, testrail_flag, test_run_id):
    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a example table page object
        test_obj = PageFactory.get_page_object("Main Page", base_url=base_url)

        #2. Setup and register a driver
        start_time = int(time.time())  #Set start_time with current time
        test_obj.register_driver(browserstack_flag, os_name, os_version,
                                 browser, browser_version)

        #3. Setup TestRail reporting
        if testrail_flag.lower() == 'y':
            if test_run_id is None:
                default_test_run_file = os.path.abspath(
                    os.path.join(os.path.dirname(__file__), '..', 'conf',
                                 'latest_test_run.txt'))
                test_run_id = Conf_Reader.get_value(default_test_run_file,
                                                    'TEST_RUN_ID')
            if test_run_id is not None:
                test_obj.register_testrail()

        #4. Get the test details from the conf file
        name = conf.name

        #5. Print out table text neatly
        test_obj.print_table_text()

        #6. Check if a name is present in the table
        result_flag = test_obj.check_name_present(name)
        test_obj.log_result(
            result_flag,
            positive="Located the name %s in the table" % name,
            negative=
            "The name %s is not present under name column on the Page with url: %s"
            % (name, test_obj.get_current_url()))
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #Update TestRail
        case_id = testrail_file.test_example_table
        test_obj.report_to_testrail(case_id, test_run_id, result_flag)

        #7. Print out the result
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception, e:
        print "Exception when trying to run test: %s" % __file__
        print "Python says:%s" % str(e)
def test_mobile_bitcoin_price(test_mobile_obj):
    "Run the test."
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object.
        test_obj = PageFactory.get_page_object("bitcoin main page")

        #2. Setup and register a driver
        start_time = int(time.time())

        #3. Get expected bitcoin price page header name
        expected_bitcoin_price_page_heading = conf.expected_bitcoin_price_page_heading

        #4. Click on real time price page button and verify the price page header name.
        result_flag = test_obj.click_on_real_time_price_button(
            expected_bitcoin_price_page_heading)
        test_obj.log_result(
            result_flag,
            positive="Successfully visited the bitcoin real time price page.",
            negative="Failed to visit the bitcoin real time price page.")
        #Update TestRail
        case_id = testrail_file.test_bitcoin_price_page_header
        test_obj.report_to_testrail(case_id, test_mobile_obj.test_run_id,
                                    result_flag)
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #5. Verify bitcoin real time price is displayed.
        if result_flag is True:
            result_flag = test_obj.get_bitcoin_real_time_price()
        test_obj.log_result(
            result_flag,
            positive="Successfully got the bitcoin real time price in usd.",
            negative="Failed to get the bitcoin real time price in usd.")
        #Update TestRail
        case_id = testrail_file.test_bitcoin_real_time_price
        test_obj.report_to_testrail(case_id, test_mobile_obj.test_run_id,
                                    result_flag)
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #6. Print out the results.
        test_obj.write_test_summary()

        #7. Teardown and Assertion.
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test:%s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 12
0
def test_mobile_bitcoin_price(mobile_os_name, mobile_os_version, device_name,
                              app_package, app_activity, remote_flag,
                              device_flag):
    "Run the test."
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object.
        test_obj = PageFactory.get_page_object("bitcoin main page")

        #2. Setup and register a driver
        start_time = int(time.time())
        test_obj.register_mobile_driver(mobile_os_name, mobile_os_version,
                                        device_name, app_package, app_activity,
                                        remote_flag, device_flag)

        #3. Get value of expected page heading.
        expected_bitcoin_price_page_heading = conf.expected_bitcoin_price_page_heading

        #4. Click on real time price page button and verify the price page heading.
        result_flag = test_obj.click_on_real_time_price_button(
            expected_bitcoin_price_page_heading)
        test_obj.log_result(
            result_flag,
            positive="Successfully visited the bitcoin real time price page.",
            negative="Failed to visit the bitcoin real time price page.")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #5. Verify bitcoin real time price is displayed.
        #Notice you don't need to create a new page object!
        if result_flag is True:
            result_flag = test_obj.get_bitcoin_real_time_price()
        test_obj.log_result(
            result_flag,
            positive="Successfully got the bitcoin real time price in usd.",
            negative="Failed to get the bitcoin real time price in usd.")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #6. Print out the results.
        test_obj.write_test_summary()

        #7. Teardown and Assertion.
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception, e:
        print "Exception when trying to run test:%s" % __file__
        print "Python says:%s" % str(e)
def test_example_table(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a example table page object
        test_obj = PageFactory.get_page_object("Main Page")

        #Set start_time with current time
        start_time = int(time.time())

        #2. Get the test details from the conf file
        name = conf.name

        #3. Print out table text neatly
        result_flag = test_obj.print_table_text()
        test_obj.log_result(result_flag,
                            positive="Completed printing table text",
                            negative="Unable to print the table text")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #4. Check if a name is present in the table
        result_flag = test_obj.check_name_present(name)
        test_obj.log_result(
            result_flag,
            positive="Located the name %s in the table" % name,
            negative=
            "The name %s is not present under name column on the Page with url: %s"
            % (name, test_obj.get_current_url()))
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #Update TestRail
        case_id = testrail_file.test_example_table
        test_obj.report_to_testrail(case_id, test_obj.test_run_id, result_flag)
        test_obj.add_tesults_case(
            "Example table",
            "Verify if a certain name is present in the table",
            "test_example_table", result_flag,
            "\nFailed to Verify if a certain name is present in the table\n")

        #5. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 14
0
def test_altoro_mutual_form(test_obj):
    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object and fill the example form.
        test_obj = PageFactory.get_page_object("Main_Page")

        #2. Setup and register a driver
        start_time = int(time.time())

        #3. Turn on the highlighting feature
        test_obj.turn_on_highlight()

        #4. Access Login page
        result_flag = test_obj.access_login_page()
        test_obj.log_result(result_flag,positive="Login Page accessed\n",negative="Login Page not accessible")
        
        #5. Login into application
        username=credentials.username
        password=credentials.password
        result_flag = test_obj.login(username, password)
        test_obj.log_result(result_flag,positive="Login successful\n",negative="\nLogin not successful\n")

        #6. Verify you are on the Bank Main Page
        result_flag = test_obj.verify_bank_main_page()
        test_obj.log_result(result_flag,positive="You are on Bank page\n",negative="\nBank page not accessible\n")

        #7. Access Transfer Fund link
        result_flag = test_obj.access_transfer_fund()
        test_obj.log_result(result_flag,positive="Transfer fund accessible\n",negative="\n Transfer fund not accessible")
        
        #8. Transfer funds
        amount = account.amount
        result_flag = test_obj.transfer_fund(amount)
        test_obj.log_result(result_flag, positive="Amount transfered successfully\n", negative="\n Amount not transfered successfully\n")

        #9. View Account summary
        result_flag = test_obj.view_account_summary()
        test_obj.log_result(result_flag, positive="Account view summary shown\n", negative="\n Account view summary not shown\n")

        #10. waiting for pass counters
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

            
    except Exception as e:
        print("Exception when trying to run test:%s"%__file__)
        print("Python says:%s"%str(e))

    assert expected_pass == actual_pass, "Test failed: %s"%__file__
Esempio n. 15
0
def test_tecent_video(test_obj):

    "Run the test"
    try:
        #1. Create a example table page object
        test_obj = PageFactory.get_page_object("iqiyi page",
                                               base_url="https://v.qq.com/")

        #Set start_time with current time
        start_time = int(time.time())

        # Turn on the highlighting feature
        test_obj.turn_on_highlight()

        #4. Get the test details from the conf file
        iqiyi_video_url = "/x/cover/m441e3rjq9kwpsc/m00253deqqo.html"

        #5. 打开视频加载三十秒
        result_flag = test_obj.play_video(iqiyi_video_url, 30)
        #result_flag = test_obj.set_name(name)
        test_obj.log_result(result_flag,
                            positive="打开腾讯视频成功",
                            negative="打开腾讯视频失败")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #6.等待视频广告加载结束
        result_flag = test_obj.wait_video_ad(
            '斗罗大陆',
            'xpath,//*[@id="container_player"]/div/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/h2/a'
        )
        #result_flag = test_obj.set_name(name)
        test_obj.log_result(result_flag, positive="广告播放成功", negative="广告播放失败")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #7.播放视频五分钟检查是否代理成功
        result_flag = test_obj.check_copyright(
            "很抱歉,由于版权限制,您所在的地区暂时无法播放该视频",
            'xpath,//*[@id="txplayer_81b70aeb1244e5d19469394d732b5167"]/txpdiv[11]/txpdiv[1]/span[1]'
        )
        test_obj.save_screenshot("tecentVideo_result")
        test_obj.log_result(result_flag,
                            positive="播放成功,无版权限制",
                            negative="播放失败,版权限制")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #Turn off the highlighting feature
        test_obj.turn_off_highlight()

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
def test_acclerate_PCBrowser(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object and fill the example form.
        test_obj = PageFactory.get_page_object(
            "iqiyi page", base_url="https://www.iqiyi.com/")
        #Set start_time with current time
        start_time = int(time.time())

        # Turn on the highlighting feature
        test_obj.turn_on_highlight()

        #4. Get the test details from the conf file
        iqiyi_video_url = conf.aiqiyi_video_url

        #5. 打开视频加载三十秒
        result_flag = test_obj.play_video(iqiyi_video_url, 30)
        #result_flag = test_obj.set_name(name)
        test_obj.log_result(result_flag,
                            positive="打开爱奇艺视频成功",
                            negative="打开爱奇艺视频失败")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #6.等待视频广告加载结束
        result_flag = test_obj.wait_ad("免费跳过广告", "庆余年", 120)
        #result_flag = test_obj.set_name(name)
        test_obj.log_result(result_flag, positive="跳过广告成功", negative="跳过广告失败")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #7.播放视频五分钟检查是否代理成功
        result_flag = test_obj.check_copyright("由于版权限制,您所在的地区无法观看该视频")
        test_obj.save_screenshot("iqiyi_result")
        test_obj.log_result(result_flag,
                            positive="播放成功,无版权限制",
                            negative="播放失败,版权限制")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))
        #Turn off the highlighting feature
        test_obj.turn_off_highlight()
        expected_pass = 1
        actual_pass = 1

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 17
0
def test_discover_music(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #Set start_time with current time
        start_time = int(time.time())

        test_obj = PageFactory.get_page_object("gnod")

        #Get the musician's names from conf file
        musician1 = conf.musician1
        musician2 = conf.musician2
        musician3 = conf.musician3

        #Get to the discover music page
        result_flag = test_obj.discover_music_menu()

        test_obj.log_result(
            result_flag,
            positive='Successfully landed on discover music page',
            negative='could not access the discover music page')

        #fill out the form in discover music page and hit the submit button
        result_flag = test_obj.fill_out_form(musician1, musician2, musician3)

        test_obj.log_result(result_flag,
                            positive='Successfully submitted the form',
                            negative='could not submit the form')

        #check if all the response buttons work correctly
        result_flag = test_obj.respond_to_result()

        test_obj.log_result(result_flag,
                            positive='All the response buttons worked fine',
                            negative='The response buttons did not work')

        #13. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 18
0
def test_obj(base_url, browser, browser_version, os_version, os_name,
             remote_flag, testrail_flag, tesults_flag, test_run_id,
             remote_project_name, remote_build_name, testname,
             reportportal_service, interactivemode_flag):
    "Return an instance of Base Page that knows about the third party integrations"
    try:

        if interactivemode_flag.lower() == "y":
            default_flag = interactive_mode.set_default_flag_gui(
                browser, browser_version, os_version, os_name, remote_flag,
                testrail_flag, tesults_flag)
            if default_flag == False:
                browser, browser_version, remote_flag, os_name, os_version, testrail_flag, tesults_flag = interactive_mode.ask_questions_gui(
                    browser, browser_version, os_version, os_name, remote_flag,
                    testrail_flag, tesults_flag)

        test_obj = PageFactory.get_page_object("Zero", base_url=base_url)
        test_obj.set_calling_module(testname)
        #Setup and register a driver
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version, remote_project_name,
                                 remote_build_name)

        #Setup TestRail reporting
        if testrail_flag.lower() == 'y':
            if test_run_id is None:
                test_obj.write(
                    '\033[91m' +
                    "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
                    + '\033[0m')
                testrail_flag = 'N'
            if test_run_id is not None:
                test_obj.register_testrail()
                test_obj.set_test_run_id(test_run_id)

        if tesults_flag.lower() == 'y':
            test_obj.register_tesults()

        if reportportal_service:
            test_obj.set_rp_logger(reportportal_service)

        yield test_obj
        #Teardown
        test_obj.wait(3)
        test_obj.teardown()

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))
def test_redBus_ticket_booking(test_obj):


    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1
        
        #1. Create a test object and fill the example form.
        test_obj = PageFactory.get_page_object("redBus Main Page")
        #Set start_time with current time
        start_time = int(time.time())	

        # Turn on the highlighting feature
        test_obj.turn_on_highlight()
                
        #4. Get the test details from the conf file
        source = booking_conf.source
        destination = booking_conf.destination
        onward_date = booking_conf.onward_date
        return_date = booking_conf.return_date
        
        #6. Set and submit the search buses form 
        result_flag = test_obj.submit_form(source,destination,onward_date,return_date)
        test_obj.log_result(result_flag,
                            positive="Successfully submitted the form\n",
                            negative="Failed to submit the form \nOn url: %s"%test_obj.get_current_url(),
                            level="critical")

        #7. Check the source and destination locations on the redirect page
        if result_flag is True:
            result_flag = test_obj.check_source_and_destination(source,destination)
        test_obj.log_result(result_flag,
                            positive="Source and destination locations found on the redirect page!!\n",
                            negative="Fail: Source and destination locations mismatch on the redirect page!")
        test_obj.write('Script duration: %d seconds\n'%(int(time.time()-start_time)))
        
        #<tbd>. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter        

    except Exception as e:
        print("Exception when trying to run test: %s"%__file__)
        print("Python says:%s"%str(e))
    
    assert expected_pass == actual_pass, "Test failed: %s"%__file__
def test_add_all_items_to_cart_and_checkout(base_url, browser, browser_version,
                                            os_version, os_name, remote_flag,
                                            testrail_flag, tesults_flag,
                                            test_run_id, remote_project_name,
                                            remote_build_name):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object
        test_obj = PageFactory.get_page_object("Main Page", base_url=base_url)

        #2. Setup and register a driver and Set start_time with current time
        start_time = int(time.time())
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version, remote_project_name,
                                 remote_build_name)

        #3. Check the temperature and based on the temperature click on buy button of moiturizer or sunscreen
        result_flag = test_obj.check_temp_and_click_product_category()
        test_obj.log_result(result_flag,
                            positive="Successfully clicked on right button\n",
                            negative="Failed to click right button\nOn")

        #4. Add all items to the cart and checkout with payment
        result_flag = test_obj.add_all_items_and_verify_cart()
        test_obj.log_result(
            result_flag,
            positive="All items added successfully to the cart\n",
            negative="Failed to add all items to the cart\nOn")

        #6. Print out the results
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception as e:
        print("Exception when trying to run test:%s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 21
0
def test_movie_map(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #Set start_time with current time
        start_time = int(time.time())

        test_obj = PageFactory.get_page_object("gnod")

        #Get name of the movie from conf file
        movie_name = conf.movie_name

        #Get to the movie map page
        result_flag = test_obj.movie_map()

        test_obj.log_result(result_flag,
                            positive='Successfully landed on movie map page',
                            negative='could not access the movie map page')

        #enter movie to search for in movie map page and hit the search button
        result_flag = test_obj.search_movie_map(movie_name)

        test_obj.log_result(result_flag,
                            positive='Successfully submitted the search query',
                            negative='could not submit the search query')

        #select the nearest movie from the selected movie
        result_flag = test_obj.select_nearest_movie()

        test_obj.log_result(result_flag,
                            positive='Successfully selected the nearest movie',
                            negative='Failed to select the nearest movie')

        #13. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
Esempio n. 22
0
def test_product_chart(test_obj):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #Set start_time with current time
        start_time = int(time.time())

        test_obj = PageFactory.get_page_object("gnod")

        #enter smartphone category of the product chart
        result_flag = test_obj.productchart_smartphone()
        test_obj.log_result(
            result_flag,
            positive=
            'Successfully landed on smartphone category of the product_chart',
            negative='could not access the product chart')

        #set the filter based on brand
        result_flag = test_obj.filter_product_brand()
        test_obj.log_result(
            result_flag,
            positive='Smart phone were successfully filtered based on brand',
            negative='could not filter the smartphones based on brand')

        #set the filter based on os
        result_flag = test_obj.filter_product_os()
        test_obj.log_result(
            result_flag,
            positive='Smart phone were successfully filtered based on os',
            negative='could not filter the smartphones based on os')

        #13. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
def test_add_all_moiturizers_to_cart(base_url, browser, browser_version,
                                     os_version, os_name, remote_flag,
                                     testrail_flag, tesults_flag, test_run_id,
                                     remote_project_name, remote_build_name):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object
        test_obj = PageFactory.get_page_object("Moisturizers",
                                               base_url=base_url)

        #2. Setup and register a driver
        start_time = int(time.time())  #Set start_time with current time
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version, remote_project_name,
                                 remote_build_name)

        #3. Add all moisturizers to the cart
        result_flag = test_obj.add_all_moisturizers_verify_cart()
        test_obj.log_result(
            result_flag,
            positive="All moisturizer added successfully to the cart\n",
            negative="Failed to add all moisturizer to the cart\nOn")

        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #4. Print out the results
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception as e:
        print("Exception when trying to run test:%s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
def test_most_expensive_sunscreen(base_url, browser, browser_version,
                                  os_version, os_name, remote_flag,
                                  testrail_flag, tesults_flag, test_run_id,
                                  remote_project_name, remote_build_name):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object and fill the example form.
        test_obj = PageFactory.get_page_object("Sunscreens")

        #2. Setup and register a driver
        start_time = int(time.time())  #Set start_time with current time
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version, remote_project_name,
                                 remote_build_name)

        #3.Select the most expensive sunscreen and click on cart and redirect to cart
        result_flag = test_obj.select_expensive_sunscreen()
        test_obj.log_result(
            result_flag,
            positive="Selected the most expensive sunscreen\n",
            negative="Failed to select most expensive sunscreen\nOn")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #4. Print out the results
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception as e:
        print("Exception when trying to run test:%s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
def test_select_2_least_expensive_sunscreens(base_url,browser,browser_version,os_version,os_name,remote_flag,testrail_flag,tesults_flag,test_run_id,remote_project_name,remote_build_name):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object and load the sunscreens page.
        test_obj = PageFactory.get_page_object("Sunscreens",base_url=base_url)

        #2. Setup and register a driver and start the timer
        start_time = (time.time())
        test_obj.register_driver(remote_flag,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name)
               
        #3. Select least expensive sunscreens, one each from SPF-50 and SPF-30
        result_flag = test_obj.select_2_least_expensive_sunscreens() 
        test_obj.log_result(result_flag,
                            positive="Selected 2 least expensive sunscreens\n",
                            negative="Failed to select 2 least expensive sunscreens\nOn")
        
        test_obj.write('Script duration: %d seconds\n'%((time.time()-start_time)))
                
        #4. Print out the results
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()
        
    except Exception as e:
        print("Exception when trying to run test:%s"%__file__)
        print("Python says:%s"%str(e))

    assert expected_pass == actual_pass, "Test failed: %s"%__file__
    except Exception as e:
        print("Exception when trying to run test: %s"%__file__)
        print("Python says:%s"%str(e))
    
    assert expected_pass == actual_pass, "Test failed: %s"%__file__

    
#---START OF SCRIPT   
if __name__=='__main__':
    print("Start of %s"%__file__)
    #Creating an instance of the class
    options_obj = Option_Parser()
    options = options_obj.get_options()
                
    #Run the test only if the options provided are valid
    if options_obj.check_options(options): 
        test_obj = PageFactory.get_page_object("Zero",base_url=options.url)

        #Setup and register a driver
        test_obj.register_driver(options.remote_flag,options.os_name,options.os_version,options.browser,options.browser_version,options.remote_project_name,options.remote_build_name)


        test_boilerplate(test_obj)
                
        #teardowm
        test_obj.wait(3)
        test_obj.teardown() 
    else:
        print('ERROR: Received incorrect comand line input arguments')
        print(option_obj.print_usage())
def test_mobile_bitcoin_price(mobile_os_name, mobile_os_version, device_name,
                              app_package, app_activity, remote_flag,
                              device_flag, testrail_flag, tesults_flag,
                              test_run_id, app_name):
    "Run the test."
    try:
        # Initalize flags for tests summary.
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object.
        test_obj = PageFactory.get_page_object("bitcoin main page")

        #2. Setup and register a driver
        start_time = int(time.time())
        test_obj.register_driver(mobile_os_name, mobile_os_version,
                                 device_name, app_package, app_activity,
                                 remote_flag, device_flag, app_name)

        #3. Setup TestRail reporting
        if testrail_flag.lower() == 'y':
            if test_run_id is None:
                test_obj.write(
                    '\033[91m' +
                    "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
                    + '\033[0m')
                testrail_flag = 'N'
            if test_run_id is not None:
                test_obj.register_testrail()

        if tesults_flag.lower() == 'y':
            test_obj.register_tesults()

        #4. Get expected bitcoin price page header name
        expected_bitcoin_price_page_heading = conf.expected_bitcoin_price_page_heading

        #5. Click on real time price page button and verify the price page header name.
        result_flag = test_obj.click_on_real_time_price_button(
            expected_bitcoin_price_page_heading)
        test_obj.log_result(
            result_flag,
            positive="Successfully visited the bitcoin real time price page.",
            negative="Failed to visit the bitcoin real time price page.")
        #Update TestRail
        case_id = testrail_file.test_bitcoin_price_page_header
        test_obj.report_to_testrail(case_id, test_run_id, result_flag)
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #6. Verify bitcoin real time price is displayed.
        if result_flag is True:
            result_flag = test_obj.get_bitcoin_real_time_price()
        test_obj.log_result(
            result_flag,
            positive="Successfully got the bitcoin real time price in usd.",
            negative="Failed to get the bitcoin real time price in usd.")
        #Update TestRail
        case_id = testrail_file.test_bitcoin_real_time_price
        test_obj.report_to_testrail(case_id, test_run_id, result_flag)
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #7. Print out the results.
        test_obj.write_test_summary()

        #8. Teardown and Assertion.
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception, e:
        print "Exception when trying to run test:%s" % __file__
        print "Python says:%s" % str(e)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__


# ---START OF SCRIPT

if __name__ == '__main__':
    print("Start of %s" % __file__)
    # Creating an instance of the class.
    options_obj = Option_Parser()
    options = options_obj.get_options()

    # Run  the test only if the options provided are valid.
    if options_obj.check_options(options):
        test_mobile_obj = PageFactory.get_page_object("Zero mobile")

        #Setup and register a driver
        test_mobile_obj.register_driver(
            options.mobile_os_name, options.mobile_os_version,
            options.device_name, options.app_package, options.app_activity,
            options.remote_flag, options.device_flag, options.app_name,
            options.app_path, options.ud_id, options.org_id,
            options.signing_id, options.no_reset_flag)

        #Setup TestRail reporting
        if options.testrail_flag.lower() == 'y':
            if options.test_run_id is None:
                test_mobile_obj.write(
                    '\033[91m' +
                    "\n\nTestRail Integration Exception: It looks like you are trying to use TestRail Integration without providing test run id. \nPlease provide a valid test run id along with test run command using -R flag and try again. for eg: pytest -X Y -R 100\n"
Esempio n. 29
0
def test_dunzo_superhero(test_obj):
    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #Set start_time with current time
        start_time = int(time.time())

        #1. Create a test object.
        test_obj = PageFactory.get_page_object("dunzo main page")

        #2. Validate logo is present
        result_flag = test_obj.check_home_page_logo_present()
        test_obj.log_result(
            result_flag,
            positive="Dunzo Logo is present in home page\n",
            negative="Failed to load Dunzo Logo on home page \nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #3. Validate all home page web elements
        result_flag = test_obj.check_home_page_elements()
        test_obj.log_result(
            result_flag,
            positive="Checked all home page elements\n",
            negative="Failed to check all home page elements\nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #4. Validates home page footer section
        result_flag = test_obj.check_home_page_footer_div()
        test_obj.log_result(
            result_flag,
            positive="checked home page footer_division\n",
            negative="Failed to load home page footer_division\nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #5. Clicks on Dunzo Partner button
        result_flag = test_obj.click_partners()
        test_obj.log_result(
            result_flag,
            positive="Successfully clicked on Dunzo for Partners button\n",
            negative="\nFailed to click on Dunzo for Partners button \n")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #6. Checks whether redirected to partner page
        result_flag = test_obj.check_redirect_to_partner_page()
        test_obj.log_result(
            result_flag,
            positive="Successfully redirected to partner page\n",
            negative="\nFailed to redirect to partner page \n")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #7. Validate logo is present in Partner page
        result_flag = test_obj.check_redirect_logo()
        test_obj.log_result(
            result_flag,
            positive="Dunzo Logo is present in partner page\n",
            negative="Failed to load Dunzo Logo on partner page \nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #8. Checks whether all elemensts are present in partner page
        result_flag = test_obj.check_partner_page_elements()
        test_obj.log_result(
            result_flag,
            positive="Checked all partner page elements\n",
            negative="Failed to check all partner page elements\nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #9. Validates partner page footer section and redirectes to home page
        result_flag = test_obj.check_redirect_page_footer_div()
        test_obj.log_result(
            result_flag,
            positive="checked partner page footer_division\n",
            negative="Failed to load partner page footer_division\nOn url: %s"
            % test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #10. Clicks on Dunzo Business button
        result_flag = test_obj.click_business()
        test_obj.log_result(
            result_flag,
            positive="Successfully clicked on Dunzo for Business button\n",
            negative="\nFailed to click on Dunzo for Business button \n")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #11. Checks whether redirected to business page
        result_flag = test_obj.check_redirect_to_business_page()
        test_obj.log_result(
            result_flag,
            positive="Successfully redirected to business page\n",
            negative="\nFailed to redirect to business page \n")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #12. Validate logo is present in Business page
        result_flag = test_obj.check_redirect_logo()
        test_obj.log_result(
            result_flag,
            positive="Dunzo Logo is present in business page\n",
            negative="Failed to load Dunzo Logo on business page \nOn url: %s"
            % test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #13. Checks whether all elemensts are present in business page
        result_flag = test_obj.check_business_page_elements()
        test_obj.log_result(
            result_flag,
            positive="Checked all elements in business page\n",
            negative="Failed to check all business page elements\nOn url: %s" %
            test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #14. Validates business page footer section and redirectes to home page
        result_flag = test_obj.check_redirect_page_footer_div()
        test_obj.log_result(
            result_flag,
            positive="Business page footer division is present\n",
            negative="Failed to load Business page footer_division\nOn url: %s"
            % test_obj.get_current_url(),
            level="critical")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #15. Print out the result
        test_obj.write_test_summary()
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__
def test_temperature_form(base_url, browser, browser_version, os_version,
                          os_name, remote_flag, remote_project_name,
                          remote_build_name):

    "Run the test"
    try:
        #Initalize flags for tests summary
        expected_pass = 0
        actual_pass = -1

        #1. Create a test object
        test_obj = PageFactory.get_page_object("Main Page", base_url=base_url)

        #2. Setup and register a driver
        start_time = int(time.time())  #Set start_time with current time
        test_obj.register_driver(remote_flag, os_name, os_version, browser,
                                 browser_version, remote_project_name,
                                 remote_build_name)

        #3. get the current temperature
        result_flag = test_obj.process_temperature()
        test_obj.log_result(result_flag,
                            positive="Successfully read the temperature",
                            negative="Failed to read the temperature")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #4. Check the heading of the redirected page
        if result_flag is True:
            result_flag = test_obj.check_heading()
        test_obj.log_result(
            result_flag,
            positive="Heading on the redirect page checks out!\n",
            negative="Fail: Heading on the redirect page is incorrect!")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #5. Get the product category from the conf
        product_moisturizers_category = conf.product_moisturizers_category
        product_sunscreens_category = conf.product_sunscreens_category

        #6. Select the product type
        result_flag = test_obj.select_product_type(
            product_moisturizers_category, product_sunscreens_category)
        test_obj.log_result(result_flag,
                            positive="Selected the products\n",
                            negative="Not able to select the products")
        test_obj.write('Script duration: %d seconds\n' %
                       (int(time.time() - start_time)))

        #7. Print out the results
        test_obj.write_test_summary()

        #Teardown
        test_obj.wait(3)
        expected_pass = test_obj.result_counter
        actual_pass = test_obj.pass_counter
        test_obj.teardown()

    except Exception as e:
        print("Exception when trying to run test:%s" % __file__)
        print("Python says:%s" % str(e))

    assert expected_pass == actual_pass, "Test failed: %s" % __file__