Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-04 00:08:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-04 00:08:25 +0300
commit21cf3e773d0527e95d761e7cc49bdbb2155183d3 (patch)
tree5ce861aa5c749a0b372efc4997d09a3fac726e87 /spec/frontend/performance_bar
parent7c8468c5ba828e1c1afe6ba0b25c77c130a69413 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/performance_bar')
-rw-r--r--spec/frontend/performance_bar/components/performance_bar_app_spec.js29
-rw-r--r--spec/frontend/performance_bar/index_spec.js9
-rw-r--r--spec/frontend/performance_bar/services/performance_bar_service_spec.js2
3 files changed, 36 insertions, 4 deletions
diff --git a/spec/frontend/performance_bar/components/performance_bar_app_spec.js b/spec/frontend/performance_bar/components/performance_bar_app_spec.js
index 2c9ab4bf78d..0cbf294b401 100644
--- a/spec/frontend/performance_bar/components/performance_bar_app_spec.js
+++ b/spec/frontend/performance_bar/components/performance_bar_app_spec.js
@@ -1,20 +1,45 @@
-import { shallowMount } from '@vue/test-utils';
+import { mount } from '@vue/test-utils';
+import { GlLink } from '@gitlab/ui';
import PerformanceBarApp from '~/performance_bar/components/performance_bar_app.vue';
import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store';
describe('performance bar app', () => {
const store = new PerformanceBarStore();
- const wrapper = shallowMount(PerformanceBarApp, {
+ store.addRequest('123', 'https://gitlab.com', '', {}, 'GET');
+ const wrapper = mount(PerformanceBarApp, {
propsData: {
store,
env: 'development',
requestId: '123',
+ requestMethod: 'GET',
statsUrl: 'https://log.gprd.gitlab.net/app/dashboards#/view/',
peekUrl: '/-/peek/results',
profileUrl: '?lineprofiler=true',
},
});
+ const flamegraphDiv = () => wrapper.find('#peek-flamegraph');
+ const flamegrapLinks = () => flamegraphDiv().findAllComponents(GlLink);
+
+ it('creates three flamegraph buttons based on the path', () => {
+ expect(flamegrapLinks()).toHaveLength(3);
+
+ ['wall', 'cpu', 'object'].forEach((path, index) => {
+ expect(flamegrapLinks().at(index).attributes('href')).toBe(
+ `https://gitlab.com?performance_bar=flamegraph&stackprof_mode=${path}`,
+ );
+ });
+ expect(flamegrapLinks().at(0).attributes('href')).toEqual(
+ 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=wall',
+ );
+ expect(flamegrapLinks().at(1).attributes('href')).toEqual(
+ 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=cpu',
+ );
+ expect(flamegrapLinks().at(2).attributes('href')).toEqual(
+ 'https://gitlab.com?performance_bar=flamegraph&stackprof_mode=object',
+ );
+ });
+
it('sets the class to match the environment', () => {
expect(wrapper.element.getAttribute('class')).toContain('development');
});
diff --git a/spec/frontend/performance_bar/index_spec.js b/spec/frontend/performance_bar/index_spec.js
index f09b0cc3df8..53f97a5eeb6 100644
--- a/spec/frontend/performance_bar/index_spec.js
+++ b/spec/frontend/performance_bar/index_spec.js
@@ -20,6 +20,7 @@ describe('performance bar wrapper', () => {
peekWrapper.setAttribute('id', 'js-peek');
peekWrapper.dataset.env = 'development';
peekWrapper.dataset.requestId = '123';
+ peekWrapper.dataset.requestMethod = 'GET';
peekWrapper.dataset.peekUrl = '/-/peek/results';
peekWrapper.dataset.statsUrl = 'https://log.gprd.gitlab.net/app/dashboards#/view/';
peekWrapper.dataset.profileUrl = '?lineprofiler=true';
@@ -70,7 +71,13 @@ describe('performance bar wrapper', () => {
it('adds the request immediately', () => {
vm.addRequest('123', 'https://gitlab.com/');
- expect(vm.store.addRequest).toHaveBeenCalledWith('123', 'https://gitlab.com/', undefined);
+ expect(vm.store.addRequest).toHaveBeenCalledWith(
+ '123',
+ 'https://gitlab.com/',
+ undefined,
+ undefined,
+ undefined,
+ );
});
});
diff --git a/spec/frontend/performance_bar/services/performance_bar_service_spec.js b/spec/frontend/performance_bar/services/performance_bar_service_spec.js
index 1bb70a43a1b..b1f5f4d6982 100644
--- a/spec/frontend/performance_bar/services/performance_bar_service_spec.js
+++ b/spec/frontend/performance_bar/services/performance_bar_service_spec.js
@@ -66,7 +66,7 @@ describe('PerformanceBarService', () => {
describe('operationName', () => {
function requestUrl(response, peekUrl) {
- return PerformanceBarService.callbackParams(response, peekUrl)[3];
+ return PerformanceBarService.callbackParams(response, peekUrl)[4];
}
it('gets the operation name from response.config', () => {