Commit bd816682 authored by Minh Nguyen's avatar Minh Nguyen Committed by Nathan Friend

Expand nested stopped environments

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