Commit f1fbba11 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch '323418-verify-and-validate-your-terraform-modules-in-the-ui-2' into 'master'

Add details page test to infra registry feature spec

See merge request gitlab-org/gitlab!64083
parents f0019f62 e6e01c50
...@@ -38,18 +38,16 @@ RSpec.describe 'Group Packages' do ...@@ -38,18 +38,16 @@ RSpec.describe 'Group Packages' do
context 'when there are packages' do context 'when there are packages' do
let_it_be(:second_project) { create(:project, name: 'second-project', group: group) } let_it_be(:second_project) { create(:project, name: 'second-project', group: group) }
let_it_be(:conan_package) { create(:conan_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') } let_it_be(:npm_package) { create(:npm_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') }
let_it_be(:maven_package) { create(:maven_package, project: second_project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') } let_it_be(:maven_package) { create(:maven_package, project: second_project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') }
let_it_be(:packages) { [conan_package, maven_package] } let_it_be(:packages) { [npm_package, maven_package] }
it_behaves_like 'packages list', check_project_name: true it_behaves_like 'packages list', check_project_name: true
it_behaves_like 'package details link' it_behaves_like 'package details link'
it 'allows you to navigate to the project page' do it 'allows you to navigate to the project page' do
page.within('[data-qa-selector="packages-table"]') do find('[data-testid="root-link"]', text: project.name).click
find('[data-qa-selector="package-path"]', text: project.name).click
end
expect(page).to have_current_path(project_path(project)) expect(page).to have_current_path(project_path(project))
expect(page).to have_content(project.name) expect(page).to have_content(project.name)
...@@ -58,15 +56,15 @@ RSpec.describe 'Group Packages' do ...@@ -58,15 +56,15 @@ RSpec.describe 'Group Packages' do
context 'sorting' do context 'sorting' do
it_behaves_like 'shared package sorting' do it_behaves_like 'shared package sorting' do
let_it_be(:package_one) { maven_package } let_it_be(:package_one) { maven_package }
let_it_be(:package_two) { conan_package } let_it_be(:package_two) { npm_package }
end end
it_behaves_like 'correctly sorted packages list', 'Project' do it_behaves_like 'correctly sorted packages list', 'Project' do
let(:packages) { [maven_package, conan_package] } let(:packages) { [maven_package, npm_package] }
end end
it_behaves_like 'correctly sorted packages list', 'Project', ascending: true do it_behaves_like 'correctly sorted packages list', 'Project', ascending: true do
let(:packages) { [conan_package, maven_package] } let(:packages) { [npm_package, maven_package] }
end end
end end
end end
......
...@@ -28,13 +28,30 @@ RSpec.describe 'Infrastructure Registry' do ...@@ -28,13 +28,30 @@ RSpec.describe 'Infrastructure Registry' do
visit_project_infrastructure_registry visit_project_infrastructure_registry
end end
context 'when there are packages' do context 'when there are modules' do
let_it_be(:terraform_module) { create(:terraform_module_package, project: project, created_at: 1.day.ago, version: '1.0.0') } let_it_be(:terraform_module) { create(:terraform_module_package, project: project, created_at: 1.day.ago, version: '1.0.0') }
let_it_be(:terraform_module2) { create(:terraform_module_package, project: project, created_at: 2.days.ago, version: '2.0.0') } let_it_be(:terraform_module2) { create(:terraform_module_package, project: project, created_at: 2.days.ago, version: '2.0.0') }
let_it_be(:packages) { [terraform_module, terraform_module2] } let_it_be(:packages) { [terraform_module, terraform_module2] }
it_behaves_like 'packages list' it_behaves_like 'packages list'
context 'details link' do
it 'navigates to the correct url' do
page.within(packages_table_selector) do
click_link terraform_module.name
end
expect(page).to have_current_path(project_infrastructure_registry_path(terraform_module.project, terraform_module))
expect(page).to have_css('.packages-app h1[data-testid="title"]', text: terraform_module.name)
page.within(%Q([name="#{terraform_module.name}"])) do
expect(page).to have_content('Provision instructions')
expect(page).to have_content('Registry setup')
end
end
end
context 'deleting a package' do context 'deleting a package' do
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:terraform_module) { create(:terraform_module_package, project: project) } let_it_be(:terraform_module) { create(:terraform_module_package, project: project) }
......
...@@ -31,9 +31,9 @@ RSpec.describe 'Packages' do ...@@ -31,9 +31,9 @@ RSpec.describe 'Packages' do
end end
context 'when there are packages' do context 'when there are packages' do
let_it_be(:conan_package) { create(:conan_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') } let_it_be(:npm_package) { create(:npm_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') }
let_it_be(:maven_package) { create(:maven_package, project: project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') } let_it_be(:maven_package) { create(:maven_package, project: project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') }
let_it_be(:packages) { [conan_package, maven_package] } let_it_be(:packages) { [npm_package, maven_package] }
it_behaves_like 'packages list' it_behaves_like 'packages list'
...@@ -54,7 +54,7 @@ RSpec.describe 'Packages' do ...@@ -54,7 +54,7 @@ RSpec.describe 'Packages' do
it_behaves_like 'shared package sorting' do it_behaves_like 'shared package sorting' do
let_it_be(:package_one) { maven_package } let_it_be(:package_one) { maven_package }
let_it_be(:package_two) { conan_package } let_it_be(:package_two) { npm_package }
end end
end end
......
...@@ -32,11 +32,9 @@ RSpec.shared_examples 'package details link' do |property| ...@@ -32,11 +32,9 @@ RSpec.shared_examples 'package details link' do |property|
expect(page).to have_current_path(project_package_path(package.project, package)) expect(page).to have_current_path(project_package_path(package.project, package))
page.within('[data-qa-selector="package_title"]') do expect(page).to have_css('.packages-app h1[data-testid="title"]', text: package.name)
expect(page).to have_content(package.name)
end
page.within('[data-qa-selector="package_information_content"]') do page.within(%Q([name="#{package.name}"])) do
expect(page).to have_content('Installation') expect(page).to have_content('Installation')
expect(page).to have_content('Registry setup') expect(page).to have_content('Registry setup')
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