2019-05-23 14:07:59 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-16 16:13:14 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Project variables', :js do
|
2018-01-16 16:13:14 -05:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
2019-03-29 11:46:31 -04:00
|
|
|
let(:variable) { create(:ci_variable, key: 'test_key', value: 'test_value', masked: true) }
|
2018-01-16 16:13:14 -05:00
|
|
|
let(:page_path) { project_settings_ci_cd_path(project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2018-01-16 16:13:14 -05:00
|
|
|
project.variables << variable
|
|
|
|
visit page_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'variable list'
|
2019-08-08 14:51:52 -04:00
|
|
|
|
2020-10-27 11:08:39 -04:00
|
|
|
it 'adds a new variable with an environment scope' do
|
|
|
|
click_button('Add Variable')
|
2019-08-08 14:51:52 -04:00
|
|
|
|
2020-10-27 11:08:39 -04:00
|
|
|
page.within('#add-ci-variable') do
|
|
|
|
find('[data-qa-selector="ci_variable_key_field"] input').set('akey')
|
|
|
|
find('#ci-variable-value').set('akey_value')
|
|
|
|
find('[data-testid="environment-scope"]').click
|
|
|
|
find_button('clear').click
|
|
|
|
find('[data-testid="ci-environment-search"]').set('review/*')
|
|
|
|
find('[data-testid="create-wildcard-button"]').click
|
2019-08-08 14:51:52 -04:00
|
|
|
|
2020-10-27 11:08:39 -04:00
|
|
|
click_button('Add variable')
|
2019-08-08 14:51:52 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2020-10-27 11:08:39 -04:00
|
|
|
page.within('.ci-variable-table') do
|
|
|
|
expect(find('.js-ci-variable-row:first-child [data-label="Environments"]').text).to eq('review/*')
|
2019-08-08 14:51:52 -04:00
|
|
|
end
|
|
|
|
end
|
2018-01-16 16:13:14 -05:00
|
|
|
end
|