Commit 51a27920 authored by Nathan Friend's avatar Nathan Friend

Merge branch 'expand-stopped-env' into 'master'

Expand nested stopped environments

See merge request gitlab-org/gitlab!55676
parents b4d4dc6e bd816682
......@@ -85,7 +85,7 @@ export default {
this.store.updateEnvironmentProp(folder, 'isLoadingFolderContent', showLoader);
this.service
.getFolderContent(folder.folder_path)
.getFolderContent(folder.folder_path, folder.state)
.then((response) => this.store.setfolderContent(folder, response.data.environments))
.then(() => this.store.updateEnvironmentProp(folder, 'isLoadingFolderContent', false))
.catch(() => {
......
......@@ -21,7 +21,7 @@ export default class EnvironmentsService {
return axios.delete(endpoint, {});
}
getFolderContent(folderUrl) {
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}`);
getFolderContent(folderUrl, scope) {
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}&scope=${scope}`);
}
}
---
title: Expand nested stopped environments
merge_request: 55676
author:
type: changed
......@@ -429,37 +429,67 @@ RSpec.describe 'Environments page', :js do
end
describe 'environments folders' do
before do
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-1',
state: :available)
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-2',
state: :available)
end
describe 'available environments' do
before do
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-1',
state: :available)
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-2',
state: :available)
end
it 'users unfurls an environment folder' do
visit_environments(project)
it 'users unfurls an environment folder' do
visit_environments(project)
expect(page).not_to have_content 'review-1'
expect(page).not_to have_content 'review-2'
expect(page).to have_content 'staging 2'
expect(page).not_to have_content 'review-1'
expect(page).not_to have_content 'review-2'
expect(page).to have_content 'staging 2'
within('.folder-row') do
find('.folder-name', text: 'staging').click
end
within('.folder-row') do
find('.folder-name', text: 'staging').click
end
expect(page).to have_content 'review-1'
expect(page).to have_content 'review-2'
within('.ci-table') do
within('[data-qa-selector="environment_item"]', text: 'review-1') do
expect(find('.js-auto-stop').text).not_to be_empty
expect(page).to have_content 'review-1'
expect(page).to have_content 'review-2'
within('.ci-table') do
within('[data-qa-selector="environment_item"]', text: 'review-1') do
expect(find('.js-auto-stop').text).not_to be_empty
end
within('[data-qa-selector="environment_item"]', text: 'review-2') do
expect(find('.js-auto-stop').text).not_to be_empty
end
end
within('[data-qa-selector="environment_item"]', text: 'review-2') do
expect(find('.js-auto-stop').text).not_to be_empty
end
end
describe 'stopped environments' do
before do
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-1',
state: :stopped)
create(:environment, :will_auto_stop,
project: project,
name: 'staging/review-2',
state: :stopped)
end
it 'users unfurls an environment folder' do
visit_environments(project, scope: 'stopped')
expect(page).not_to have_content 'review-1'
expect(page).not_to have_content 'review-2'
expect(page).to have_content 'staging 2'
within('.folder-row') do
find('.folder-name', text: 'staging').click
end
expect(page).to have_content 'review-1'
expect(page).to have_content 'review-2'
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