def test_add_room_to_shift_should_succeed(self): home_page = HomePage(self.driver).open_home_page() WebDriverWait(self.driver, 60).until( EC.text_to_be_present_in_element(home_page.header._einloggen_text, "Einloggen")) account_page = home_page.header.login(USER, PASSWORD) sleep(5) if "Einloggen" in home_page.header.get_page_source(): account_page = home_page.header.login(USER, PASSWORD) account_page.open_AUTOTESTb_restaurant() restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.open_shift_tab() restaurant_settings_page.add_shift_first_accordeon() restaurant_settings_page.add_1_room_to_shift() restaurant_settings_page.save_shift() account_page = home_page.header.click_account_page() account_page.open_shifts_menu() account_page.expand_first_shift() WebDriverWait(self.driver, 30).until( EC.text_to_be_present_in_element( account_page._first_shift_first_room_name_field, restaurant_settings_page.first_room_name)) account_page = home_page.header.click_account_page() restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.open_shift_tab() restaurant_settings_page.remove_first_shift() self.not_contains(restaurant_settings_page._shift_name_value, restaurant_settings_page.get_page_source()) self.not_contains(restaurant_settings_page._shift_internal_name_value, restaurant_settings_page.get_page_source())
def test_archive_shift_should_succeed(self): home_page = HomePage(self.driver).open_home_page() WebDriverWait(self.driver, 60).until( EC.text_to_be_present_in_element(home_page.header._einloggen_text, "Einloggen")) account_page = home_page.header.login(USER, PASSWORD) sleep(5) if "Einloggen" in home_page.header.get_page_source(): account_page = home_page.header.login(USER, PASSWORD) account_page.open_George_Bar_Grill_restaurant() restaurant_settings_page = account_page.open_restaurant_settings() restaurant_settings_page.open_shift_tab() restaurant_settings_page.get_first_shift_internal_name() restaurant_settings_page.archive_first_shift() sleep(3) Assert.not_equal( restaurant_settings_page._first_shift_internal_name, restaurant_settings_page.get_text( restaurant_settings_page._first_shift_internal_name_field)) restaurant_settings_page.expand_archived_shifts() Assert.equal( restaurant_settings_page._first_shift_internal_name, restaurant_settings_page.get_text( restaurant_settings_page. _first_archived_shift_internal_name_field)) restaurant_settings_page.unachive_shift() WebDriverWait(self.driver, 15).until( EC.text_to_be_present_in_element( restaurant_settings_page._first_shift_internal_name_field, restaurant_settings_page._first_shift_internal_name)) Assert.true( self.is_element_present("//table[2]/tbody/tr/td[2]") == False)
def test_visitor_can_view_source(self, mozwebqa): home_pg = HomePage(mozwebqa) home_pg.go_to_home_page() view_source_pg = home_pg.header_region.click_view_source() Assert.true(view_source_pg.is_the_current_page) Assert.greater(len(view_source_pg.source_textarea.strip()), 0)
def test_that_user_can_edit_profile(self, base_url, selenium, new_user): home_page = HomePage(selenium, base_url).open() home_page.login_and_complete_profile(new_user) profile_details = home_page.click_user_profile_details() edit_profile = profile_details.click_edit_profile_button() assert new_user['name'] == edit_profile.display_name assert new_user['name'] == edit_profile.username new_name = str(uuid.uuid4()) new_username = str(uuid.uuid4()).replace('-', '')[10:] edit_profile.display_name = new_name edit_profile.username = new_username edit_profile.user_profile_url = new_user['url'] edit_profile.bugzilla_email = new_user['email'] profile_details = edit_profile.click_save_button( 'user_profile_details') assert new_name == profile_details.user_profile_name assert new_user['url'] == profile_details.user_profile_url assert new_user['email'] == profile_details.bugzilla_email edit_profile = profile_details.click_edit_profile_button() assert new_name == edit_profile.display_name assert new_username == edit_profile.username assert new_user['url'] == edit_profile.user_profile_url assert new_user['email'] == edit_profile.bugzilla_email
def test_user_can_edit_page(self, mozwebqa): _edit_text_entered = 'MozWebQA Edit page wiki-test - ' + str( time.time()) home_pg = HomePage(mozwebqa) home_pg.go_to_home_page() home_pg.personal_tools_region.click_log_in_or_create_account() log_in_or_create_account_pg = LogInOrCreateAccountPage(mozwebqa) log_in_or_create_account_pg.log_in() Assert.true(home_pg.is_the_current_page) Assert.true(home_pg.personal_tools_region.is_user_page_visible) home_pg.personal_tools_region.click_user_page() if home_pg.header_region.is_edit_visible: edit_pg = home_pg.header_region.click_edit() Assert.true(edit_pg.is_edit_page_textarea_present) edit_pg.enter_edit_textarea_text(_edit_text_entered) Assert.true(edit_pg.is_edit_page_save_button_present) edit_pg.click_save_button() Assert.true(edit_pg.is_user_entered_text_saved_and_present) Assert.equal(edit_pg.get_user_entered_text, _edit_text_entered) else: Assert.fail("Error - you don't have privileges to edit this page.")
def test_logout(self, mozwebqa): home_pg = HomePage(mozwebqa) home_pg.go_to_home_page() home_pg.login_region.login() Assert.true(home_pg.is_logged_in) home_pg.login_region.logout() Assert.false(home_pg.is_logged_in)