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