diff --git a/app/assets/javascripts/ci/ci_variable_list/constants.js b/app/assets/javascripts/ci/ci_variable_list/constants.js index 3966489e3c166c25d7ef5311e654338802f12fd5..7900636384436200f5ae7b6dfdabfacc25b30c97 100644 --- a/app/assets/javascripts/ci/ci_variable_list/constants.js +++ b/app/assets/javascripts/ci/ci_variable_list/constants.js @@ -35,7 +35,7 @@ export const defaultVariableState = { masked: true, hidden: false, protected: false, - raw: false, + raw: true, value: '', variableType: variableTypes.envType, }; diff --git a/app/assets/javascripts/ci/ci_variable_list/index.js b/app/assets/javascripts/ci/ci_variable_list/index.js index ad3e81423c982489df8e1e9b109580320b91aad3..df2c9aa22d153daa7340a4a456e1bce8b7d26a9d 100644 --- a/app/assets/javascripts/ci/ci_variable_list/index.js +++ b/app/assets/javascripts/ci/ci_variable_list/index.js @@ -10,7 +10,6 @@ import { generateCacheConfig, resolvers } from './graphql/settings'; const mountCiVariableListApp = (containerEl) => { const { - containsVariableReferenceLink, endpoint, groupId, groupPath, @@ -52,7 +51,6 @@ const mountCiVariableListApp = (containerEl) => { el: containerEl, apolloProvider, provide: { - containsVariableReferenceLink, endpoint, groupId, groupPath, diff --git a/app/views/ci/variables/_index.html.haml b/app/views/ci/variables/_index.html.haml index e2a074df051d479b86a101ab46d3aac4ea7b3c4d..dd032d9d49dd4abe6b503b590267d3bbcb4fbe21 100644 --- a/app/views/ci/variables/_index.html.haml +++ b/app/views/ci/variables/_index.html.haml @@ -27,7 +27,6 @@ maskable_raw_regex: ci_variable_maskable_raw_regex, maskable_regex: ci_variable_maskable_regex, protected_by_default: ci_variable_protected_by_default?.to_s, - contains_variable_reference_link: help_page_path('ci/variables/_index.md', anchor: 'prevent-cicd-variable-expansion'), masked_environment_variables_link: help_page_path('ci/variables/_index.md', anchor: 'mask-a-cicd-variable') } } - if !@group && @project.group diff --git a/doc/api/group_level_variables.md b/doc/api/group_level_variables.md index a565eabcd5ceb3edd89f617bfc08817f8bbb05b5..d4f76a9c1514c79fbde25296f50ea4168e6a7a8c 100644 --- a/doc/api/group_level_variables.md +++ b/doc/api/group_level_variables.md @@ -125,7 +125,7 @@ POST /groups/:id/variables | `masked` | boolean | No | Whether the variable is masked. | | `masked_and_hidden` | boolean | No | Whether the variable is masked and hidden. Default: `false` | | `protected` | boolean | No | Whether the variable is protected. | -| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/_index.md#prevent-cicd-variable-expansion). | +| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `true`. When `false`, variables in the value are [expanded](../ci/variables/_index.md#allow-cicd-variable-expansion). | | `variable_type` | string | No | The type of a variable. Available types are: `env_var` (default) and `file`. | ```shell @@ -175,7 +175,7 @@ PUT /groups/:id/variables/:key | `filter` | hash | No | Available filters: `[environment_scope]`. See the [`filter` parameter details](#the-filter-parameter). | | `masked` | boolean | No | Whether the variable is masked | | `protected` | boolean | No | Whether the variable is protected | -| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/_index.md#prevent-cicd-variable-expansion). | +| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `true`. When `false`, variables in the value are [expanded](../ci/variables/_index.md#allow-cicd-variable-expansion). | | `variable_type` | string | No | The type of a variable. Available types are: `env_var` (default) and `file` | ```shell diff --git a/doc/api/project_level_variables.md b/doc/api/project_level_variables.md index b98dffdabfd0bd70bbff6e25761223d7cc667453..83595efa6ee624b623db5e7483a62ab0dc95e554 100644 --- a/doc/api/project_level_variables.md +++ b/doc/api/project_level_variables.md @@ -125,7 +125,7 @@ POST /projects/:id/variables | `masked` | boolean | No | Whether the variable is masked. Default: `false` | | `masked_and_hidden` | boolean | No | Whether the variable is masked and hidden. Default: `false` | | `protected` | boolean | No | Whether the variable is protected. Default: `false` | -| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/_index.md#prevent-cicd-variable-expansion). | +| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `true`. When `false`, variables in the value are [expanded](../ci/variables/_index.md#allow-cicd-variable-expansion). | | `variable_type` | string | No | The type of a variable. Available types are: `env_var` (default) and `file` | Example request: @@ -170,7 +170,7 @@ PUT /projects/:id/variables/:key | `filter` | hash | No | Available filters: `[environment_scope]`. See the [`filter` parameter details](#the-filter-parameter). | | `masked` | boolean | No | Whether the variable is masked | | `protected` | boolean | No | Whether the variable is protected | -| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `false`. When `true`, variables in the value are not [expanded](../ci/variables/_index.md#prevent-cicd-variable-expansion). | +| `raw` | boolean | No | Whether the variable is treated as a raw string. Default: `true`. When `false`, variables in the value are [expanded](../ci/variables/_index.md#allow-cicd-variable-expansion). | | `variable_type` | string | No | The type of a variable. Available types are: `env_var` (default) and `file` | Example request: diff --git a/doc/ci/jobs/job_control.md b/doc/ci/jobs/job_control.md index 2ce758efd3a2b67dabf9bae21554ff75c9737b68..b56b2fb861bc94198b32740a5f630a566924b9b1 100644 --- a/doc/ci/jobs/job_control.md +++ b/doc/ci/jobs/job_control.md @@ -90,7 +90,7 @@ Consider this visibility when entering sensitive information as manual job varia If you add a variable that is already defined in the CI/CD settings or `.gitlab-ci.yml` file, the [variable is overridden](../variables/_index.md#use-pipeline-variables) with the new value. -Any variables overridden by using this process are [expanded](../variables/_index.md#prevent-cicd-variable-expansion) +Any variables overridden by using this process are [expanded](../variables/_index.md#allow-cicd-variable-expansion) and not [masked](../variables/_index.md#mask-a-cicd-variable). #### Retry a manual job with updated variables diff --git a/doc/ci/pipelines/_index.md b/doc/ci/pipelines/_index.md index 20fc3b86786b5d3e69f662976771cc6080d5e1a9..6a1c065674836315a1f44f1990e4bac4c7eabf48 100644 --- a/doc/ci/pipelines/_index.md +++ b/doc/ci/pipelines/_index.md @@ -170,7 +170,7 @@ that have a `description` defined in the `.gitlab-ci.yml` file. The description below the variable. You can change the prefilled value, which [overrides the value](../variables/_index.md#use-pipeline-variables) for that single pipeline run. -Any variables overridden by using this process are [expanded](../variables/_index.md#prevent-cicd-variable-expansion) +Any variables overridden by using this process are [expanded](../variables/_index.md#allow-cicd-variable-expansion) and not [masked](../variables/_index.md#mask-a-cicd-variable). If you do not define a `value` for the variable in the configuration file, the variable name is still listed, but the value field is blank. diff --git a/doc/ci/pipelines/downstream_pipelines_troubleshooting.md b/doc/ci/pipelines/downstream_pipelines_troubleshooting.md index 5968629c496109f1de20af21bfe6767ecb16c464..a925c128daa63d8df3118bf255893e42aa8e59b4 100644 --- a/doc/ci/pipelines/downstream_pipelines_troubleshooting.md +++ b/doc/ci/pipelines/downstream_pipelines_troubleshooting.md @@ -38,7 +38,7 @@ You cannot use [`$$` to escape the `$` character in a CI/CD variable](../variabl when [passing a CI/CD variable to a downstream pipeline](downstream_pipelines.md#pass-cicd-variables-to-a-downstream-pipeline). The downstream pipeline still treats the `$` as the start of a variable reference. -You can [Prevent CI/CD variable expansion](../variables/_index.md#prevent-cicd-variable-expansion) when configuring +You can [Prevent CI/CD variable expansion](../variables/_index.md#allow-cicd-variable-expansion) when configuring a variable in the UI, or use the [`variables:expand` keyword](../yaml/_index.md#variablesexpand) to set a variable value to not be expanded. This variable can then be passed to the downstream pipeline without the `$` being interpreted as a variable reference. diff --git a/doc/ci/variables/_index.md b/doc/ci/variables/_index.md index 501aecb38999959d482f4e0253d1fba6388e21f6..3418d2c2ba8c0cdd329e29ee78f6a6f88c2f59ed 100644 --- a/doc/ci/variables/_index.md +++ b/doc/ci/variables/_index.md @@ -132,13 +132,17 @@ To add or update variables in the project settings: 1. Expand **Variables**. 1. Select **Add variable** and fill in the details: - **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`. - - **Value**: No limitations. + - **Value**: The value is limited to 10,000 characters, but also bounded by any limits in the + runner's operating system. The value has extra limitations if **Visibility** is set to **Masked** + or **Masked and hidden**. - **Type**: `Variable` (default) or [`File`](#use-file-type-cicd-variables). - **Environment scope**: Optional. **All (default)** (`*`), a specific [environment](../environments/_index.md), or a wildcard environment scope. - **Protect variable** Optional. If selected, the variable is only available in pipelines that run on protected branches or tags. - **Visibility**: Select **Visible** (default), **Masked**, or **Masked and hidden**. + - **Expand variable reference**: Optional. If selected, the variable can reference another variable. + It is not possible to reference another variable if **Visibility** is set to **Masked** or **Masked and hidden**. Alternatively, project variables can be added [by using the API](../../api/project_level_variables.md). @@ -157,11 +161,15 @@ To add a group variable: 1. Expand **Variables**. 1. Select **Add variable** and fill in the details: - **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`. - - **Value**: No limitations. + - **Value**: The value is limited to 10,000 characters, but also bounded by any limits in the + runner's operating system. The value has extra limitations if **Visibility** is set to **Masked** + or **Masked and hidden**. - **Type**: `Variable` (default) or [`File`](#use-file-type-cicd-variables). - **Protect variable** Optional. If selected, the variable is only available in pipelines that run on protected branches or tags. - **Visibility**: Select **Visible** (default), **Masked**, **Masked and hidden**. + - **Expand variable reference**: Optional. If selected, the variable can reference another variable. + It is not possible to reference another variable if **Visibility** is set to **Masked** or **Masked and hidden**. The group variables that are available in a project are listed in the project's **Settings > CI/CD > Variables** section. Variables from subgroups are recursively inherited. @@ -208,11 +216,13 @@ To add an instance variable: 1. Select **Add variable** and fill in the details: - **Key**: Must be one line, with no spaces, using only letters, numbers, or `_`. - **Value**: The value is limited to 10,000 characters, but also bounded by any limits in the - runner's operating system. + runner's operating system. No other limitations if **Visibility** set to **Visible**. - **Type**: `Variable` (default) or `File`. - **Protect variable** Optional. If selected, the variable is only available in pipelines that run on protected branches or tags. - **Visibility**: Select **Visible** (default), **Masked**, or **Masked and hidden**. + - **Expand variable reference**: Optional. If selected, the variable can reference another variable. + It is not possible to reference another variable if **Visibility** is set to **Masked** or **Masked and hidden**. Alternatively, instance variables can be added [by using the API](../../api/instance_level_ci_variables.md). @@ -282,6 +292,10 @@ To mask a variable: 1. Expand **Variables**. 1. Next to the variable you want to protect, select **Edit**. 1. Under **Visibility**, select **Mask variable**. +1. Recommended. Clear the [**Expand variable reference**](#allow-cicd-variable-expansion) checkbox. + If variable expansion is enabled, the only non-alphanumeric characters you can use in + the variable value are: `_`, `:`, `@`, `-`, `+`, `.`, `~`, `=`, `/`, and `~`. + When the setting is disabled, all characters can be used. 1. Select **Update variable**. The value of the variable must: @@ -402,26 +416,40 @@ job: - mytool --url-file="site-url.txt" ``` -## Prevent CI/CD variable expansion +## Allow CI/CD variable expansion + +{{< history >}} + +- **Expand variable** option [renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/410414) to **Expand variable reference** in GitLab 16.3. +- [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/209144) to disabled by default in GitLab 18.6. + +{{< /history >}} + +You can set a variable to treat values with the `$` character as a reference to another variable. +When the pipeline runs, the reference expands to use the value of the referenced variable. -Expanded variables treat values with the `$` character as a reference to another variable. -CI/CD variables are expanded by default. To treat variables with a `$` character as raw strings, -disable variable expansion for the variable. +CI/CD variables defined in the UI are not expanded by default. For CI/CD variables defined in +the `.gitlab-ci.yml` file, control variable expansion with the [`variables:expand` keyword](../yaml/_index.md#variablesexpand). Prerequisites: - You must have the same role or access level as required to [add a CI/CD variable in the UI](#define-a-cicd-variable-in-the-ui). -To disable variable expansion for the variable: +To enable variable expansion for the variable: 1. For the project or group, go to **Settings** > **CI/CD**. 1. Expand **Variables**. 1. Next to the variable you want to do not want expanded, select **Edit**. -1. Clear the **Expand variable** checkbox. +1. Select the **Expand variable reference** checkbox. 1. Select **Update variable**. -If the variable is also masked, the value cannot contain the `$` character, -so variable expansion is not possible with masked variables. +{{< alert type="note" >}} + +Do not [mask](#mask-a-cicd-variable) a variable value if you want to use variable expansion. +If both masking and variable expansion are combined, character limitations prevent +the use of the `$` to reference other variables. + +{{< /alert >}} ## CI/CD variable precedence diff --git a/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js b/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js index 93cbd2d2b2310add37e7c137d6bf4508ca1ea3a5..53f360b3d40ee4ca501138a7bca7be4d03821a5b 100644 --- a/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js +++ b/spec/frontend/ci/ci_variable_list/components/ci_variable_drawer_spec.js @@ -59,6 +59,7 @@ describe('CI Variable Drawer', () => { hideEnvironmentScope: false, selectedVariable: {}, mode: ADD_VARIABLE_ACTION, + raw: true, }; const defaultProvide = { @@ -480,24 +481,24 @@ describe('CI Variable Drawer', () => { createComponent(); }); - it('is true by default when adding a variable', () => { - expect(findExpandedCheckbox().attributes('checked')).toBeDefined(); + it('is false by default when adding a variable', () => { + expect(findExpandedCheckbox().attributes('checked')).toBeUndefined(); }); it('inherits value of selected variable when editing', () => { createComponent({ props: { - selectedVariable: mockProjectVariableFileType, + selectedVariable: mockProjectVariable, mode: EDIT_VARIABLE_ACTION, }, }); - expect(findExpandedCheckbox().attributes('checked')).toBeUndefined(); + expect(findExpandedCheckbox().attributes('checked')).toBe('true'); }); it("sets the variable's raw value", async () => { findKeyField().vm.$emit('input', 'NEW_VARIABLE'); - findExpandedCheckbox().vm.$emit('change'); + findExpandedCheckbox().vm.$emit('change', true); findConfirmBtn().vm.$emit('click'); await nextTick(); @@ -507,20 +508,23 @@ describe('CI Variable Drawer', () => { }); it('shows help text when variable is not expanded (will be evaluated as raw)', async () => { - expect(findExpandedCheckbox().attributes('checked')).toBeDefined(); - expect(findDrawer().text()).not.toContain( - 'Variable value will be evaluated as raw string.', - ); + expect(findExpandedCheckbox().attributes('checked')).toBeUndefined(); + expect(findDrawer().text()).toContain('Variable value will be evaluated as raw string.'); - findExpandedCheckbox().vm.$emit('change'); + findExpandedCheckbox().vm.$emit('change', true); await nextTick(); - expect(findExpandedCheckbox().attributes('checked')).toBeUndefined(); - expect(findDrawer().text()).toContain('Variable value will be evaluated as raw string.'); + expect(findExpandedCheckbox().attributes('checked')).toBeDefined(); + expect(findDrawer().text()).not.toContain( + 'Variable value will be evaluated as raw string.', + ); }); it('shows help text when variable is expanded and contains the $ character', async () => { + findExpandedCheckbox().vm.$emit('change', true); + await nextTick(); + expect(findDrawer().text()).not.toContain( 'Unselect "Expand variable reference" if you want to use the variable value as a raw string.', ); @@ -609,22 +613,29 @@ describe('CI Variable Drawer', () => { }; describe.each` - value | canSubmit | trackingErrorProperty | validationIssueKey - ${'secretValue'} | ${true} | ${null} | ${''} - ${'~v@lid:symbols.'} | ${true} | ${null} | ${''} - ${invalidValues.short} | ${false} | ${null} | ${'short'} - ${invalidValues.multiLine} | ${false} | ${'\n'} | ${'multiLine'} - ${'dollar$ign'} | ${false} | ${'$'} | ${'unsupportedDollarChar'} - ${invalidValues.unsupportedChar} | ${false} | ${'|'} | ${'unsupportedChar'} - ${invalidValues.twoUnsupportedChars} | ${false} | ${'|!'} | ${'twoUnsupportedChars'} - ${invalidValues.threeUnsupportedChars} | ${false} | ${'%|!'} | ${'threeUnsupportedChars'} - ${invalidValues.shortAndMultiLine} | ${false} | ${'\n'} | ${'shortAndMultiLine'} - ${invalidValues.shortAndUnsupportedChar} | ${false} | ${'!'} | ${'shortAndUnsupportedChar'} - ${invalidValues.shortAndMultiLineAndUnsupportedChar} | ${false} | ${'\n!'} | ${'shortAndMultiLineAndUnsupportedChar'} - ${invalidValues.multiLineAndUnsupportedChar} | ${false} | ${'\n!'} | ${'multiLineAndUnsupportedChar'} + value | canSubmit | expanded | trackingErrorProperty | validationIssueKey + ${'secretValue'} | ${true} | ${false} | ${null} | ${''} + ${'~v@lid:symbols.'} | ${true} | ${false} | ${null} | ${''} + ${'dollar$ign'} | ${true} | ${false} | ${null} | ${''} + ${'dollar$ign'} | ${false} | ${true} | ${'$'} | ${'unsupportedDollarChar'} + ${invalidValues.short} | ${false} | ${false} | ${null} | ${'short'} + ${invalidValues.multiLine} | ${false} | ${false} | ${'\n'} | ${'multiLine'} + ${invalidValues.unsupportedChar} | ${true} | ${false} | ${null} | ${''} + ${invalidValues.unsupportedChar} | ${false} | ${true} | ${'|'} | ${'unsupportedChar'} + ${invalidValues.twoUnsupportedChars} | ${true} | ${false} | ${null} | ${''} + ${invalidValues.twoUnsupportedChars} | ${false} | ${true} | ${'|!'} | ${'twoUnsupportedChars'} + ${invalidValues.threeUnsupportedChars} | ${true} | ${false} | ${null} | ${''} + ${invalidValues.threeUnsupportedChars} | ${false} | ${true} | ${'%|!'} | ${'threeUnsupportedChars'} + ${invalidValues.shortAndMultiLine} | ${false} | ${false} | ${'\n'} | ${'shortAndMultiLine'} + ${invalidValues.shortAndUnsupportedChar} | ${false} | ${false} | ${null} | ${'short'} + ${invalidValues.shortAndUnsupportedChar} | ${false} | ${true} | ${'!'} | ${'shortAndUnsupportedChar'} + ${invalidValues.shortAndMultiLineAndUnsupportedChar} | ${false} | ${false} | ${'\n'} | ${'shortAndMultiLine'} + ${invalidValues.shortAndMultiLineAndUnsupportedChar} | ${false} | ${true} | ${'\n'} | ${'shortAndMultiLineAndUnsupportedChar'} + ${invalidValues.multiLineAndUnsupportedChar} | ${false} | ${false} | ${'\n'} | ${'multiLine'} + ${invalidValues.multiLineAndUnsupportedChar} | ${false} | ${true} | ${'\n'} | ${'multiLineAndUnsupportedChar'} `( 'masking requirements', - ({ value, canSubmit, trackingErrorProperty, validationIssueKey }) => { + ({ value, canSubmit, expanded, trackingErrorProperty, validationIssueKey }) => { beforeEach(() => { createComponent({ mountFn: mountExtended }); @@ -632,9 +643,11 @@ describe('CI Variable Drawer', () => { findKeyField().vm.$emit('input', 'NEW_VARIABLE'); findValueField().vm.$emit('input', value); findVisibilityRadioGroup().vm.$emit('change', VISIBILITY_MASKED); + + findExpandedCheckbox().setChecked(expanded); }); - itif(canSubmit)(`can submit when value is ${value}`, () => { + itif(canSubmit)(`can submit when value is ${value} and expanded=${expanded}`, () => { /* eslint-disable jest/no-standalone-expect */ expect(findInvalidMaskedValueErrorList().text()).toBe(''); expect(findConfirmBtn().attributes('disabled')).toBeUndefined(); @@ -642,7 +655,7 @@ describe('CI Variable Drawer', () => { }); itif(!canSubmit)( - `shows validation errors and disables submit button when value is ${value}`, + `shows validation errors and disables submit button when value is ${value} and expanded=${expanded}`, () => { const validationIssueText = maskedValidationIssuesText[validationIssueKey] || ''; const errorText = findInvalidMaskedValueErrorsWrapper().text(); @@ -655,7 +668,7 @@ describe('CI Variable Drawer', () => { ); itif(trackingErrorProperty)( - `sends the correct variable validation tracking event when value is ${value}`, + `sends the correct variable validation tracking event when value is ${value} and expanded=${expanded}`, () => { /* eslint-disable jest/no-standalone-expect */ expect(trackingSpy).toHaveBeenCalledTimes(1); @@ -668,7 +681,7 @@ describe('CI Variable Drawer', () => { ); itif(!trackingErrorProperty)( - `does not send the the correct variable validation tracking event when value is ${value}`, + `does not send the the correct variable validation tracking event when value is ${value} and expanded=${expanded}`, () => { // eslint-disable-next-line jest/no-standalone-expect expect(trackingSpy).toHaveBeenCalledTimes(0); @@ -681,6 +694,7 @@ describe('CI Variable Drawer', () => { trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn); findKeyField().vm.$emit('input', 'NEW_VARIABLE'); findVisibilityRadioGroup().vm.$emit('change', VISIBILITY_MASKED); + findExpandedCheckbox().vm.$emit('change', true); await nextTick(); @@ -705,6 +719,7 @@ describe('CI Variable Drawer', () => { findKeyField().vm.$emit('input', 'NEW_VARIABLE'); findValueField().vm.$emit('input', '~v@lid:symbols.'); findVisibilityRadioGroup().vm.$emit('change', VISIBILITY_HIDDEN); + findExpandedCheckbox().setChecked(true); await nextTick(); @@ -773,7 +788,7 @@ describe('CI Variable Drawer', () => { findDescriptionField().vm.$emit('input', 'NEW_DESCRIPTION'); findKeyField().vm.$emit('input', 'NEW_VARIABLE'); findProtectedCheckbox().vm.$emit('input', false); - findExpandedCheckbox().vm.$emit('input', true); + findExpandedCheckbox().vm.$emit('change', true); findVisibilityRadioGroup().vm.$emit('change', VISIBILITY_MASKED); findValueField().vm.$emit('input', 'NEW_VALUE'); findConfirmBtn().vm.$emit('click'); diff --git a/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb b/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb index e07d4d8d487c7cc5ee3d992b554b9a1ae32a2e78..1d66c17fd66825e8d823c78a66b4e06d6a649f9b 100644 --- a/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb +++ b/spec/support/shared_examples/features/variable_list_drawer_shared_examples.rb @@ -50,10 +50,10 @@ end end - it 'defaults to masked, expanded' do + it 'defaults to masked, not expanded' do open_drawer - fill_variable('NEW_KEY') + fill_variable('NEW_KEY', 'NEW_VALUE') click_add_variable wait_for_requests @@ -62,7 +62,7 @@ key_column = first(".js-ci-variable-row:nth-child(1) td[data-label='#{s_('CiVariables|Key')}']") expect(key_column).to have_content(s_('CiVariables|Masked')) - expect(key_column).to have_content(s_('CiVariables|Expanded')) + expect(key_column).not_to have_content(s_('CiVariables|Expanded')) end end @@ -196,6 +196,7 @@ open_drawer set_masked + toggle_expanded fill_variable('EMPTY_MASK_KEY', '???') expect(page).to have_content('The value cannot contain the following characters: ?.')