DEV: Methods in PageObjects::Pages::User to check nav items (#23095)

This commit is contained in:
Sérgio Saquetim 2023-08-15 00:11:20 -03:00 committed by GitHub
parent 23ca3f7e8e
commit 957bff4f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -24,6 +24,22 @@ module PageObjects
page.has_current_path?("/u/#{user.username}/messages/warnings") page.has_current_path?("/u/#{user.username}/messages/warnings")
end end
def has_primary_navigation_item?(name)
page.has_css?(primary_navigation_selector(name))
end
def has_no_primary_navigation_item?(name)
page.has_no_css?(primary_navigation_selector(name))
end
def has_secondary_navigation_item?(name)
page.has_css?(secondary_navigation_selector(name))
end
def has_no_secondary_navigation_item?(name)
page.has_no_css?(secondary_navigation_selector(name))
end
def click_staff_info_warnings_link(user, warnings_count: 0) def click_staff_info_warnings_link(user, warnings_count: 0)
staff_counters = page.find(".staff-counters") staff_counters = page.find(".staff-counters")
staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
@ -57,6 +73,16 @@ module PageObjects
def has_no_staff_info_flagged_posts_counter? def has_no_staff_info_flagged_posts_counter?
page.has_no_css?(".staff-counters .flagged-posts") page.has_no_css?(".staff-counters .flagged-posts")
end end
private
def primary_navigation_selector(name)
".new-user-wrapper .user-navigation-primary li.user-nav__#{name}"
end
def secondary_navigation_selector(name)
".new-user-wrapper .user-navigation-secondary li.user-nav__#{name}"
end
end end
end end
end end