From a31bff2b784da23e6deb00cda4eac83bc771bb6c Mon Sep 17 00:00:00 2001 From: Mark Lapierre <mlapierre@gitlab.com> Date: Tue, 13 Oct 2020 13:29:25 +1100 Subject: [PATCH] Update tests to use page object predicate methods This change invoke predicate methods on page objects when tests execute certain matchers instead of using Capybara matchers. The result is that the matchers wait for requests and perform logging and other functionality that the page object predicate methods provide. --- .../3_create/repository/protocol_v2_push_http_spec.rb | 6 ++++-- .../repository/push_mirroring_lfs_over_http_spec.rb | 6 ++++-- .../3_create/repository/push_over_http_spec.rb | 6 ++++-- .../3_create/repository/pull_mirroring_over_http_spec.rb | 9 ++++++--- .../repository/pull_mirroring_over_ssh_with_key_spec.rb | 8 +++++--- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb index 8ac7285d70c64..5781bf8a7f0f1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb @@ -37,8 +37,10 @@ module QA project.wait_for_push_new_branch # Check that the push worked - expect(page).to have_content(file_name) - expect(page).to have_content(file_content) + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file(file_name) + expect(project_page).to have_readme_content(file_content) + end # And check that the correct Git protocol was used expect(git_protocol_reported).to eq(git_protocol) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb index 83945a0958704..2d86cfdbaf827 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb @@ -37,8 +37,10 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('The rendered file could not be displayed because it is stored in LFS') + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content('The rendered file could not be displayed because it is stored in LFS') + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb index 8b6973e6ceaeb..cf14017b7f192 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb @@ -36,8 +36,10 @@ module QA project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content("This is a test project named #{project.name}") + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content("This is a test project named #{project.name}") + end end end end diff --git a/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb b/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb index 366b0e861f571..e0da940cc0abe 100644 --- a/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb @@ -35,9 +35,12 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content("README.md") - expect(page).to have_content("This is a pull mirroring test project") - expect(page).to have_content("Mirrored from #{masked_url(source_project_uri)}") + + Page::Project::Show.perform do |project| + expect(project).to have_file('README.md') + expect(project).to have_readme_content('This is a pull mirroring test project') + expect(project).to have_text("Mirrored from #{masked_url(source_project_uri)}") + end end def masked_url(url) diff --git a/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_ssh_with_key_spec.rb b/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_ssh_with_key_spec.rb index b89cc7e63effc..9261eaad6b156 100644 --- a/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_ssh_with_key_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_ssh_with_key_spec.rb @@ -58,9 +58,11 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('This is a pull mirroring test project') - expect(page).to have_content("Mirrored from #{masked_url(source_project_uri)}") + Page::Project::Show.perform do |project| + expect(project).to have_file('README.md') + expect(project).to have_readme_content('This is a pull mirroring test project') + expect(project).to have_text("Mirrored from #{masked_url(source_project_uri)}") + end end def masked_url(url) -- GitLab