summaryrefslogtreecommitdiff
path: root/spec/frontend/pages
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/frontend/pages
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
downloadgitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/frontend/pages')
-rw-r--r--spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js58
-rw-r--r--spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js68
-rw-r--r--spec/frontend/pages/shared/wikis/components/wiki_form_spec.js7
3 files changed, 55 insertions, 78 deletions
diff --git a/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js b/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js
index 858c7b76ac8..4140b985682 100644
--- a/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js
+++ b/spec/frontend/pages/admin/application_settings/metrics_and_profiling/usage_statistics_spec.js
@@ -5,53 +5,53 @@ import initSetHelperText, {
describe('UsageStatistics', () => {
const FIXTURE = 'application_settings/usage.html';
- let usagePingCheckBox;
- let usagePingFeaturesCheckBox;
- let usagePingFeaturesLabel;
- let usagePingFeaturesHelperText;
+ let servicePingCheckBox;
+ let servicePingFeaturesCheckBox;
+ let servicePingFeaturesLabel;
+ let servicePingFeaturesHelperText;
beforeEach(() => {
loadFixtures(FIXTURE);
initSetHelperText();
- usagePingCheckBox = document.getElementById('application_setting_usage_ping_enabled');
- usagePingFeaturesCheckBox = document.getElementById(
+ servicePingCheckBox = document.getElementById('application_setting_usage_ping_enabled');
+ servicePingFeaturesCheckBox = document.getElementById(
'application_setting_usage_ping_features_enabled',
);
- usagePingFeaturesLabel = document.getElementById('service_ping_features_label');
- usagePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text');
+ servicePingFeaturesLabel = document.getElementById('service_ping_features_label');
+ servicePingFeaturesHelperText = document.getElementById('service_ping_features_helper_text');
});
- const expectEnabledUsagePingFeaturesCheckBox = () => {
- expect(usagePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false);
- expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED);
+ const expectEnabledservicePingFeaturesCheckBox = () => {
+ expect(servicePingFeaturesCheckBox.classList.contains('gl-cursor-not-allowed')).toBe(false);
+ expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_ENABLED);
};
- const expectDisabledUsagePingFeaturesCheckBox = () => {
- expect(usagePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true);
- expect(usagePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED);
+ const expectDisabledservicePingFeaturesCheckBox = () => {
+ expect(servicePingFeaturesLabel.classList.contains('gl-cursor-not-allowed')).toBe(true);
+ expect(servicePingFeaturesHelperText.textContent).toEqual(HELPER_TEXT_SERVICE_PING_DISABLED);
};
describe('Registration Features checkbox', () => {
- it('is disabled when Usage Ping checkbox is unchecked', () => {
- expect(usagePingCheckBox.checked).toBe(false);
- expectDisabledUsagePingFeaturesCheckBox();
+ it('is disabled when Service Ping checkbox is unchecked', () => {
+ expect(servicePingCheckBox.checked).toBe(false);
+ expectDisabledservicePingFeaturesCheckBox();
});
- it('is enabled when Usage Ping checkbox is checked', () => {
- usagePingCheckBox.click();
- expect(usagePingCheckBox.checked).toBe(true);
- expectEnabledUsagePingFeaturesCheckBox();
+ it('is enabled when Servie Ping checkbox is checked', () => {
+ servicePingCheckBox.click();
+ expect(servicePingCheckBox.checked).toBe(true);
+ expectEnabledservicePingFeaturesCheckBox();
});
- it('is switched to disabled when Usage Ping checkbox is unchecked ', () => {
- usagePingCheckBox.click();
- usagePingFeaturesCheckBox.click();
- expectEnabledUsagePingFeaturesCheckBox();
+ it('is switched to disabled when Service Ping checkbox is unchecked ', () => {
+ servicePingCheckBox.click();
+ servicePingFeaturesCheckBox.click();
+ expectEnabledservicePingFeaturesCheckBox();
- usagePingCheckBox.click();
- expect(usagePingCheckBox.checked).toBe(false);
- expect(usagePingFeaturesCheckBox.checked).toBe(false);
- expectDisabledUsagePingFeaturesCheckBox();
+ servicePingCheckBox.click();
+ expect(servicePingCheckBox.checked).toBe(false);
+ expect(servicePingFeaturesCheckBox.checked).toBe(false);
+ expectDisabledservicePingFeaturesCheckBox();
});
});
});
diff --git a/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js b/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
index 4c253f0610b..1e562419f32 100644
--- a/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
+++ b/spec/frontend/pages/projects/shared/permissions/components/settings_panel_spec.js
@@ -1,4 +1,4 @@
-import { GlToggle } from '@gitlab/ui';
+import { GlSprintf, GlToggle } from '@gitlab/ui';
import { shallowMount, mount } from '@vue/test-utils';
import projectFeatureSetting from '~/pages/projects/shared/permissions/components/project_feature_setting.vue';
import settingsPanel from '~/pages/projects/shared/permissions/components/settings_panel.vue';
@@ -22,12 +22,11 @@ const defaultProps = {
operationsAccessLevel: 20,
pagesAccessLevel: 10,
analyticsAccessLevel: 20,
- containerRegistryEnabled: true,
+ containerRegistryAccessLevel: 20,
lfsEnabled: true,
emailsDisabled: false,
packagesEnabled: true,
showDefaultAwardEmojis: true,
- allowEditingCommitMessages: false,
},
isGitlabCom: true,
canDisableEmails: true,
@@ -53,7 +52,7 @@ describe('Settings Panel', () => {
let wrapper;
const mountComponent = (
- { currentSettings = {}, glFeatures = {}, ...customProps } = {},
+ { currentSettings = {}, ...customProps } = {},
mountFn = shallowMount,
) => {
const propsData = {
@@ -64,9 +63,6 @@ describe('Settings Panel', () => {
return mountFn(settingsPanel, {
propsData,
- provide: {
- glFeatures,
- },
});
};
@@ -89,8 +85,10 @@ describe('Settings Panel', () => {
const findBuildsAccessLevelInput = () =>
wrapper.find('[name="project[project_feature_attributes][builds_access_level]"]');
const findContainerRegistrySettings = () => wrapper.find({ ref: 'container-registry-settings' });
- const findContainerRegistryEnabledInput = () =>
- wrapper.find('[name="project[container_registry_enabled]"]');
+ const findContainerRegistryPublicNoteGlSprintfComponent = () =>
+ findContainerRegistrySettings().findComponent(GlSprintf);
+ const findContainerRegistryAccessLevelInput = () =>
+ wrapper.find('[name="project[project_feature_attributes][container_registry_access_level]"]');
const findPackageSettings = () => wrapper.find({ ref: 'package-settings' });
const findPackagesEnabledInput = () => wrapper.find('[name="project[packages_enabled]"]');
const findPagesSettings = () => wrapper.find({ ref: 'pages-settings' });
@@ -100,8 +98,6 @@ describe('Settings Panel', () => {
const findShowDefaultAwardEmojis = () =>
wrapper.find('input[name="project[project_setting_attributes][show_default_award_emojis]"]');
const findMetricsVisibilitySettings = () => wrapper.find({ ref: 'metrics-visibility-settings' });
- const findAllowEditingCommitMessages = () =>
- wrapper.find({ ref: 'allow-editing-commit-messages' }).exists();
const findOperationsSettings = () => wrapper.find({ ref: 'operations-settings' });
afterEach(() => {
@@ -281,42 +277,38 @@ describe('Settings Panel', () => {
it('should show the container registry public note if the visibility level is public and the registry is available', () => {
wrapper = mountComponent({
- currentSettings: { visibilityLevel: visibilityOptions.PUBLIC },
- registryAvailable: true,
- });
-
- expect(findContainerRegistrySettings().text()).toContain(
- 'Note: the container registry is always visible when a project is public',
- );
- });
-
- it('should hide the container registry public note if the visibility level is private and the registry is available', () => {
- wrapper = mountComponent({
- currentSettings: { visibilityLevel: visibilityOptions.PRIVATE },
+ currentSettings: {
+ visibilityLevel: visibilityOptions.PUBLIC,
+ containerRegistryAccessLevel: featureAccessLevel.EVERYONE,
+ },
registryAvailable: true,
});
- expect(findContainerRegistrySettings().text()).not.toContain(
- 'Note: the container registry is always visible when a project is public',
+ expect(findContainerRegistryPublicNoteGlSprintfComponent().exists()).toBe(true);
+ expect(findContainerRegistryPublicNoteGlSprintfComponent().attributes('message')).toContain(
+ `Note: The container registry is always visible when a project is public and the container registry is set to '%{access_level_description}'`,
);
});
- it('should enable the container registry input when the repository is enabled', () => {
+ it('should hide the container registry public note if the visibility level is public but the registry is private', () => {
wrapper = mountComponent({
- currentSettings: { repositoryAccessLevel: featureAccessLevel.EVERYONE },
+ currentSettings: {
+ visibilityLevel: visibilityOptions.PUBLIC,
+ containerRegistryAccessLevel: featureAccessLevel.PROJECT_MEMBERS,
+ },
registryAvailable: true,
});
- expect(findContainerRegistryEnabledInput().props('disabled')).toBe(false);
+ expect(findContainerRegistryPublicNoteGlSprintfComponent().exists()).toBe(false);
});
- it('should disable the container registry input when the repository is disabled', () => {
+ it('should hide the container registry public note if the visibility level is private and the registry is available', () => {
wrapper = mountComponent({
- currentSettings: { repositoryAccessLevel: featureAccessLevel.NOT_ENABLED },
+ currentSettings: { visibilityLevel: visibilityOptions.PRIVATE },
registryAvailable: true,
});
- expect(findContainerRegistryEnabledInput().props('disabled')).toBe(true);
+ expect(findContainerRegistryPublicNoteGlSprintfComponent().exists()).toBe(false);
});
it('has label for the toggle', () => {
@@ -325,7 +317,7 @@ describe('Settings Panel', () => {
registryAvailable: true,
});
- expect(findContainerRegistrySettings().findComponent(GlToggle).props('label')).toBe(
+ expect(findContainerRegistryAccessLevelInput().props('label')).toBe(
settingsPanel.i18n.containerRegistryLabel,
);
});
@@ -582,18 +574,6 @@ describe('Settings Panel', () => {
);
});
- describe('Settings panel with feature flags', () => {
- describe('Allow edit of commit message', () => {
- it('should show the allow editing of commit messages checkbox', () => {
- wrapper = mountComponent({
- glFeatures: { allowEditingCommitMessages: true },
- });
-
- expect(findAllowEditingCommitMessages()).toBe(true);
- });
- });
- });
-
describe('Analytics', () => {
it('should show the analytics toggle', () => {
wrapper = mountComponent();
diff --git a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
index f36d6262b5f..082a8977710 100644
--- a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
+++ b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
@@ -15,6 +15,8 @@ import {
import MarkdownField from '~/vue_shared/components/markdown/field.vue';
+jest.mock('~/emoji');
+
describe('WikiForm', () => {
let wrapper;
let mock;
@@ -350,11 +352,6 @@ describe('WikiForm', () => {
await waitForPromises();
});
- it('editor is shown in a perpetual loading state', () => {
- expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true);
- expect(wrapper.findComponent(ContentEditor).exists()).toBe(false);
- });
-
it('disables the submit button', () => {
expect(findSubmitButton().props('disabled')).toBe(true);
});