[APM] Add visual regression test to service map (#164811)

Added visual regression to service map test to be able to test the state
of the canvas

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Miriam 2023-09-04 16:01:05 +01:00 committed by GitHub
parent 771609d6e1
commit fa721072e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 11 deletions

View file

@ -1075,6 +1075,7 @@
"@elastic/synthetics": "^1.3.0",
"@emotion/babel-preset-css-prop": "^11.11.0",
"@emotion/jest": "^11.11.0",
"@frsource/cypress-plugin-visual-regression-diff": "^3.3.10",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@istanbuljs/schema": "^0.1.2",
"@jest/console": "^29.6.1",

View file

@ -9,7 +9,7 @@ import { synthtrace } from '../../../synthtrace';
import { opbeans } from '../../fixtures/synthtrace/opbeans';
const start = '2021-10-10T00:00:00.000Z';
const end = '2021-10-10T00:15:00.000Z';
const end = '2021-10-10T00:01:00.000Z';
const serviceMapHref = url.format({
pathname: '/app/apm/service-map',
@ -29,7 +29,7 @@ const detailedServiceMap = url.format({
},
});
describe('Service map', () => {
describe('service map', () => {
before(() => {
synthtrace.index(
opbeans({
@ -47,20 +47,28 @@ describe('Service map', () => {
cy.loginAsViewerUser();
});
describe('When navigating to service map', () => {
it('opens service map', () => {
describe('when navigating to service map', () => {
beforeEach(() => {
cy.intercept('GET', '/internal/apm/service-map?*').as('serviceMap');
cy.visitKibana(serviceMapHref);
cy.contains('h1', 'Services');
cy.wait('@serviceMap');
});
it('opens detailed service map', () => {
it('shows nodes in service map', { retries: 3 }, () => {
cy.wait(500);
cy.getByTestSubj('serviceMap').matchImage();
});
it('shows nodes in detailed service map', () => {
cy.visitKibana(detailedServiceMap);
cy.contains('h1', 'opbeans-java');
cy.wait(500);
cy.getByTestSubj('serviceMap').matchImage();
});
describe('When there is no data', () => {
describe('when there is no data', () => {
it('shows empty state', () => {
cy.visitKibana(serviceMapHref);
// we need to dismiss the service-group call out first
cy.contains('Dismiss').click();
cy.getByTestSubj('apmUnifiedSearchBar').type('_id : foo{enter}');

View file

@ -8,6 +8,7 @@ import 'cypress-real-events/support';
import { Interception } from 'cypress/types/net-stubbing';
import 'cypress-axe';
import moment from 'moment';
import '@frsource/cypress-plugin-visual-regression-diff';
import { AXE_CONFIG, AXE_OPTIONS } from '@kbn/axe-config';
import { ApmUsername } from '../../../server/test_helpers/create_apm_users/authentication';

View file

@ -10,6 +10,8 @@ import {
LogLevel,
} from '@kbn/apm-synthtrace';
import { createEsClientForTesting } from '@kbn/test';
// eslint-disable-next-line @kbn/imports/no_unresolvable_imports
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
import del from 'del';
import { some } from 'lodash';
import { Readable } from 'stream';
@ -35,6 +37,8 @@ export function setupNodeEvents(
synthtraceEsClient.pipeline(synthtraceEsClient.getDefaultPipeline(false));
initPlugin(on, config);
on('task', {
// send logs to node process
log(message) {

View file

@ -213,7 +213,7 @@ export function ServiceMap({
<SearchBar showTimeComparison />
<EuiPanel hasBorder={true} paddingSize="none">
<div
data-test-subj="ServiceMap"
data-test-subj="serviceMap"
style={{ height: heightWithPadding }}
ref={ref}
>

View file

@ -2193,6 +2193,24 @@
resolved "https://registry.yarnpkg.com/@foliojs-fork/restructure/-/restructure-2.0.2.tgz#73759aba2aff1da87b7c4554e6839c70d43c92b4"
integrity sha512-59SgoZ3EXbkfSX7b63tsou/SDGzwUEK6MuB5sKqgVK1/XE0fxmpsOb9DQI8LXW3KfGnAjImCGhhEb7uPPAUVNA==
"@frsource/base64@1.0.17":
version "1.0.17"
resolved "https://registry.yarnpkg.com/@frsource/base64/-/base64-1.0.17.tgz#b5a37e2ffab4f7fc9ef2e9f660dd3f38ccb05ff4"
integrity sha512-QyMv52jCRIMUIlDM6ysSVPc6Cp3KCTu6/YeLUyJpTEhleXssYB3CT5PqmQijGGwu4819qvan8Eu4PWJRAW5Akg==
"@frsource/cypress-plugin-visual-regression-diff@^3.3.10":
version "3.3.10"
resolved "https://registry.yarnpkg.com/@frsource/cypress-plugin-visual-regression-diff/-/cypress-plugin-visual-regression-diff-3.3.10.tgz#f8c42d457409c4ac3868814085894db705026e97"
integrity sha512-ZjfOpdmXUgNRfLpsbrYiDujUzNEgLx+3dMtvMJHO3d+Yri0wniMB3mukf5+58QUMXuw8mr1cLoBkeWr1UxCOpA==
dependencies:
"@frsource/base64" "1.0.17"
glob "8.1.0"
meta-png "1.0.6"
move-file "2.1.0"
pixelmatch "5.3.0"
pngjs "7.0.0"
sharp "0.32.1"
"@gar/promisify@^1.0.1", "@gar/promisify@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
@ -17407,6 +17425,17 @@ glob@7.2.0:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^5.0.1"
once "^1.3.0"
glob@^10.2.2:
version "10.2.7"
resolved "https://registry.yarnpkg.com/glob/-/glob-10.2.7.tgz#9dd2828cd5bc7bd861e7738d91e7113dda41d7d8"
@ -21795,6 +21824,11 @@ merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1:
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
meta-png@1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/meta-png/-/meta-png-1.0.6.tgz#34d78a403cc1c809978d3e9f89485a2700daafce"
integrity sha512-eQtEi5E9axqwqA/sDK1dyhX9kYHCUe2m+45aQ3JHrozjGPs+/ab+hdhPp7A3GUNW+ZAbavrsg5xQ4r5jkGDX+A==
methods@^1.1.2, methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
@ -22378,6 +22412,13 @@ move-concurrently@^1.0.1:
rimraf "^2.5.4"
run-queue "^1.0.3"
move-file@2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/move-file/-/move-file-2.1.0.tgz#3bec9d34fbe4832df6865f112cda4492b56e8507"
integrity sha512-i9qLW6gqboJ5Ht8bauZi7KlTnQ3QFpBCvMvFfEcHADKgHGeJ9BZMO7SFCTwHPV9Qa0du9DYY1Yx3oqlGt30nXA==
dependencies:
path-exists "^4.0.0"
mri@1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a"
@ -23947,7 +23988,7 @@ piscina@^3.2.0:
optionalDependencies:
nice-napi "^1.0.2"
pixelmatch@^5.3.0:
pixelmatch@5.3.0, pixelmatch@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-5.3.0.tgz#5e5321a7abedfb7962d60dbf345deda87cb9560a"
integrity sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==
@ -24043,6 +24084,11 @@ png-js@^1.0.0:
resolved "https://registry.yarnpkg.com/png-js/-/png-js-1.0.0.tgz#e5484f1e8156996e383aceebb3789fd75df1874d"
integrity sha512-k+YsbhpA9e+EFfKjTCH3VW6aoKlyNYI6NYdTfDL4CIvFnvsuO84ttonmZE7rc+v23SLTH8XX+5w/Ak9v0xGY4g==
pngjs@7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-7.0.0.tgz#a8b7446020ebbc6ac739db6c5415a65d17090e26"
integrity sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==
pngjs@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f"
@ -27012,7 +27058,7 @@ shallowequal@^1.1.0:
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==
sharp@^0.32.0:
sharp@0.32.1, sharp@^0.32.0:
version "0.32.1"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.32.1.tgz#41aa0d0b2048b2e0ee453d9fcb14ec1f408390fe"
integrity sha512-kQTFtj7ldpUqSe8kDxoGLZc1rnMFU0AO2pqbX6pLy3b7Oj8ivJIdoKNwxHVQG2HN6XpHPJqCSM2nsma2gOXvOg==