summaryrefslogtreecommitdiff
path: root/spec/frontend_integration
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/frontend_integration
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/frontend_integration')
-rw-r--r--spec/frontend_integration/diffs/diffs_interopability_spec.js5
-rw-r--r--spec/frontend_integration/ide/ide_integration_spec.js4
-rw-r--r--spec/frontend_integration/ide/user_opens_file_spec.js2
-rw-r--r--spec/frontend_integration/ide/user_opens_ide_spec.js3
-rw-r--r--spec/frontend_integration/ide/user_opens_mr_spec.js3
-rw-r--r--spec/frontend_integration/snippets/snippets_notes_spec.js62
-rw-r--r--spec/frontend_integration/test_helpers/mock_server/routes/emojis.js9
-rw-r--r--spec/frontend_integration/test_helpers/mock_server/routes/index.js1
8 files changed, 88 insertions, 1 deletions
diff --git a/spec/frontend_integration/diffs/diffs_interopability_spec.js b/spec/frontend_integration/diffs/diffs_interopability_spec.js
index 064e3d21180..8e9bc4f0a5f 100644
--- a/spec/frontend_integration/diffs/diffs_interopability_spec.js
+++ b/spec/frontend_integration/diffs/diffs_interopability_spec.js
@@ -1,6 +1,7 @@
import { waitFor } from '@testing-library/dom';
import setWindowLocation from 'helpers/set_window_location_helper';
import { TEST_HOST } from 'helpers/test_constants';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import initDiffsApp from '~/diffs';
import { createStore } from '~/mr_notes/stores';
import {
@@ -74,6 +75,10 @@ const startDiffsApp = () => {
describe('diffs third party interoperability', () => {
let vm;
+ beforeEach(() => {
+ stubPerformanceWebAPI();
+ });
+
afterEach(() => {
vm.$destroy();
document.body.innerHTML = '';
diff --git a/spec/frontend_integration/ide/ide_integration_spec.js b/spec/frontend_integration/ide/ide_integration_spec.js
index a002ce91deb..da48c600764 100644
--- a/spec/frontend_integration/ide/ide_integration_spec.js
+++ b/spec/frontend_integration/ide/ide_integration_spec.js
@@ -3,8 +3,9 @@ import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { setTestTimeout } from 'helpers/timeout';
import waitForPromises from 'helpers/wait_for_promises';
import { waitForText } from 'helpers/wait_for_text';
-import { createCommitId } from 'test_helpers/factories/commit_id';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
+import { createCommitId } from 'test_helpers/factories/commit_id';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import * as ideHelper from './helpers/ide_helper';
import startWebIDE from './helpers/start';
@@ -15,6 +16,7 @@ describe('WebIDE', () => {
let container;
beforeEach(() => {
+ stubPerformanceWebAPI();
// For some reason these tests were timing out in CI.
// We will investigate in https://gitlab.com/gitlab-org/gitlab/-/issues/298714
setTestTimeout(20000);
diff --git a/spec/frontend_integration/ide/user_opens_file_spec.js b/spec/frontend_integration/ide/user_opens_file_spec.js
index c3131f6ad45..af6e2f3b44b 100644
--- a/spec/frontend_integration/ide/user_opens_file_spec.js
+++ b/spec/frontend_integration/ide/user_opens_file_spec.js
@@ -1,6 +1,7 @@
import { screen } from '@testing-library/dom';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import * as ideHelper from './helpers/ide_helper';
import startWebIDE from './helpers/start';
@@ -11,6 +12,7 @@ describe('IDE: User opens a file in the Web IDE', () => {
let container;
beforeEach(async () => {
+ stubPerformanceWebAPI();
setHTMLFixture('<div class="webide-container"></div>');
container = document.querySelector('.webide-container');
diff --git a/spec/frontend_integration/ide/user_opens_ide_spec.js b/spec/frontend_integration/ide/user_opens_ide_spec.js
index b2b85452451..552888f04a5 100644
--- a/spec/frontend_integration/ide/user_opens_ide_spec.js
+++ b/spec/frontend_integration/ide/user_opens_ide_spec.js
@@ -1,6 +1,7 @@
import { screen } from '@testing-library/dom';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import * as ideHelper from './helpers/ide_helper';
import startWebIDE from './helpers/start';
@@ -11,6 +12,8 @@ describe('IDE: User opens IDE', () => {
let container;
beforeEach(() => {
+ stubPerformanceWebAPI();
+
setHTMLFixture('<div class="webide-container"></div>');
container = document.querySelector('.webide-container');
});
diff --git a/spec/frontend_integration/ide/user_opens_mr_spec.js b/spec/frontend_integration/ide/user_opens_mr_spec.js
index 084aae9f297..af0276a5055 100644
--- a/spec/frontend_integration/ide/user_opens_mr_spec.js
+++ b/spec/frontend_integration/ide/user_opens_mr_spec.js
@@ -2,6 +2,7 @@ import { basename } from 'path';
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
import { getMergeRequests, getMergeRequestWithChanges } from 'test_helpers/fixtures';
import { useOverclockTimers } from 'test_helpers/utils/overclock_timers';
+import { stubPerformanceWebAPI } from 'helpers/performance';
import * as ideHelper from './helpers/ide_helper';
import startWebIDE from './helpers/start';
@@ -16,6 +17,8 @@ describe('IDE: User opens Merge Request', () => {
let changes;
beforeEach(async () => {
+ stubPerformanceWebAPI();
+
const [{ iid: mrId }] = getMergeRequests();
changes = getRelevantChanges();
diff --git a/spec/frontend_integration/snippets/snippets_notes_spec.js b/spec/frontend_integration/snippets/snippets_notes_spec.js
new file mode 100644
index 00000000000..fdd3289bf58
--- /dev/null
+++ b/spec/frontend_integration/snippets/snippets_notes_spec.js
@@ -0,0 +1,62 @@
+import $ from 'jquery';
+import axios from '~/lib/utils/axios_utils';
+import initGFMInput from '~/behaviors/markdown/gfm_auto_complete';
+import initDeprecatedNotes from '~/init_deprecated_notes';
+import { loadHTMLFixture } from 'helpers/fixtures';
+
+describe('Integration Snippets notes', () => {
+ beforeEach(async () => {
+ loadHTMLFixture('snippets/show.html');
+
+ // Check if we have to Load GFM Input
+ const $gfmInputs = $('.js-gfm-input:not(.js-gfm-input-initialized)');
+ initGFMInput($gfmInputs);
+
+ initDeprecatedNotes();
+ });
+
+ describe('emoji autocomplete', () => {
+ const findNoteTextarea = () => document.getElementById('note_note');
+ const findAtViewEmojiMenu = () => document.getElementById('at-view-58');
+ const findAtwhoResult = () => {
+ return Array.from(findAtViewEmojiMenu().querySelectorAll('li')).map((x) =>
+ x.innerText.trim(),
+ );
+ };
+ const fillNoteTextarea = (val) => {
+ const textarea = findNoteTextarea();
+
+ textarea.dispatchEvent(new Event('focus'));
+ textarea.value = val;
+ textarea.dispatchEvent(new Event('input'));
+ textarea.dispatchEvent(new Event('click'));
+ };
+
+ it.each([
+ [
+ ':heart',
+ ['heart', 'heart decoration', 'heart with arrow', 'heart with ribbon', 'heart_exclamation'],
+ ],
+ [':red', ['red apple', 'red_car', 'red_circle', 'credit card', 'tired face']],
+ [
+ ':circle',
+ // TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/347549
+ // These autocompleted results aren't very good. The autocompletion should be improved.
+ [
+ 'circled ideograph accept',
+ 'circled ideograph advantage',
+ 'circled ideograph congratulation',
+ 'circled ideograph secret',
+ 'circled latin capital letter m',
+ ],
+ ],
+ ])('shows a correct list of matching emojis when user enters %s', async (input, expected) => {
+ fillNoteTextarea(input);
+
+ await axios.waitForAll();
+
+ const result = findAtwhoResult();
+ expect(result).toEqual(expected);
+ });
+ });
+});
diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/emojis.js b/spec/frontend_integration/test_helpers/mock_server/routes/emojis.js
new file mode 100644
index 00000000000..64e9006a710
--- /dev/null
+++ b/spec/frontend_integration/test_helpers/mock_server/routes/emojis.js
@@ -0,0 +1,9 @@
+import { Response } from 'miragejs';
+import emojis from 'public/-/emojis/2/emojis.json';
+import { EMOJI_VERSION } from '~/emoji';
+
+export default (server) => {
+ server.get(`/-/emojis/${EMOJI_VERSION}/emojis.json`, () => {
+ return new Response(200, {}, emojis);
+ });
+};
diff --git a/spec/frontend_integration/test_helpers/mock_server/routes/index.js b/spec/frontend_integration/test_helpers/mock_server/routes/index.js
index 48eff2702dd..571a592456d 100644
--- a/spec/frontend_integration/test_helpers/mock_server/routes/index.js
+++ b/spec/frontend_integration/test_helpers/mock_server/routes/index.js
@@ -6,6 +6,7 @@ export default (server) => {
require('./repository'),
require('./ci'),
require('./diffs'),
+ require('./emojis'),
require('./404'),
].forEach(({ default: setup }) => {
setup(server);