class MainPageTests(unittest.TestCase):

    def setUp(self):
        browser = os.environ.get('BROWSER', os.environ['BROWSER'])

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )

        self.main_page = MainPage(self.driver)
        self.main_page.open()

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

    def test_open_gifts(self):
        gifts_page = self.main_page.open_gifts()
        ok = gifts_page.is_loaded()
        self.assertTrue(ok)

    def test_open_friend_and_make_gift(self):
        friends_page = self.main_page.open_friends()
        friend_profile = friends_page.open_friend_profile()
        gift_page = friend_profile.make_gift()
        ok = gift_page.is_loaded()
        self.assertTrue(ok)

        gift_page = gift_page.send_gift_with_selected_profile()
        ok = gift_page.is_gift_sent()
        self.assertTrue(ok)
 def test_login_correct_creds(self, browser):
     login_page = LoginPage(browser)
     main_page = MainPage(browser)
     with allure.step("Open login page"):
         login_page.open()
     with allure.step("Check that login page opened"):
         assert login_page.at_page()
     with allure.step("Login to JIRA with correct credentials"):
         login_page.login(login, password)
         allure.attach(browser.get_screenshot_as_png(),
                       name="login_correct_creds1",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Check that main page opened"):
         assert main_page.at_page()
         allure.attach(browser.get_screenshot_as_png(),
                       name="test_login_correct_creds2",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Logout from JIRA"):
         logout_page = main_page.logout()
     with allure.step("Cheсk that logout page appears"):
         assert logout_page.at_page()
     with allure.step("Open login page"):
         login_page.open()
     with allure.step("Check that login page opened"):
         assert login_page.at_page()
         allure.attach(browser.get_screenshot_as_png(),
                       name="test_logout",
                       attachment_type=allure.attachment_type.PNG)
Example #3
0
 def test_web_ui_34_check_lk_page_exit(self, auth_by_trial_tariff, browser):
     lk_page = LKPage(browser)
     with wait_for_page_to_reload(browser):
         lk_page.click_exit_btn()
     main_page = MainPage(browser)
     assert_that(browser.current_url, contains_string(main_page.path),
                 'Главная страница не открылась')
     main_page.check_header()
Example #4
0
 def test_login_to_jira(self, browser):
     self.login_page = LoginPage(browser)
     self.login_page.open(url_ui)
     assert self.login_page.at_page()
     self.login_page.login_to_jira_enter_username(global_user)
     self.login_page.login_to_jira_enter_password(global_pass)
     self.login_page.click_login_button_at_main_page()
     self.main_page = MainPage(browser)
     assert self.main_page.is_assigned_to_me_section()
Example #5
0
    def setUp(self):
        browser = os.environ.get('BROWSER', os.environ['BROWSER'])

        self.driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                             desired_capabilities=getattr(
                                 DesiredCapabilities, browser).copy())

        self.main_page = MainPage(self.driver)
        self.main_page.open()
 def test_login_to_jira(self, browser):
     self.login_page = LoginPage(browser)
     self.login_page.open("http://jira.hillel.it:8080/secure/Dashboard.jspa")
     assert self.login_page.at_page()
     self.login_page.login_to_jira_enter_username("webinar5")
     self.login_page.login_to_jira_enter_password("webinar5")
     self.login_page.click_login_button_at_main_page()
     self.main_page = MainPage(browser)
     self.main_page.is_assigned_to_me_section()
     assert self.main_page.is_assigned_to_me_section()
Example #7
0
 def test_download_csv(self):
     main_page = MainPage(self.driver)
     db_conn = DbConnect()
     self.login()
     main_page.click_download_csv_button()
     sql_query = '''select count(email) 
     from worker where "employerId"='{}' and archived='False';'''.format(
         Config.db_login)
     query_response = db_conn.fetch_one(sql_query)
     self.assertEqual(self.helpers.get_count_of_emails_in_csv(),
                      query_response[0])
Example #8
0
 def test_change_assigner_for_the_ticket(self, browser):
     self.login_page = LoginPage(browser)
     self.login_page.open(
         "http://jira.hillel.it:8080/secure/Dashboard.jspa")
     self.login_page.login_to_jira_enter_username("webinar5")
     self.login_page.login_to_jira_enter_password("webinar5")
     self.login_page.click_login_button_at_main_page()
     self.main_page = MainPage(browser)
     self.main_page.click_the_first_ticket_assigned_to_me()
     self.issue_details_page = IssueDetailsPage(browser)
     self.issue_details_page.click_issue_reporter_field()
     self.issue_details_page.enter_new_reporter("Artur Piluck")
     assert self.issue_details_page.should_be_new_assigner("Artur Piluck")
     self.issue_details_page.refresh_the_page()
     assert self.issue_details_page.should_be_new_assigner("Artur Piluck")
Example #9
0
 def test_create_issue_in_jira(self, browser):
     self.login_page = LoginPage(browser)
     self.login_page.open(
         "http://jira.hillel.it:8080/secure/Dashboard.jspa")
     assert self.login_page.at_page()
     self.login_page.login_to_jira_enter_username("webinar5")
     self.login_page.login_to_jira_enter_password("webinar5")
     self.login_page.click_login_button_at_main_page()
     self.main_page = MainPage(browser)
     assert self.main_page.is_assigned_to_me_section()
     self.main_page.click_create_issue_button()
     self.create_issue_page = CreateIssue(browser)
     self.create_issue_page.should_have_title("Create Issue")
     self.create_issue_page.choose_the_project("Webinar (WEBINAR)")
     self.create_issue_page.enter_summary_field("UI bug In Jira")
     self.create_issue_page.enter_reporter("webinar5")
     self.create_issue_page.click_create_issue_button_at_details_page()
     assert "Issue" in self.create_issue_page.is_alert_present()
Example #10
0
class MainPageTests(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('BROWSER', os.environ['BROWSER'])

        self.driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                             desired_capabilities=getattr(
                                 DesiredCapabilities, browser).copy())

        self.main_page = MainPage(self.driver)
        self.main_page.open()

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

    def test_open_gifts(self):
        gifts_page = self.main_page.open_gifts()
        is_loaded = gifts_page.is_loaded()
        self.assertTrue(is_loaded)
Example #11
0
 def test_create_issue_empty_summary(self, browser):
     summary = ""
     issue_type = "Bug"
     main_page = MainPage(browser)
     with allure.step("Open new issue dialog"):
         new_issue_page = main_page.open_create_issue_page()
     with allure.step("Check that new issue dialog is opened"):
         assert new_issue_page.at_page()
     with allure.step("Call create issue method"):
         new_issue_page.create_issue(self.project_name, issue_type, summary)
     with allure.step("Check that correct error message is displayed"):
         assert new_issue_page.error_text(
             "You must specify a summary of the issue")
         allure.attach(browser.get_screenshot_as_png(),
                       name="empty_summary_test",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Cancel new issue dialog"):
         new_issue_page.cancel_issue()
     with allure.step("Check that user is returned to main page"):
         assert main_page.at_page()
Example #12
0
 def test_web_ui_20_check_registration_page_success_reg(self, browser):
     signup_page = SignUpPage(browser)
     signup_page.open()
     signup_page.register_user(name='Test',
                               phone=str(
                                   random.randint(9900000000, 9909999999)))
     signup_page.check_success_block_elements()
     with wait_for_page_to_reload(browser):
         signup_page.click_return_btn_in_success_block()
     assert_that(browser.current_url,
                 contains_string(MainPage(browser).path),
                 'Главная страница не открылась')
Example #13
0
 def test_create_issue_unsupported_summary(self, browser):
     summary = "Maxim " * 50
     main_page = MainPage(browser)
     with allure.step("Open new issue dialog"):
         new_issue_page = main_page.open_create_issue_page()
     with allure.step("Check that new issue dialog is opened"):
         assert new_issue_page.at_page()
     with allure.step("Call type summary method"):
         new_issue_page.type_summary(summary)
     with allure.step("Call submit issue method"):
         new_issue_page.submit_issue()
     with allure.step("Check that correct error message is displayed"):
         assert new_issue_page.error_text(
             "Summary must be less than 255 characters")
         allure.attach(browser.get_screenshot_as_png(),
                       name="summary_longer_than_supported",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Cancel new issue dialog"):
         new_issue_page.cancel_issue()
     with allure.step("Check that user is returned to main page"):
         assert main_page.at_page()
Example #14
0
def login_to_jira(request, browser):
    from src.pages.login_page import LoginPage
    from src.pages.main_page import MainPage
    login_page = LoginPage(browser)
    main_page = MainPage(browser)

    with allure.step("Open login page"):
        login_page.open()
    with allure.step("Login to JIRA"):
        login_page.login(login, password)

    def take_screenshot():
        with allure.step("Taking screenshot"):
            browser.execute_script("document.body.bgColor = 'white';")
            allure.attach(browser.get_screenshot_as_png(),
                          name=request.function.__name__,
                          attachment_type=allure.attachment_type.PNG)

    request.addfinalizer(take_screenshot)

    with allure.step("Wait until main page is loaded"):
        main_page.wait_until_loaded()

    yield main_page

    with allure.step("Logout from JIRA"):
        main_page.logout()
Example #15
0
 def test_web_ui_7_check_main_page_license(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_new_window(browser):
         main_page.click_on_license_agreement_in_footer()
     assert_that(browser.current_url, contains_string(LicensePage(browser).path),
                 'Страница "Лицензионное соглашение" не открылась')
Example #16
0
 def test_web_ui_8_check_main_page_confidentiality(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_new_window(browser):
         main_page.click_on_privacy_policy_in_footer()
     assert_that(browser.current_url, contains_string(PrivacyPolicyPage(browser).path),
                 'Страница "Политика конфиденциальности" не открылась')
Example #17
0
 def test_web_ui_6_check_main_page_terms_of_use(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_new_window(browser):
         main_page.click_on_terms_of_use_in_footer()
     assert_that(browser.current_url, contains_string(TermsOfUsePage(browser).path),
                 'Страница "Пользовательское соглашение" не открылась')
Example #18
0
 def test_search_result_pages_with_noresult(self, variables):
     noresult = variables['noresult']
     with allure.step("開啟首頁"): pass
     mainpage=MainPage().open()
     with allure.step("關閉CrazyAD"):pass
     mainpage.close_crazy_banner()
     with allure.step("輸入關鍵字:"+noresult):pass
     mainpage.input_search_keyword(noresult)
     with allure.step("點擊搜尋"):pass
     searchresultpage=mainpage.click_search_button()
     with allure.step("顯示搜尋無結果文案"):pass
     assert searchresultpage.noresult.should(be.visible)
Example #19
0
 def test_search_result_must_have_values(self, variables):
     keyword = variables['keyword']
     with allure.step("開啟首頁"): pass
     mainpage=MainPage().open()
     with allure.step("關閉CrazyAD"):pass
     mainpage.close_crazy_banner()
     with allure.step("輸入關鍵字:"+keyword):pass
     mainpage.input_search_keyword(keyword)
     with allure.step("點擊搜尋"):pass
     searchresultpage=mainpage.click_search_button()
     with allure.step("搜尋列表非空值"):pass
     assert searchresultpage.items[0].should(be.clickable)
     assert searchresultpage.items[0].should(be.visible)
     assert len(searchresultpage.items) >0
Example #20
0
 def test_archived_worker(self):
     main_page = MainPage(self.driver)
     api_helper = ApiHelper()
     db_conn = DbConnect()
     fake_data = self.helpers.generate_fake_data()
     email = fake_data["email"]
     sql_query = """select "email" from worker where email='{}' and archived='true';""".format(
         email)
     body = {
         'email': email,
         'firstname': fake_data["first_name"],
         'lastname': fake_data["last_name"]
     }
     api_helper.make_http_request(method_type="POST",
                                  url_part="workers_creation",
                                  body=body)
     self.login()
     main_page.specify_search(email)
     main_page.press_search_button()
     main_page.click_on_checkbox_next_to_worker()
     main_page.click_on_archive_button()
     main_page.click_on_archive_button_in_dialog()
     query_response = db_conn.fetch_one(sql_query)
     self.assertIsNotNone(query_response)
Example #21
0
 def than_at_main_page(self):
     return MainPage()
Example #22
0
def main_page(driver):
    return MainPage(driver)
Example #23
0
 def login_as(self, user):
     self.username_input.set(user.name)
     self.password_input.set(user.password)
     self.login_btn.click()
     return MainPage()
Example #24
0
class TestJiraLoginUI:
    @pytest.mark.smoke
    def test_login_to_jira(self, browser):
        self.login_page = LoginPage(browser)
        self.login_page.open(url_ui)
        assert self.login_page.at_page()
        self.login_page.login_to_jira_enter_username(global_user)
        self.login_page.login_to_jira_enter_password(global_pass)
        self.login_page.click_login_button_at_main_page()
        self.main_page = MainPage(browser)
        assert self.main_page.is_assigned_to_me_section()

    @pytest.mark.smoke
    def test_create_issue_in_jira(self, browser):
        self.login_page = LoginPage(browser)
        self.login_page.open(
            "http://jira.hillel.it:8080/secure/Dashboard.jspa")
        assert self.login_page.at_page()
        self.login_page.login_to_jira_enter_username("webinar5")
        self.login_page.login_to_jira_enter_password("webinar5")
        self.login_page.click_login_button_at_main_page()
        self.main_page = MainPage(browser)
        assert self.main_page.is_assigned_to_me_section()
        self.main_page.click_create_issue_button()
        self.create_issue_page = CreateIssue(browser)
        self.create_issue_page.should_have_title("Create Issue")
        self.create_issue_page.choose_the_project("Webinar (WEBINAR)")
        self.create_issue_page.enter_summary_field("UI bug In Jira")
        self.create_issue_page.enter_reporter("webinar5")
        self.create_issue_page.click_create_issue_button_at_details_page()
        assert "Issue" in self.create_issue_page.is_alert_present()

    @pytest.mark.regression
    def test_add_comment_to_the_ticket(self, browser):
        self.login_page = LoginPage(browser)
        self.login_page.open("https://jira.hillel.it/browse/WEBINAR-9060")
        self.login_page.login_to_jira_enter_username("webinar5")
        self.login_page.login_to_jira_enter_password("webinar5")
        self.login_page.click_login_button_at_login_page()
        self.comment_page_page = CommentPage(browser)
        self.comment_page_page.click_comment_button()
        self.comment_page_page.enter_comment_text("comment_text")
        self.comment_page_page.click_add_comment_button()
        assert not self.comment_page_page.comment_input_field_at_page(
        ), "Comment not added"

    @pytest.mark.regression
    def test_change_assigner_for_the_ticket(self, browser):
        self.login_page = LoginPage(browser)
        self.login_page.open(
            "http://jira.hillel.it:8080/secure/Dashboard.jspa")
        self.login_page.login_to_jira_enter_username("webinar5")
        self.login_page.login_to_jira_enter_password("webinar5")
        self.login_page.click_login_button_at_main_page()
        self.main_page = MainPage(browser)
        self.main_page.click_the_first_ticket_assigned_to_me()
        self.issue_details_page = IssueDetailsPage(browser)
        self.issue_details_page.click_issue_reporter_field()
        self.issue_details_page.enter_new_reporter("Artur Piluck")
        assert self.issue_details_page.should_be_new_assigner("Artur Piluck")
        self.issue_details_page.refresh_the_page()
        assert self.issue_details_page.should_be_new_assigner("Artur Piluck")

    @pytest.mark.regression
    @pytest.mark.parametrize("login, password, rez", [
        ("admin", "password",
         "Sorry, your username and password are incorrect - please try again.")
    ])
    def test_with_invalid_login_to_jira(self, browser, login, password, rez):
        self.login_page = LoginPage(browser)
        self.login_page.open(url_ui)
        assert self.login_page.at_page()
        self.login_page.login_to_jira_enter_username(login)
        self.login_page.login_to_jira_enter_password(password)
        self.login_page.click_login_button_at_main_page()
        assert self.login_page.is_invalid_message_present(rez)
Example #25
0
def test_main_page(driver):
    main_page = MainPage(driver)
    main_page.visit_main_page()
    assert main_page.is_main_page()
    assert main_page.get_links_count() == 44
    assert main_page.validate_all_links() == {}, "Some href are not matching with the real page URL"
Example #26
0
 def test_web_ui_5_check_main_page_try_free_link(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_page_to_reload(browser):
         main_page.click_on_try_btn_in_tariffs_block()
     assert_that(browser.current_url, contains_string(SignUpPage(browser).path), 'Страница авторизации не открылась')
Example #27
0
 def test_web_ui_4_check_main_page_registration_link(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_page_to_reload(browser):
         main_page.click_on_registration_btn_in_header()
     assert_that(browser.current_url, contains_string(SignUpPage(browser).path), 'Страница авторизации не открылась')
Example #28
0
 def test_web_ui_3_check_main_page_auth_link(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     with wait_for_page_to_reload(browser):
         main_page.click_on_come_in_btn_in_header()
     assert_that(browser.current_url, contains_string(LoginPage(browser).path), 'Страница логина не открылась')
Example #29
0
 def test_web_ui_2_check_main_page_price(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     main_page.click_on_tarifs_in_header()
     wait_in_view(main_page.get_tarifs_location(), browser.get_window_position(), browser.get_window_size())
Example #30
0
 def test_web_ui_1_check_main_page_locators(self, browser):
     main_page = MainPage(browser)
     main_page.open()
     main_page.check_all_elements()