diff --git a/src/loaders/configure/configure.js b/src/loaders/configure/configure.js index 247e7cf97..aee5a2ffc 100644 --- a/src/loaders/configure/configure.js +++ b/src/loaders/configure/configure.js @@ -1,6 +1,6 @@ import { setAPI, setTopLevelCallers } from '../api/api' import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum' -import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config' +import { getConfiguration, setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config' import { activatedFeatures } from '../../common/util/feature-flags' import { isWorkerScope } from '../../common/constants/runtime' @@ -22,7 +22,16 @@ export function configure (agentIdentifier, opts = {}, loaderType, forceDrain) { } setInfo(agentIdentifier, info) - runtime.denyList = init.ajax?.block_internal ? (init.ajax.deny_list || []).concat(info.beacon, info.errorBeacon) : init.ajax?.deny_list + const updatedInit = getConfiguration(agentIdentifier) + runtime.denyList = [ + ...(updatedInit.ajax?.deny_list || []), + ...(updatedInit.ajax?.block_internal + ? [ + info.beacon, + info.errorBeacon + ] + : []) + ] setRuntime(agentIdentifier, runtime) setTopLevelCallers() diff --git a/tests/specs/spa/harvesting.e2e.js b/tests/specs/spa/harvesting.e2e.js index 2f9a9868f..8b0224e7e 100644 --- a/tests/specs/spa/harvesting.e2e.js +++ b/tests/specs/spa/harvesting.e2e.js @@ -1,27 +1,49 @@ describe('spa harvesting', () => { it('should set correct customEnd value on multiple custom interactions', async () => { - const [interactionResults] = await Promise.all([ + // interaction3 will eventually be harvested so we need to capture two harvests here + + const [interactionResults1, interactionResults2] = await Promise.all([ + browser.testHandle.expectInteractionEvents(), browser.testHandle.expectInteractionEvents(), browser.url(await browser.testHandle.assetURL('spa/multiple-custom-interactions.html')) - .then(() => browser.waitForAgentLoad()) ]) - const interactions = interactionResults.request.body - expect(interactions.length).toEqual(3) + const interactions = [ + ...interactionResults1.request.body, + ...interactionResults2.request.body + ] + expect(interactions.length).toEqual(4) expect(interactions).toEqual(expect.arrayContaining([ expect.objectContaining({ - customName: 'interaction1' + customName: 'interaction1', + children: expect.arrayContaining([expect.objectContaining({ + type: 'customEnd' + })]) }), expect.objectContaining({ - customName: 'interaction2' + customName: 'interaction2', + children: expect.arrayContaining([expect.objectContaining({ + type: 'customEnd' + })]) }), expect.objectContaining({ - customName: 'interaction4' + customName: 'interaction3', + children: expect.not.arrayContaining([expect.objectContaining({ + type: 'customEnd' + })]) + }), + expect.objectContaining({ + customName: 'interaction4', + children: expect.arrayContaining([expect.objectContaining({ + type: 'customEnd' + })]) }) ])) - interactions.forEach(interaction => { - const customEndTime = interaction.children.find(child => child.type === 'customEnd') - expect(customEndTime.time).toBeGreaterThanOrEqual(interaction.end) - }) + interactions + .filter(interaction => ['interaction1', 'interaction2', 'interaction4'].includes(interaction.customName)) + .forEach(interaction => { + const customEndTime = interaction.children.find(child => child.type === 'customEnd') + expect(customEndTime.time).toBeGreaterThanOrEqual(interaction.end) + }) }) })