2019-05-23 18:07:59 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-16 21:13:14 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Project variables', :js do
|
2018-01-16 21:13:14 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
2019-03-29 15:46:31 +00:00
|
|
|
let(:variable) { create(:ci_variable, key: 'test_key', value: 'test_value', masked: true) }
|
2018-01-16 21:13:14 +00:00
|
|
|
let(:page_path) { project_settings_ci_cd_path(project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2018-01-16 21:13:14 +00:00
|
|
|
project.variables << variable
|
|
|
|
visit page_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'variable list'
|
2019-08-08 18:51:52 +00:00
|
|
|
|
2020-10-27 15:08:39 +00:00
|
|
|
it 'adds a new variable with an environment scope' do
|
|
|
|
click_button('Add Variable')
|
2019-08-08 18:51:52 +00:00
|
|
|
|
2020-10-27 15:08:39 +00: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 18:51:52 +00:00
|
|
|
|
2020-10-27 15:08:39 +00:00
|
|
|
click_button('Add variable')
|
2019-08-08 18:51:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2020-10-27 15:08:39 +00: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 18:51:52 +00:00
|
|
|
end
|
|
|
|
end
|
2018-01-16 21:13:14 +00:00
|
|
|
end
|