summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/content_editor/components/toolbar_button_spec.js2
-rw-r--r--spec/frontend/editor/schema/ci/ci_schema_spec.js4
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules_needs.yml46
-rw-r--r--spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules_needs.yml32
-rw-r--r--spec/frontend/environments/environment_details/deployments_table_spec.js58
-rw-r--r--spec/frontend/fixtures/environments.rb2
-rw-r--r--spec/frontend/vue_shared/components/web_ide_link_spec.js150
7 files changed, 144 insertions, 150 deletions
diff --git a/spec/frontend/content_editor/components/toolbar_button_spec.js b/spec/frontend/content_editor/components/toolbar_button_spec.js
index 1556f761682..ffe1ae20ee9 100644
--- a/spec/frontend/content_editor/components/toolbar_button_spec.js
+++ b/spec/frontend/content_editor/components/toolbar_button_spec.js
@@ -81,7 +81,7 @@ describe('content_editor/components/toolbar_button', () => {
await emitEditorEvent({ event: 'transaction', tiptapEditor });
- expect(findButton().classes().includes('active')).toBe(outcome);
+ expect(findButton().classes().includes('gl-bg-gray-100!')).toBe(outcome);
expect(tiptapEditor.isActive).toHaveBeenCalledWith(CONTENT_TYPE);
},
);
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js
index 87208ec7aa8..51fcf26c39a 100644
--- a/spec/frontend/editor/schema/ci/ci_schema_spec.js
+++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js
@@ -27,6 +27,7 @@ import CacheYaml from './yaml_tests/positive_tests/cache.yml';
import FilterYaml from './yaml_tests/positive_tests/filter.yml';
import IncludeYaml from './yaml_tests/positive_tests/include.yml';
import RulesYaml from './yaml_tests/positive_tests/rules.yml';
+import RulesNeedsYaml from './yaml_tests/positive_tests/rules_needs.yml';
import ProjectPathYaml from './yaml_tests/positive_tests/project_path.yml';
import VariablesYaml from './yaml_tests/positive_tests/variables.yml';
import JobWhenYaml from './yaml_tests/positive_tests/job_when.yml';
@@ -46,6 +47,7 @@ import ProjectPathIncludeLeadSlashYaml from './yaml_tests/negative_tests/project
import ProjectPathIncludeNoSlashYaml from './yaml_tests/negative_tests/project_path/include/no_slash.yml';
import ProjectPathIncludeTailSlashYaml from './yaml_tests/negative_tests/project_path/include/tailing_slash.yml';
import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml';
+import RulesNeedsNegativeYaml from './yaml_tests/negative_tests/rules_needs.yml';
import TriggerNegative from './yaml_tests/negative_tests/trigger.yml';
import VariablesInvalidOptionsYaml from './yaml_tests/negative_tests/variables/invalid_options.yml';
import VariablesInvalidSyntaxDescYaml from './yaml_tests/negative_tests/variables/invalid_syntax_desc.yml';
@@ -88,6 +90,7 @@ describe('positive tests', () => {
JobWhenYaml,
HooksYaml,
RulesYaml,
+ RulesNeedsYaml,
VariablesYaml,
ProjectPathYaml,
IdTokensYaml,
@@ -121,6 +124,7 @@ describe('negative tests', () => {
IncludeNegativeYaml,
JobWhenNegativeYaml,
RulesNegativeYaml,
+ RulesNeedsNegativeYaml,
TriggerNegative,
VariablesInvalidOptionsYaml,
VariablesInvalidSyntaxDescYaml,
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules_needs.yml b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules_needs.yml
new file mode 100644
index 00000000000..f2f1eb118f8
--- /dev/null
+++ b/spec/frontend/editor/schema/ci/yaml_tests/negative_tests/rules_needs.yml
@@ -0,0 +1,46 @@
+# invalid rules:needs
+lint_job:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+
+# invalid rules:needs
+lint_job_2:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs: [20]
+
+# invalid rules:needs
+lint_job_3:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+ - job:
+
+# invalid rules:needs
+lint_job_5:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+ - pipeline: 5
+
+# invalid rules:needs
+lint_job_6:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+ - project: namespace/group/project-name
+
+# invalid rules:needs
+lint_job_7:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+ - pipeline: 5
+ job: lint_job_6
diff --git a/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules_needs.yml b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules_needs.yml
new file mode 100644
index 00000000000..a4a5183dcf4
--- /dev/null
+++ b/spec/frontend/editor/schema/ci/yaml_tests/positive_tests/rules_needs.yml
@@ -0,0 +1,32 @@
+# valid workflow:rules:needs
+pre_lint_job:
+ script: exit 0
+ rules:
+ - if: $var == null
+
+lint_job:
+ script: exit 0
+ rules:
+ - if: $var == null
+
+rspec_job:
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs: [lint_job]
+
+job:
+ needs: [rspec_job]
+ script: exit 0
+ rules:
+ - if: $var == null
+ needs:
+ - job: lint_job
+ artifacts: false
+ optional: true
+ - job: pre_lint_job
+ artifacts: true
+ optional: false
+ - rspec_job
+ - if: $var == true
+ needs: [lint_job, pre_lint_job] \ No newline at end of file
diff --git a/spec/frontend/environments/environment_details/deployments_table_spec.js b/spec/frontend/environments/environment_details/deployments_table_spec.js
new file mode 100644
index 00000000000..7dad5617383
--- /dev/null
+++ b/spec/frontend/environments/environment_details/deployments_table_spec.js
@@ -0,0 +1,58 @@
+import resolvedEnvironmentDetails from 'test_fixtures/graphql/environments/graphql/queries/environment_details.query.graphql.json';
+import { mountExtended } from 'helpers/vue_test_utils_helper';
+import Commit from '~/vue_shared/components/commit.vue';
+import DeploymentStatusLink from '~/environments/environment_details/components/deployment_status_link.vue';
+import DeploymentJob from '~/environments/environment_details/components/deployment_job.vue';
+import DeploymentTriggerer from '~/environments/environment_details/components/deployment_triggerer.vue';
+import DeploymentActions from '~/environments/environment_details/components/deployment_actions.vue';
+import DeploymentsTable from '~/environments/environment_details/deployments_table.vue';
+import { convertToDeploymentTableRow } from '~/environments/helpers/deployment_data_transformation_helper';
+
+const { environment } = resolvedEnvironmentDetails.data.project;
+const deployments = environment.deployments.nodes.map((d) =>
+ convertToDeploymentTableRow(d, environment),
+);
+
+describe('~/environments/environment_details/index.vue', () => {
+ let wrapper;
+
+ const createWrapper = (propsData = {}) => {
+ wrapper = mountExtended(DeploymentsTable, {
+ propsData: {
+ deployments,
+ ...propsData,
+ },
+ });
+ };
+
+ describe('deployment row', () => {
+ const [, , deployment] = deployments;
+
+ let row;
+
+ beforeEach(() => {
+ createWrapper();
+
+ row = wrapper.find('tr:nth-child(3)');
+ });
+
+ it.each`
+ cell | component | props
+ ${'status'} | ${DeploymentStatusLink} | ${{ deploymentJob: deployment.job, status: deployment.status }}
+ ${'triggerer'} | ${DeploymentTriggerer} | ${{ triggerer: deployment.triggerer }}
+ ${'commit'} | ${Commit} | ${deployment.commit}
+ ${'job'} | ${DeploymentJob} | ${{ job: deployment.job }}
+ ${'created date'} | ${'[data-testid="deployment-created-at"]'} | ${{ time: deployment.created }}
+ ${'deployed date'} | ${'[data-testid="deployment-deployed-at"]'} | ${{ time: deployment.deployed }}
+ ${'deployment actions'} | ${DeploymentActions} | ${{ actions: deployment.actions, rollback: deployment.rollback, approvalEnvironment: deployment.deploymentApproval }}
+ `('should show the correct component for $cell', ({ component, props }) => {
+ expect(row.findComponent(component).props()).toMatchObject(props);
+ });
+
+ it('hides the deployed at timestamp for not-finished deployments', () => {
+ row = wrapper.find('tr');
+
+ expect(row.find('[data-testid="deployment-deployed-at"]').exists()).toBe(false);
+ });
+ });
+});
diff --git a/spec/frontend/fixtures/environments.rb b/spec/frontend/fixtures/environments.rb
index 77e2a96b328..81f1eb11e3e 100644
--- a/spec/frontend/fixtures/environments.rb
+++ b/spec/frontend/fixtures/environments.rb
@@ -44,7 +44,7 @@ RSpec.describe 'Environments (JavaScript fixtures)', feature_category: :environm
end
let_it_be(:deployment_success) do
- create(:deployment, :success, environment: environment, deployable: build)
+ create(:deployment, :success, environment: environment, deployable: build, finished_at: 1.hour.since)
end
let_it_be(:deployment_failed) do
diff --git a/spec/frontend/vue_shared/components/web_ide_link_spec.js b/spec/frontend/vue_shared/components/web_ide_link_spec.js
index 4b2ce24a49f..d888abc19ef 100644
--- a/spec/frontend/vue_shared/components/web_ide_link_spec.js
+++ b/spec/frontend/vue_shared/components/web_ide_link_spec.js
@@ -1,4 +1,4 @@
-import { GlButton, GlLink, GlModal, GlPopover } from '@gitlab/ui';
+import { GlButton, GlModal } from '@gitlab/ui';
import { nextTick } from 'vue';
import ActionsButton from '~/vue_shared/components/actions_button.vue';
@@ -9,7 +9,6 @@ import WebIdeLink, {
PREFERRED_EDITOR_KEY,
} from '~/vue_shared/components/web_ide_link.vue';
import ConfirmForkModal from '~/vue_shared/components/confirm_fork_modal.vue';
-import UserCalloutDismisser from '~/vue_shared/components/user_callout_dismisser.vue';
import { KEY_WEB_IDE } from '~/vue_shared/components/constants';
import { stubComponent } from 'helpers/stub_component';
@@ -95,14 +94,7 @@ describe('Web IDE link component', () => {
let wrapper;
- function createComponent(
- props,
- {
- mountFn = shallowMountExtended,
- glFeatures = {},
- userCalloutDismisserSlotProps = { dismiss: jest.fn() },
- } = {},
- ) {
+ function createComponent(props, { mountFn = shallowMountExtended, glFeatures = {} } = {}) {
wrapper = mountFn(WebIdeLink, {
propsData: {
editUrl: TEST_EDIT_URL,
@@ -124,11 +116,6 @@ describe('Web IDE link component', () => {
<slot name="modal-footer"></slot>
</div>`,
}),
- UserCalloutDismisser: stubComponent(UserCalloutDismisser, {
- render() {
- return this.$scopedSlots.default(userCalloutDismisserSlotProps);
- },
- }),
},
});
}
@@ -141,13 +128,6 @@ describe('Web IDE link component', () => {
const findLocalStorageSync = () => wrapper.findComponent(LocalStorageSync);
const findModal = () => wrapper.findComponent(GlModal);
const findForkConfirmModal = () => wrapper.findComponent(ConfirmForkModal);
- const findUserCalloutDismisser = () => wrapper.findComponent(UserCalloutDismisser);
- const findNewWebIdeCalloutPopover = () => wrapper.findComponent(GlPopover);
- const findTryItOutLink = () =>
- wrapper
- .findAllComponents(GlLink)
- .filter((link) => link.text().includes('Try it out'))
- .at(0);
it.each([
{
@@ -446,132 +426,6 @@ describe('Web IDE link component', () => {
});
});
- describe('Web IDE callout', () => {
- describe('vscode_web_ide feature flag is enabled and the edit button is not shown', () => {
- let dismiss;
-
- beforeEach(() => {
- dismiss = jest.fn();
- createComponent(
- {
- showEditButton: false,
- },
- {
- glFeatures: { vscodeWebIde: true },
- userCalloutDismisserSlotProps: { dismiss },
- },
- );
- });
- it('does not skip the user_callout_dismisser query', () => {
- expect(findUserCalloutDismisser().props()).toEqual(
- expect.objectContaining({
- skipQuery: false,
- featureName: 'vscode_web_ide_callout',
- }),
- );
- });
-
- it('mounts new web ide callout popover', () => {
- expect(findNewWebIdeCalloutPopover().props()).toEqual(
- expect.objectContaining({
- showCloseButton: '',
- target: 'web-ide-link',
- triggers: 'manual',
- boundaryPadding: 80,
- }),
- );
- });
-
- describe.each`
- calloutStatus | shouldShowCallout | popoverVisibility | tooltipVisibility
- ${'show'} | ${true} | ${true} | ${false}
- ${'hide'} | ${false} | ${false} | ${true}
- `(
- 'when should $calloutStatus web ide callout',
- ({ shouldShowCallout, popoverVisibility, tooltipVisibility }) => {
- beforeEach(() => {
- createComponent(
- {
- showEditButton: false,
- },
- {
- glFeatures: { vscodeWebIde: true },
- userCalloutDismisserSlotProps: { shouldShowCallout, dismiss },
- },
- );
- });
-
- it(`popover visibility = ${popoverVisibility}`, () => {
- expect(findNewWebIdeCalloutPopover().props().show).toBe(popoverVisibility);
- });
-
- it(`action button tooltip visibility = ${tooltipVisibility}`, () => {
- expect(findActionsButton().props().showActionTooltip).toBe(tooltipVisibility);
- });
- },
- );
-
- it('dismisses the callout when popover close button is clicked', () => {
- findNewWebIdeCalloutPopover().vm.$emit('close-button-clicked');
-
- expect(dismiss).toHaveBeenCalled();
- });
-
- it('dismisses the callout when try it now link is clicked', () => {
- findTryItOutLink().vm.$emit('click');
-
- expect(dismiss).toHaveBeenCalled();
- });
-
- it('dismisses the callout when action button is clicked', () => {
- findActionsButton().vm.$emit('actionClicked');
-
- expect(dismiss).toHaveBeenCalled();
- });
- });
-
- describe.each`
- featureFlag | showEditButton
- ${false} | ${true}
- ${true} | ${false}
- ${false} | ${false}
- `(
- 'when vscode_web_ide=$featureFlag and showEditButton = $showEditButton',
- ({ vscodeWebIde, showEditButton }) => {
- let dismiss;
-
- beforeEach(() => {
- dismiss = jest.fn();
-
- createComponent(
- {
- showEditButton,
- },
- { glFeatures: { vscodeWebIde }, userCalloutDismisserSlotProps: { dismiss } },
- );
- });
-
- it('skips the user_callout_dismisser query', () => {
- expect(findUserCalloutDismisser().props().skipQuery).toBe(true);
- });
-
- it('displays actions button tooltip', () => {
- expect(findActionsButton().props().showActionTooltip).toBe(true);
- });
-
- it('mounts new web ide callout popover', () => {
- expect(findNewWebIdeCalloutPopover().exists()).toBe(false);
- });
-
- it('does not dismiss the callout when action button is clicked', () => {
- findActionsButton().vm.$emit('actionClicked');
-
- expect(dismiss).not.toHaveBeenCalled();
- });
- },
- );
- });
-
describe('when vscode_web_ide feature flag is enabled', () => {
describe('when is not showing edit button', () => {
describe(`when ${PREFERRED_EDITOR_RESET_KEY} is unset`, () => {