Commit 56dbe0f2 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'dd-qa-ambiguous-pageobject-cleanup-2' into 'master'

Refactor ambiguous page-object names p.2

See merge request gitlab-org/gitlab!20394
parents 79f5060b 94c10463
...@@ -29,12 +29,12 @@ module QA ...@@ -29,12 +29,12 @@ module QA
QA::Page::Group::Menu.perform(&:click_group_epics_link) QA::Page::Group::Menu.perform(&:click_group_epics_link)
QA::EE::Page::Group::Epic::Index.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName QA::EE::Page::Group::Epic::Index.perform do |index|
page.click_new_epic index.click_new_epic
page.set_title(@title) index.set_title(@title)
page.create_new_epic index.create_new_epic
page.wait(interval: 1) do index.wait(interval: 1) do
page.has_text?(@title) index.has_text?(@title)
end end
end end
end end
......
...@@ -14,12 +14,12 @@ module QA ...@@ -14,12 +14,12 @@ module QA
QA::Page::Admin::Menu.perform(&:click_geo_menu_link) QA::Page::Admin::Menu.perform(&:click_geo_menu_link)
EE::Page::Admin::Geo::Nodes::Show.perform(&:new_node!) EE::Page::Admin::Geo::Nodes::Show.perform(&:new_node!)
EE::Page::Admin::Geo::Nodes::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName EE::Page::Admin::Geo::Nodes::New.perform do |new_page|
raise ArgumentError if @name.nil? || @address.nil? raise ArgumentError if @name.nil? || @address.nil?
page.set_node_name(@name) new_page.set_node_name(@name)
page.set_node_address(@address) new_page.set_node_address(@address)
page.add_node! new_page.add_node!
end end
QA::Page::Main::Menu.perform(&:sign_out) QA::Page::Main::Menu.perform(&:sign_out)
......
...@@ -6,16 +6,16 @@ module QA ...@@ -6,16 +6,16 @@ module QA
attr_accessor :name, :expires_at attr_accessor :name, :expires_at
attribute :username do attribute :username do
Page::Project::Settings::Repository.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Settings::Repository.perform do |repository_page|
page.expand_deploy_tokens do |token| repository_page.expand_deploy_tokens do |token|
token.token_username token.token_username
end end
end end
end end
attribute :password do attribute :password do
Page::Project::Settings::Repository.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Settings::Repository.perform do |repository_page|
page.expand_deploy_tokens do |token| repository_page.expand_deploy_tokens do |token|
token.token_password token.token_password
end end
end end
......
...@@ -27,11 +27,11 @@ module QA ...@@ -27,11 +27,11 @@ module QA
Page::Project::Show.perform(&:create_first_new_file!) Page::Project::Show.perform(&:create_first_new_file!)
Page::File::Form.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::File::Form.perform do |form|
page.add_name(@name) form.add_name(@name)
page.add_content(@content) form.add_content(@content)
page.add_commit_message(@commit_message) form.add_commit_message(@commit_message)
page.commit_changes form.commit_changes
end end
end end
......
...@@ -41,8 +41,8 @@ module QA ...@@ -41,8 +41,8 @@ module QA
fork_new.choose_namespace(user.name) fork_new.choose_namespace(user.name)
end end
Page::Layout::Banner.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Layout::Banner.perform do |banner|
page.has_notice?('The project was successfully forked.') banner.has_notice?('The project was successfully forked.')
end end
populate(:project) populate(:project)
......
...@@ -24,36 +24,36 @@ module QA ...@@ -24,36 +24,36 @@ module QA
Page::Project::Operations::Kubernetes::Add.perform( Page::Project::Operations::Kubernetes::Add.perform(
&:add_existing_cluster) &:add_existing_cluster)
Page::Project::Operations::Kubernetes::AddExisting.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Operations::Kubernetes::AddExisting.perform do |cluster_page|
page.set_cluster_name(@cluster.cluster_name) cluster_page.set_cluster_name(@cluster.cluster_name)
page.set_api_url(@cluster.api_url) cluster_page.set_api_url(@cluster.api_url)
page.set_ca_certificate(@cluster.ca_certificate) cluster_page.set_ca_certificate(@cluster.ca_certificate)
page.set_token(@cluster.token) cluster_page.set_token(@cluster.token)
page.uncheck_rbac! unless @cluster.rbac cluster_page.uncheck_rbac! unless @cluster.rbac
page.add_cluster! cluster_page.add_cluster!
end end
if @install_helm_tiller if @install_helm_tiller
Page::Project::Operations::Kubernetes::Show.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Operations::Kubernetes::Show.perform do |show|
# We must wait a few seconds for permissions to be set up correctly for new cluster # We must wait a few seconds for permissions to be set up correctly for new cluster
sleep 10 sleep 10
# Helm must be installed before everything else # Helm must be installed before everything else
page.install!(:helm) show.install!(:helm)
page.await_installed(:helm) show.await_installed(:helm)
page.install!(:ingress) if @install_ingress show.install!(:ingress) if @install_ingress
page.install!(:prometheus) if @install_prometheus show.install!(:prometheus) if @install_prometheus
page.install!(:runner) if @install_runner show.install!(:runner) if @install_runner
page.await_installed(:ingress) if @install_ingress show.await_installed(:ingress) if @install_ingress
page.await_installed(:prometheus) if @install_prometheus show.await_installed(:prometheus) if @install_prometheus
page.await_installed(:runner) if @install_runner show.await_installed(:runner) if @install_runner
if @install_ingress if @install_ingress
populate(:ingress_ip) populate(:ingress_ip)
page.set_domain("#{ingress_ip}.nip.io") show.set_domain("#{ingress_ip}.nip.io")
page.save_domain show.save_domain
end end
end end
end end
......
...@@ -28,11 +28,11 @@ module QA ...@@ -28,11 +28,11 @@ module QA
Page::Project::Menu.perform(&:go_to_labels) Page::Project::Menu.perform(&:go_to_labels)
Page::Label::Index.perform(&:click_new_label_button) Page::Label::Index.perform(&:click_new_label_button)
Page::Label::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Label::New.perform do |new_page|
page.fill_title(@title) new_page.fill_title(@title)
page.fill_description(@description) new_page.fill_description(@description)
page.fill_color(@color) new_page.fill_color(@color)
page.click_label_create_button new_page.click_label_create_button
end end
end end
......
...@@ -65,17 +65,17 @@ module QA ...@@ -65,17 +65,17 @@ module QA
project.visit! project.visit!
Page::Project::Show.perform(&:new_merge_request) Page::Project::Show.perform(&:new_merge_request)
Page::MergeRequest::New.perform do |new| Page::MergeRequest::New.perform do |new_page|
new.fill_title(@title) new_page.fill_title(@title)
new.fill_description(@description) new_page.fill_description(@description)
new.choose_milestone(@milestone) if @milestone new_page.choose_milestone(@milestone) if @milestone
new.assign_to_me if @assignee == 'me' new_page.assign_to_me if @assignee == 'me'
labels.each do |label| labels.each do |label|
new.select_label(label) new_page.select_label(label)
end end
new.add_approval_rules(approval_rules) if approval_rules new_page.add_approval_rules(approval_rules) if approval_rules
new.create_merge_request new_page.create_merge_request
end end
end end
......
...@@ -16,10 +16,10 @@ module QA ...@@ -16,10 +16,10 @@ module QA
Page::Main::Menu.perform(&:click_settings_link) Page::Main::Menu.perform(&:click_settings_link)
Page::Profile::Menu.perform(&:click_access_tokens) Page::Profile::Menu.perform(&:click_access_tokens)
Page::Profile::PersonalAccessTokens.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Profile::PersonalAccessTokens.perform do |token_page|
page.fill_token_name(name || 'api-test-token') token_page.fill_token_name(name || 'api-test-token')
page.check_api token_page.check_api
page.click_create_token_button token_page.click_create_token_button
end end
end end
end end
......
...@@ -32,14 +32,14 @@ module QA ...@@ -32,14 +32,14 @@ module QA
end end
attribute :repository_ssh_location do attribute :repository_ssh_location do
Page::Project::Show.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Show.perform do |show|
page.repository_clone_ssh_location show.repository_clone_ssh_location
end end
end end
attribute :repository_http_location do attribute :repository_http_location do
Page::Project::Show.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Show.perform do |show|
page.repository_clone_http_location show.repository_clone_http_location
end end
end end
...@@ -62,13 +62,13 @@ module QA ...@@ -62,13 +62,13 @@ module QA
Page::Group::Show.perform(&:go_to_new_project) Page::Group::Show.perform(&:go_to_new_project)
end end
Page::Project::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::New.perform do |new_page|
page.choose_test_namespace new_page.choose_test_namespace
page.choose_name(@name) new_page.choose_name(@name)
page.add_description(@description) new_page.add_description(@description)
page.set_visibility(@visibility) new_page.set_visibility(@visibility)
page.enable_initialize_with_readme if @initialize_with_readme new_page.enable_initialize_with_readme if @initialize_with_readme
page.create_new_project new_page.create_new_project
end end
end end
......
...@@ -17,18 +17,14 @@ module QA ...@@ -17,18 +17,14 @@ module QA
Page::Group::Show.perform(&:go_to_new_project) Page::Group::Show.perform(&:go_to_new_project)
Page::Project::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::New.perform(&:click_import_project)
page.click_import_project
end
Page::Project::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::New.perform(&:click_github_link)
page.click_github_link
end
Page::Project::Import::Github.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Import::Github.perform do |import_page|
page.add_personal_access_token(@personal_access_token) import_page.add_personal_access_token(@personal_access_token)
page.list_repos import_page.list_repos
page.import!(@github_repository_path, @name) import_page.import!(@github_repository_path, @name)
end end
end end
end end
......
...@@ -18,9 +18,9 @@ module QA ...@@ -18,9 +18,9 @@ module QA
def fabricate! def fabricate!
project.visit! project.visit!
Page::Project::Menu.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Menu.perform do |menu|
page.click_issues menu.click_issues
page.click_milestones menu.click_milestones
end end
Page::Project::Milestone::Index.perform(&:click_new_milestone) Page::Project::Milestone::Index.perform(&:click_new_milestone)
......
...@@ -16,13 +16,13 @@ module QA ...@@ -16,13 +16,13 @@ module QA
def fabricate! def fabricate!
Page::Dashboard::Snippet::Index.perform(&:go_to_new_snippet_page) Page::Dashboard::Snippet::Index.perform(&:go_to_new_snippet_page)
Page::Dashboard::Snippet::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Dashboard::Snippet::New.perform do |new_page|
page.fill_title(@title) new_page.fill_title(@title)
page.fill_description(@description) new_page.fill_description(@description)
page.set_visibility(@visibility) new_page.set_visibility(@visibility)
page.fill_file_name(@file_name) new_page.fill_file_name(@file_name)
page.fill_file_content(@file_content) new_page.fill_file_content(@file_content)
page.click_create_snippet_button new_page.click_create_snippet_button
end end
end end
end end
......
...@@ -17,8 +17,8 @@ module QA ...@@ -17,8 +17,8 @@ module QA
Page::Main::Menu.perform(&:click_settings_link) Page::Main::Menu.perform(&:click_settings_link)
Page::Profile::Menu.perform(&:click_ssh_keys) Page::Profile::Menu.perform(&:click_ssh_keys)
Page::Profile::SSHKeys.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Profile::SSHKeys.perform do |profile_page|
page.add_key(public_key, title) profile_page.add_key(public_key, title)
end end
end end
end end
......
...@@ -8,10 +8,10 @@ module QA ...@@ -8,10 +8,10 @@ module QA
Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Login.perform(&:sign_in_using_credentials)
Page::Main::Menu.perform(&:go_to_groups) Page::Main::Menu.perform(&:go_to_groups)
Page::Dashboard::Groups.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Dashboard::Groups.perform do |groups|
page.click_new_group groups.click_new_group
expect(page).to have_content( expect(groups).to have_content(
/Create a Mattermost team for this group/ /Create a Mattermost team for this group/
) )
end end
......
...@@ -11,8 +11,8 @@ module QA ...@@ -11,8 +11,8 @@ module QA
Runtime::Browser.visit(:mattermost, Page::Mattermost::Login) Runtime::Browser.visit(:mattermost, Page::Mattermost::Login)
Page::Mattermost::Login.perform(&:sign_in_using_oauth) Page::Mattermost::Login.perform(&:sign_in_using_oauth)
Page::Mattermost::Main.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Mattermost::Main.perform do |mattermost|
expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/) expect(mattermost).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/)
end end
end end
end end
......
...@@ -15,8 +15,8 @@ module QA ...@@ -15,8 +15,8 @@ module QA
project.visit! project.visit!
Page::Project::Menu.perform(&:go_to_members_settings) Page::Project::Menu.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Settings::Members.perform do |members|
page.add_member(user.username) members.add_member(user.username)
end end
expect(page).to have_content(/@#{user.username}(\n| )?Given access/) expect(page).to have_content(/@#{user.username}(\n| )?Given access/)
......
...@@ -27,8 +27,8 @@ module QA ...@@ -27,8 +27,8 @@ module QA
project.visit! project.visit!
Page::Project::Show.perform(&:go_to_members_settings) Page::Project::Show.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Settings::Members.perform do |members|
page.add_member(user.username) members.add_member(user.username)
end end
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
......
...@@ -23,12 +23,12 @@ module QA ...@@ -23,12 +23,12 @@ module QA
it 'user sees issue suggestions when creating a new issue' do it 'user sees issue suggestions when creating a new issue' do
Page::Project::Show.perform(&:go_to_new_issue) Page::Project::Show.perform(&:go_to_new_issue)
Page::Project::Issue::New.perform do |new| Page::Project::Issue::New.perform do |new_page|
new.add_title("issue") new_page.add_title("issue")
expect(new).to have_content(issue_title) expect(new_page).to have_content(issue_title)
new.add_title("Issue Board") new_page.add_title("Issue Board")
expect(new).not_to have_content(issue_title) expect(new_page).not_to have_content(issue_title)
end end
end end
end end
......
...@@ -50,10 +50,10 @@ module QA ...@@ -50,10 +50,10 @@ module QA
@project.visit! @project.visit!
Page::Project::Show.perform(&:open_web_ide!) Page::Project::Show.perform(&:open_web_ide!)
Page::Project::WebIDE::Edit.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::WebIDE::Edit.perform do |ide|
page.create_new_file_from_template template[:file_name], template[:name] ide.create_new_file_from_template template[:file_name], template[:name]
expect(page.has_file?(template[:file_name])).to be_truthy expect(ide.has_file?(template[:file_name])).to be_truthy
end end
expect(page).to have_button('Undo') expect(page).to have_button('Undo')
......
...@@ -16,9 +16,9 @@ module QA ...@@ -16,9 +16,9 @@ module QA
validate_content('My First Wiki Content') validate_content('My First Wiki Content')
Page::Project::Wiki::Edit.perform(&:click_edit) Page::Project::Wiki::Edit.perform(&:click_edit)
Page::Project::Wiki::New.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Project::Wiki::New.perform do |wiki|
page.set_content("My Second Wiki Content") wiki.set_content("My Second Wiki Content")
page.save_changes wiki.save_changes
end end
validate_content('My Second Wiki Content') validate_content('My Second Wiki Content')
......
...@@ -23,10 +23,10 @@ module QA ...@@ -23,10 +23,10 @@ module QA
issue.title = 'Performance bar test' issue.title = 'Performance bar test'
end end
Page::Layout::PerformanceBar.perform do |page| # rubocop:disable QA/AmbiguousPageObjectName Page::Layout::PerformanceBar.perform do |bar_component|
expect(page).to have_performance_bar expect(bar_component).to have_performance_bar
expect(page).to have_detailed_metrics expect(bar_component).to have_detailed_metrics
expect(page).to have_request_for('realtime_changes') # Always requested on issue pages expect(bar_component).to have_request_for('realtime_changes') # Always requested on issue pages
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment