Exemplo n.º 1
0
def run_search_inbox_test(browser, conf, base_url, sauce_flag, browser_version,
                          platform, testrail_run_id):
    "Login to Gmail using the page object model"
    # get the test account credentials from the .credentials file
    credentials_file = os.path.join(os.path.dirname(__file__),
                                    'login.credentials')
    username = Conf_Reader.get_value(credentials_file, 'LOGIN_USER')
    password = Conf_Reader.get_value(credentials_file, 'LOGIN_PASSWORD')

    #Result flag used by TestRail
    result_flag = False

    #Setup a driver
    #create object of driver factory
    driver_obj = DriverFactory()
    driver = driver_obj.get_web_driver(browser, sauce_flag, browser_version,
                                       platform)
    driver.maximize_window()

    #Create a login page object
    login_obj = PageFactory.get_page_object("login", driver)
    if (login_obj.login(username, password)):
        msg = "Login was successful"
        result_flag = True
        login_obj.write(msg)
    else:
        msg = "Login failed"
        login_obj.write(msg)

    #Create an object for main page with header and menu
    main_obj = PageFactory.get_page_object("main", driver)
    main_obj.wait(3)

    #Search the inbox for message by subject 'POM' and open the message
    if main_obj.header_obj.search_by_subject('POM'):
        main_obj.write("Search successful")
        result_flag = True
    else:
        main_obj.write("Search text was not found")
        result_flag = False

    #Go to inbox
    main_obj.menu_obj.select_menu_item('inbox')

    #Update TestRail
    if testrail_run_id is not None:
        login_obj.write('About to update TestRail')
        case_id = 67
        Test_Rail.update_testrail(case_id,
                                  testrail_run_id,
                                  result_flag,
                                  msg=msg)

    main_obj.teardown()
Exemplo n.º 2
0
def run_search_inbox_test(browser, conf, base_url, sauce_flag, browser_version, platform, testrail_run_id):
    "Login to Gmail using the page object model"
    # get the test account credentials from the .credentials file
    credentials_file = os.path.join(os.path.dirname(__file__), "login.credentials")
    username = Conf_Reader.get_value(credentials_file, "LOGIN_USER")
    password = Conf_Reader.get_value(credentials_file, "LOGIN_PASSWORD")

    # Result flag used by TestRail
    result_flag = False

    # Setup a driver
    # create object of driver factory
    driver_obj = DriverFactory()
    driver = driver_obj.get_web_driver(browser, sauce_flag, browser_version, platform)
    driver.maximize_window()

    # Create a login page object
    login_obj = PageFactory.get_page_object("login", driver)
    if login_obj.login(username, password):
        msg = "Login was successful"
        result_flag = True
        login_obj.write(msg)
    else:
        msg = "Login failed"
        login_obj.write(msg)

    # Create an object for main page with header and menu
    main_obj = PageFactory.get_page_object("main", driver)
    main_obj.wait(3)

    # Search the inbox for message by subject 'POM' and open the message
    if main_obj.header_obj.search_by_subject("POM"):
        main_obj.write("Search successful")
        result_flag = True
    else:
        main_obj.write("Search text was not found")
        result_flag = False

    # Go to inbox
    main_obj.menu_obj.select_menu_item("inbox")

    # Update TestRail
    if testrail_run_id is not None:
        login_obj.write("About to update TestRail")
        case_id = 67
        Test_Rail.update_testrail(case_id, testrail_run_id, result_flag, msg=msg)

    main_obj.teardown()
Exemplo n.º 3
0
def run_demo_test(browser,conf,tconf,base_url,test_run_id=None,sauce_flag=None,browser_version=None,platform=None):
    "Demo Test Run"
       
    #Setup a driver
    driver_obj = DriverFactory()
    driver = driver_obj.get_web_driver(browser,sauce_flag,browser_version,platform)
    driver.implicitly_wait(10) # Some elements are taking long to load
    driver.maximize_window()

    #Result flag which will check if testrail.conf is present
    tconf_flag = check_file_exists(tconf)

    #Result flag used by TestRail
    result_flag = False
    
    #1. Create a home page object and choose Market
    #Create a login page object
    home_obj = PageFactory.get_page_object("home",driver)
    city_name = Conf_Reader.get_value(conf,'CITY_NAME')
    result_flag = home_obj.choose_market(city_name)
    if (result_flag):
        msg = "Market was set to %s"%city_name
    else:
        msg = "Could not set market to  %s"%city_name
    home_obj.write(msg)
    
    #Update TestRail
    #Get the case id from tesrail.conf file
    if tconf_flag:
        case_id = Conf_Reader.get_value(tconf,'CHOOSE_MARKET')
        Test_Rail.update_testrail(case_id,test_run_id,result_flag,msg=msg)


    #2. Filter by size on office space page
    #Create project space page object
    office_space_obj = PageFactory.get_page_object("office-space",driver)
    min_sqft = Conf_Reader.get_value(conf,'MIN_SQFT')
    max_sqft = Conf_Reader.get_value(conf,'MAX_SQFT')
    expected_result =Conf_Reader.get_value(conf,'EXPECTED_RESULT_FOR_SIZE')
    result_flag = office_space_obj.filter_by_size(min_sqft,max_sqft,expected_result)
    if (result_flag):
        msg = "Search results for filter by size matched the expected result of %s space(s)"%expected_result
    else:
        msg = "Actual result did not match the expected result %s space"%expected_result
    office_space_obj.write(msg)
    
    #Update TestRail
    #Get the case id from tesrail.conf file
    if tconf_flag:
        case_id = Conf_Reader.get_value(tconf,'OFFICESPACE_FILTER_SIZE')
        Test_Rail.update_testrail(case_id,test_run_id,result_flag,msg=msg) 
    

    #3.Open a listing on co-working page
    #Create co-working page object
    coworking_obj = PageFactory.get_page_object("coworking",driver)
    listing_name = Conf_Reader.get_value(conf,'LISTING_NAME_20MISSION')
    listing_href = Conf_Reader.get_value(conf,'LISTING_HREF_20MISSION')
    
    result_flag1 = coworking_obj.verify_listing(listing_name,listing_href)

    if result_flag1:
        result_flag2 = coworking_obj.click_listing(listing_href)
        if result_flag2:
            listing_obj = PageFactory.get_page_object("listing",driver)
            result_flag = listing_obj.verify_listing_name(listing_name)
    if (result_flag):
        msg = "Listing matched for %s"%listing_name
    else:
        msg = "Listing did not match or '0' coworking spaces"
    coworking_obj.write(msg)
    
    #Update TestRail
    #Get the case id from tesrail.conf file
    if tconf_flag:
        case_id = Conf_Reader.get_value(tconf,'COWORKING_LISTING')
        Test_Rail.update_testrail(case_id,test_run_id,result_flag,msg=msg)
          

    #Teardown
    home_obj.wait(3)
    home_obj.teardown() #You can use any page object to teardown