本文整理汇总了Python中pages.home.Home.login方法的典型用法代码示例。如果您正苦于以下问题:Python Home.login方法的具体用法?Python Home.login怎么用?Python Home.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pages.home.Home
的用法示例。
在下文中一共展示了Home.login方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_new_review_is_saved
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_that_new_review_is_saved(self, mozwebqa):
""" Litmus 22921
https://litmus.mozilla.org/show_test.cgi?id=22921 """
# Step 1 - Login into AMO
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.is_the_current_page)
Assert.true(home_page.header.is_user_logged_in)
# Step 2 - Load any addon detail page
details_page = Details(mozwebqa, 'Adblock Plus')
# Step 3 - Click on "Write review" button
write_review_block = details_page.click_to_write_review()
# Step 4 - Write a review
body = 'Automatic addon review by Selenium tests'
write_review_block.enter_review_with_text(body)
write_review_block.set_review_rating(1)
review_page = write_review_block.click_to_save_review()
# Step 5 - Assert review
review = review_page.review()
Assert.equal(review.rating, 1)
Assert.equal(review.author, mozwebqa.credentials['default']['name'])
date = datetime.now().strftime("%B %d, %Y")
# there are no leading zero-signs on day so we need to remove them too
date = date.replace(' 0', ' ')
Assert.equal(review.date, date)
Assert.equal(review.text, body)
示例2: test_that_five_star_rating_increments
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_that_five_star_rating_increments(self, mozwebqa):
""" Litmus 22920
https://litmus.mozilla.org/show_test.cgi?id=22920 """
# Step 1 - Login into AMO
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.header.is_user_logged_in)
# Step 2 - Go to add-ons listing page sorted by rating
extensions_home_page = home_page.click_to_explore('Top Rated')
# Step 3 - Pick an addon with no reviews
extensions_home_page.go_to_last_page()
addon = extensions_home_page.extensions[-1] # the last one is without rating
addon_name = addon.name
details_page = Details(mozwebqa, addon_name)
# Step 4 - Click on the "Write review" button
write_review_block = details_page.click_to_write_review()
# Step 5 - Add review with 1-star rating
body = 'Automatic addon review by Selenium tests'
write_review_block.enter_review_with_text(body)
write_review_block.set_review_rating(5)
write_review_block.click_to_save_review()
# Step 6 - Ensure rating increased by one
details_page = Details(mozwebqa, addon_name)
new_rating_counter = details_page.get_rating_counter(5)
Assert.equal(new_rating_counter, 1)
示例3: test_hide_email_checkbox_works
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_hide_email_checkbox_works(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.is_the_current_page)
Assert.true(home_page.header.is_user_logged_in)
view_profile_page = home_page.header.click_view_profile()
initial_state = view_profile_page.is_email_field_present
edit_profile_page = home_page.header.click_edit_profile()
edit_profile_page.change_hide_email_state()
edit_profile_page.click_update_account()
view_profile_page = home_page.header.click_view_profile()
final_state = view_profile_page.is_email_field_present
try:
Assert.not_equal(initial_state, final_state, 'The initial and final states are the same. The profile change failed.')
if final_state is True:
credentials = mozwebqa.credentials['default']
Assert.equal(credentials['email'], view_profile_page.email_value, 'Actual value is not equal with the expected one.')
except Exception as exception:
Assert.fail(exception.msg)
finally:
if initial_state != final_state:
edit_profile_page = home_page.header.click_edit_profile()
edit_profile_page.change_hide_email_state()
edit_profile_page.click_update_account()
view_profile_page = home_page.header.click_view_profile()
Assert.equal(view_profile_page.is_email_field_present, initial_state, 'Could not restore profile to initial state.')
示例4: test_create_event
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_create_event(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
events_page = home_page.header.click_events_link()
create_event_page = events_page.click_create_event_button()
#Create event with all required fields
create_event_page.set_event_name("New Event")
create_event_page.set_event_description("Fairly long description is required")
create_event_page.set_event_venue("Mozilla office")
create_event_page.set_event_venue_map()
create_event_page.set_event_city("Mountain View")
create_event_page.select_event_country("Antarctica")
create_event_page.select_start_month("3")
create_event_page.select_start_day("14")
create_event_page.select_random_start_year()
create_event_page.select_end_month("11")
create_event_page.select_end_day("22")
create_event_page.select_end_year("2022")
create_event_page.set_event_category()
create_event_page.select_estimated_attendance("100")
create_event_page.set_event_success_metric("10")
create_event_page.set_event_metric("2")
create_event_page.set_event_success_metric2("20")
create_event_page.set_event_metric2("3")
create_event_page.set_event_goals()
event_detail_page = create_event_page.click_save_event_button()
Assert.true(event_detail_page.is_event_saved_message_visible)
Assert.equal('New Event', event_detail_page.name)
示例5: test_edit_event
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_edit_event(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
events_page = home_page.header.click_events_link()
events_page.filter_for("New Event")
event_detail_page = events_page.click_filtered_event()
edit_event_page = event_detail_page.click_edit_event_button()
#Edit newly created event
edit_event_page.edit_event_name("Edited Event title")
edit_event_page.edit_event_description("Updated and changed description goes here")
edit_event_page.edit_event_venue("SFO Commons")
edit_event_page.edit_event_city("San Francisco")
edit_event_page.edit_event_country("United Kingdom")
edit_event_page.edit_start_month("5")
edit_event_page.edit_start_day("28")
edit_event_page.select_random_start_year()
edit_event_page.edit_end_month("12")
edit_event_page.edit_end_day("29")
edit_event_page.edit_event_category()
edit_event_page.edit_estimated_attendance("400")
edit_event_page.edit_event_success_metric("25")
edit_event_page.edit_event_metric("2")
edit_event_page.edit_event_success_metric2("200")
edit_event_page.edit_event_metric2("1")
edit_event_page.edit_event_goals()
event_detail_page = edit_event_page.click_save_event_button()
Assert.true(event_detail_page.is_event_saved_message_visible)
Assert.equal('Edited Event title', event_detail_page.name)
示例6: test_create_event
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_create_event(self, mozwebqa):
home = Home(mozwebqa)
home.go_to_homepage()
Assert.false(home.is_user_loggedin)
home.login()
Assert.true(home.is_user_loggedin)
events = Events(mozwebqa)
示例7: test_admin_login_logout
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_admin_login_logout(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
home_page.select_org(home_page.org).click()
home_page.header.click_logout()
Assert.true(home_page.is_username_field_present)
Assert.true(home_page.is_password_field_present)
示例8: test_user_can_create_report
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_user_can_create_report(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
profile_page = home_page.header.click_profile()
if profile_page.editable_monthly_reports_present:
edit_report_page = profile_page.click_random_editable_monthly_reports()
fields_no = len(edit_report_page.report_fields) - 1
random_text = "test%s" % random.choice(string.lowercase)
# enter report values
for i in range(0, fields_no):
edit_report_page.report_fields[i].clear_field()
edit_report_page.report_fields[i].type_value(random_text)
test_link = 'http://test.com'
edit_report_page.set_input_text_for('event_link', test_link)
edit_report_page.set_input_text_for('activity_link', test_link)
edit_report_page.set_input_text_for('event_name', random_text)
edit_report_page.set_input_text_for('activity_description', random_text)
value = '2'
edit_report_page.select_type_of_participation(value)
edit_report_page.click_save_report_button()
Assert.true(edit_report_page.is_success_message_visible)
Assert.contains('Report successfully created.', edit_report_page.success_message_text)
else:
edit_report_page = profile_page.click_random_existing_monthly_reports()
edit_report_page.click_edit_report_button()
edit_report_page.delete_report()
Assert.true(edit_report_page.is_success_message_visible)
Assert.contains('Report successfully deleted.', edit_report_page.success_message_text)
profile_page.click_random_editable_monthly_reports()
fields_no = len(edit_report_page.report_fields) - 1
random_text = "test%s" % random.choice(string.lowercase)
# enter report values
for i in range(0, fields_no):
edit_report_page.report_fields[i].clear_field()
edit_report_page.report_fields[i].type_value(random_text)
test_link = 'http://test.com'
edit_report_page.set_input_text_for('event_link', test_link)
edit_report_page.set_input_text_for('activity_link', test_link)
edit_report_page.set_input_text_for('event_name', random_text)
edit_report_page.set_input_text_for('activity_description', random_text)
value = '3'
edit_report_page.select_type_of_participation(value)
edit_report_page.click_save_report_button()
Assert.true(edit_report_page.is_success_message_visible)
Assert.contains('Report successfully created.', edit_report_page.success_message_text)
示例9: test_login_logout
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_login_logout(self, mozwebqa):
home_page = Home(mozwebqa)
Assert.false(home_page.is_user_loggedin)
home_page.login()
Assert.true(home_page.is_user_loggedin)
# log out after logging in
home_page.click_logout_menu_item()
Assert.false(home_page.is_user_loggedin)
示例10: test_dashboard_present
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_dashboard_present(self, mozwebqa):
"""
Verify dashboard page contains key elements.
"""
home_page = Home(mozwebqa)
home_page.login()
home_page.select_org(home_page.org).click()
dashboard = Dashboard(mozwebqa)
Assert.true(dashboard.is_dashboard_dropbutton_present)
Assert.true(dashboard.is_dashboard_subscriptions_present)
Assert.true(dashboard.is_dashboard_notificaitons_present)
示例11: test_delete_event
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_delete_event(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.login()
events_page = home_page.header.click_events_link()
events_page.filter_for("Edited Event title")
event_detail_page = events_page.click_filtered_event()
edit_event_page = event_detail_page.click_edit_event_button()
#Delete newly created event
edit_event_page.click_delete_event_button()
events_page = edit_event_page.click_confirm_delete_event_button()
Assert.true(events_page.is_event_deleted_message_visible)
示例12: test_user_can_login_and_logout_using_browser_id_and_return
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_user_can_login_and_logout_using_browser_id_and_return(self, mozwebqa):
""" Test for litmus 7857
https://litmus.mozilla.org/show_test.cgi?id=7857
Test for litmus 4859
https://litmus.mozilla.org/show_test.cgi?id=4859
"""
home_page = Home(mozwebqa)
home_page.login(user="default", use_return=True)
Assert.true(home_page.header.is_sign_out_visible)
home_page.header.click_sign_out()
Assert.false(home_page.header.is_sign_out_visible)
示例13: test_user_can_login_and_logout_using_browser_id
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_user_can_login_and_logout_using_browser_id(self, mozwebqa):
""" Test for litmus 7857
https://litmus.mozilla.org/show_test.cgi?id=7857
Test for litmus 4859
https://litmus.mozilla.org/show_test.cgi?id=4859
"""
home_page = Home(mozwebqa)
home_page.login("browserID")
Assert.true(home_page.is_the_current_page)
Assert.true(home_page.header.is_user_logged_in)
home_page.header.click_logout()
Assert.false(home_page.header.is_user_logged_in)
示例14: test_user_can_access_the_view_profile_page
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_user_can_access_the_view_profile_page(self, mozwebqa):
"""
Test for litmus 15400
https://litmus.mozilla.org/show_test.cgi?id=15400
"""
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.is_the_current_page)
Assert.true(home_page.header.is_user_logged_in)
view_profile_page = home_page.header.click_view_profile()
Assert.equal(view_profile_page.about_me, 'About me')
示例15: test_the_logout_link_for_logged_in_users
# 需要导入模块: from pages.home import Home [as 别名]
# 或者: from pages.home.Home import login [as 别名]
def test_the_logout_link_for_logged_in_users(self, mozwebqa):
"""
Litmus 15110
https://litmus.mozilla.org/show_test.cgi?id=15110
"""
home_page = Home(mozwebqa)
home_page.login()
Assert.true(home_page.is_the_current_page)
Assert.true(home_page.header.is_user_logged_in)
discovery_pane = DiscoveryPane(mozwebqa, self.basepath)
Assert.true(discovery_pane.is_logout_link_visible)
home_page = discovery_pane.click_logout()
Assert.true(home_page.is_the_current_page)
Assert.false(home_page.header.is_user_logged_in)