diff --git a/services/web/cypress/support/component.ts b/services/web/cypress/support/component.ts index 54d703d8d9..5c8d062f17 100644 --- a/services/web/cypress/support/component.ts +++ b/services/web/cypress/support/component.ts @@ -5,3 +5,11 @@ import '../../frontend/js/i18n' import './shared/commands' import './shared/exceptions' import './ct/commands' + +beforeEach(function () { + window.metaAttributesCache = new Map() +}) + +afterEach(function () { + window.metaAttributesCache.clear() +}) diff --git a/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx b/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx index 5d0d2296e8..88afe127cb 100644 --- a/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx +++ b/services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx @@ -9,19 +9,11 @@ import { EditorProviders } from '../../helpers/editor-providers' import { mockScope } from './scope' describe('', function () { - before(function () { - window.metaAttributesCache = new Map() - }) - beforeEach(function () { cy.viewport(800, 800) cy.interceptCompile() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - // eslint-disable-next-line mocha/no-skipped-tests describe.skip('for non-anonymous users', function () { const overallThemes: OverallThemeMeta[] = [ @@ -60,10 +52,6 @@ describe('', function () { }) }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('render full menu', function () { const scope = mockScope({ ui: { @@ -297,10 +285,6 @@ describe('', function () { }) describe('settings menu', function () { - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('shows compiler menu correctly', function () { const scope = mockScope({ ui: { diff --git a/services/web/test/frontend/components/pdf-preview/detach-compile-button.spec.tsx b/services/web/test/frontend/components/pdf-preview/detach-compile-button.spec.tsx index 67e9be95a4..5826fce35b 100644 --- a/services/web/test/frontend/components/pdf-preview/detach-compile-button.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/detach-compile-button.spec.tsx @@ -5,14 +5,9 @@ import { testDetachChannel } from '../../helpers/detach-channel' describe('', function () { beforeEach(function () { - window.metaAttributesCache = new Map() cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('detacher mode and not linked: does not show button ', function () { cy.interceptCompile() diff --git a/services/web/test/frontend/components/pdf-preview/pdf-logs-entries.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-logs-entries.spec.tsx index 22c579849f..b4945bc661 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-logs-entries.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-logs-entries.spec.tsx @@ -1,7 +1,6 @@ import { EditorProviders } from '../../helpers/editor-providers' import PdfLogsEntries from '../../../../frontend/js/features/pdf-preview/components/pdf-logs-entries' import { detachChannel, testDetachChannel } from '../../helpers/detach-channel' -window.metaAttributesCache = new Map([['ol-debugPdfDetach', true]]) describe('', function () { const fakeEntity = { type: 'doc' } @@ -36,10 +35,6 @@ describe('', function () { cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('displays human readable hint', function () { cy.mount( diff --git a/services/web/test/frontend/components/pdf-preview/pdf-preview-detached-root.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-preview-detached-root.spec.tsx index e29dfb1c77..fac8ea9570 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-preview-detached-root.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-preview-detached-root.spec.tsx @@ -6,21 +6,15 @@ describe('', function () { beforeEach(function () { window.user = { id: 'user1' } as User - window.metaAttributesCache = new Map([ - ['ol-user', window.user], - ['ol-project_id', 'project1'], - ['ol-detachRole', 'detached'], - ['ol-projectName', 'Project Name'], - ['ol-preventCompileOnLoad', true], - ]) + window.metaAttributesCache.set('ol-user', window.user) + window.metaAttributesCache.set('ol-project_id', 'project1') + window.metaAttributesCache.set('ol-detachRole', 'detached') + window.metaAttributesCache.set('ol-projectName', 'Project Name') + window.metaAttributesCache.set('ol-preventCompileOnLoad', true) cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('syncs compiling state', function () { cy.interceptCompile() diff --git a/services/web/test/frontend/components/pdf-preview/pdf-preview-hybrid-toolbar.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-preview-hybrid-toolbar.spec.tsx index 79878ae338..e381001b4f 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-preview-hybrid-toolbar.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-preview-hybrid-toolbar.spec.tsx @@ -4,15 +4,10 @@ import { testDetachChannel } from '../../helpers/detach-channel' describe('', function () { beforeEach(function () { - window.metaAttributesCache = new Map() window.metaAttributesCache.set('ol-preventCompileOnLoad', true) cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('shows normal mode', function () { cy.mount( diff --git a/services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx index 0c51ec36e8..ccdc0eeac0 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx @@ -30,10 +30,6 @@ describe('', function () { cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('renders the PDF preview', function () { window.metaAttributesCache.set('ol-preventCompileOnLoad', false) cy.interceptCompile('compile') diff --git a/services/web/test/frontend/components/pdf-preview/pdf-synctex-controls.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-synctex-controls.spec.tsx index dd5e17bfab..b520a9af56 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-synctex-controls.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-synctex-controls.spec.tsx @@ -78,16 +78,11 @@ const WithSelectedEntities = ({ describe('', function () { beforeEach(function () { - window.metaAttributesCache = new Map() window.metaAttributesCache.set('ol-project_id', 'test-project') window.metaAttributesCache.set('ol-preventCompileOnLoad', false) cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - // eslint-disable-next-line mocha/no-skipped-tests it.skip('handles clicks on sync buttons', function () { cy.interceptCompile() diff --git a/services/web/test/frontend/components/shared/split-test-badge.spec.tsx b/services/web/test/frontend/components/shared/split-test-badge.spec.tsx index ce7671decd..125f45829e 100644 --- a/services/web/test/frontend/components/shared/split-test-badge.spec.tsx +++ b/services/web/test/frontend/components/shared/split-test-badge.spec.tsx @@ -2,10 +2,6 @@ import SplitTestBadge from '../../../../frontend/js/shared/components/split-test import { EditorProviders } from '../../helpers/editor-providers' describe('split test badge', function () { - beforeEach(function () { - window.metaAttributesCache = new Map() - }) - it('renders an alpha badge with the url and tooltip text', function () { cy.window().then(win => { win.metaAttributesCache.set('ol-splitTestVariants', { diff --git a/services/web/test/frontend/features/group-management/components/group-managers.spec.tsx b/services/web/test/frontend/features/group-management/components/group-managers.spec.tsx index 2708973891..94040b3c7f 100644 --- a/services/web/test/frontend/features/group-management/components/group-managers.spec.tsx +++ b/services/web/test/frontend/features/group-management/components/group-managers.spec.tsx @@ -25,7 +25,6 @@ const PATHS = { describe('group managers', function () { beforeEach(function () { cy.window().then(win => { - win.metaAttributesCache = new Map() win.metaAttributesCache.set('ol-users', [JOHN_DOE, BOBBY_LAPOINTE]) win.metaAttributesCache.set('ol-groupId', GROUP_ID) win.metaAttributesCache.set('ol-groupName', 'My Awesome Team') diff --git a/services/web/test/frontend/features/group-management/components/group-members.spec.tsx b/services/web/test/frontend/features/group-management/components/group-members.spec.tsx index 336997f48c..249a857c7e 100644 --- a/services/web/test/frontend/features/group-management/components/group-members.spec.tsx +++ b/services/web/test/frontend/features/group-management/components/group-members.spec.tsx @@ -27,7 +27,6 @@ const PATHS = { describe('group members, without managed users', function () { beforeEach(function () { cy.window().then(win => { - win.metaAttributesCache = new Map() win.metaAttributesCache.set('ol-users', [JOHN_DOE, BOBBY_LAPOINTE]) win.metaAttributesCache.set('ol-groupId', GROUP_ID) win.metaAttributesCache.set('ol-groupName', 'My Awesome Team') diff --git a/services/web/test/frontend/features/group-management/components/institution-managers.spec.tsx b/services/web/test/frontend/features/group-management/components/institution-managers.spec.tsx index 7dc3337d52..ab443f58bf 100644 --- a/services/web/test/frontend/features/group-management/components/institution-managers.spec.tsx +++ b/services/web/test/frontend/features/group-management/components/institution-managers.spec.tsx @@ -25,7 +25,6 @@ const PATHS = { describe('institution managers', function () { beforeEach(function () { cy.window().then(win => { - win.metaAttributesCache = new Map() win.metaAttributesCache.set('ol-users', [JOHN_DOE, BOBBY_LAPOINTE]) win.metaAttributesCache.set('ol-groupId', GROUP_ID) win.metaAttributesCache.set('ol-groupName', 'My Awesome Institution') diff --git a/services/web/test/frontend/features/group-management/components/publisher-managers.spec.tsx b/services/web/test/frontend/features/group-management/components/publisher-managers.spec.tsx index aa027d93c6..68f613e872 100644 --- a/services/web/test/frontend/features/group-management/components/publisher-managers.spec.tsx +++ b/services/web/test/frontend/features/group-management/components/publisher-managers.spec.tsx @@ -25,7 +25,6 @@ const PATHS = { describe('publisher managers', function () { beforeEach(function () { cy.window().then(win => { - win.metaAttributesCache = new Map() win.metaAttributesCache.set('ol-users', [JOHN_DOE, BOBBY_LAPOINTE]) win.metaAttributesCache.set('ol-groupId', GROUP_ID) win.metaAttributesCache.set('ol-groupName', 'My Awesome Publisher') diff --git a/services/web/test/frontend/features/project-list/components/table/cells/inline-tags.test.tsx b/services/web/test/frontend/features/project-list/components/table/cells/inline-tags.test.tsx index 1ad7f55db0..0f12e72265 100644 --- a/services/web/test/frontend/features/project-list/components/table/cells/inline-tags.test.tsx +++ b/services/web/test/frontend/features/project-list/components/table/cells/inline-tags.test.tsx @@ -13,7 +13,6 @@ import { describe('', function () { beforeEach(function () { - window.metaAttributesCache = new Map() window.metaAttributesCache.set('ol-tags', [ { _id: '789fff789fff', @@ -36,7 +35,6 @@ describe('', function () { afterEach(function () { resetProjectListContextFetch() - window.metaAttributesCache.clear() }) it('renders tags list for a project', function () { diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-autocomplete.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-autocomplete.spec.tsx index 44e317e119..1159d61c48 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-autocomplete.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-autocomplete.spec.tsx @@ -19,10 +19,6 @@ describe('autocomplete', { scrollBehavior: false }, function () { cy.interceptSpelling() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('opens autocomplete on matched text', function () { const rootFolder: Folder[] = [ { diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-close-brackets.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-close-brackets.spec.tsx index 6e25cbcfbe..a9be4d90db 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-close-brackets.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-close-brackets.spec.tsx @@ -27,10 +27,6 @@ describe('close brackets', { scrollBehavior: false }, function () { cy.get('@active-line').click() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - describe('unprefixed characters', function () { it('auto-closes a curly bracket', function () { cy.get('@active-line').type('{{}') diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-shortcuts.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-shortcuts.spec.tsx index df99dd99c4..85f5a8f8a1 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-shortcuts.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-shortcuts.spec.tsx @@ -33,10 +33,6 @@ describe('keyboard shortcuts', { scrollBehavior: false }, function () { cy.get('.cm-editor').as('editor') }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('comment line with {meta+/}', function () { cy.get('@line').type('text') cy.get('@line').type(`{${metaKey}+/}`) @@ -160,10 +156,6 @@ contentLine3 cy.get('.cm-editor').as('editor') }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('emulates search behaviour', function () { activeEditorLine().should('have.text', '\\documentclass{article}') @@ -268,10 +260,6 @@ contentLine3 cy.get('.cm-editor').as('editor') }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('can enter characters', function () { cy.get('.cm-line').eq(0).as('line') cy.get('@line').scrollIntoView() diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker.spec.tsx index 8d129777e0..194e6e45e3 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-spellchecker.spec.tsx @@ -42,10 +42,6 @@ describe('Spellchecker', function () { cy.get('@line').click() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('makes initial spellcheck request', function () { cy.intercept('POST', '/spelling/check').as('spellCheckRequest') cy.get('@line').type('wombat') diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-floats.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-floats.spec.tsx index 0ac5428967..23fb27bee4 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-floats.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor-visual-floats.spec.tsx @@ -30,10 +30,6 @@ describe(' floats', function () { cy.interceptSpelling() }) - afterEach(function () { - window.metaAttributesCache.clear() - }) - it('decorates a caption', function () { mountEditor('\n\\caption{Foo}\n') cy.get('.cm-line').eq(2).click() diff --git a/services/web/test/frontend/features/source-editor/components/codemirror-editor.spec.tsx b/services/web/test/frontend/features/source-editor/components/codemirror-editor.spec.tsx index b144cfea89..342cd8c7a9 100644 --- a/services/web/test/frontend/features/source-editor/components/codemirror-editor.spec.tsx +++ b/services/web/test/frontend/features/source-editor/components/codemirror-editor.spec.tsx @@ -17,10 +17,6 @@ describe('', { scrollBehavior: false }, function () { cy.interceptSpelling() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('deletes selected text on Backspace', function () { const scope = mockScope() diff --git a/services/web/test/frontend/shared/hooks/use-detach-action.spec.tsx b/services/web/test/frontend/shared/hooks/use-detach-action.spec.tsx index 9431a2a47f..a7c024fda1 100644 --- a/services/web/test/frontend/shared/hooks/use-detach-action.spec.tsx +++ b/services/web/test/frontend/shared/hooks/use-detach-action.spec.tsx @@ -23,14 +23,6 @@ const DetachActionTest: FC<{ } describe('useDetachAction', function () { - beforeEach(function () { - window.metaAttributesCache = new Map() - }) - - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('broadcast message as sender', function () { window.metaAttributesCache.set('ol-detachRole', 'detacher') diff --git a/services/web/test/frontend/shared/hooks/use-detach-layout.spec.tsx b/services/web/test/frontend/shared/hooks/use-detach-layout.spec.tsx index ef481b7f93..8a8fdc5790 100644 --- a/services/web/test/frontend/shared/hooks/use-detach-layout.spec.tsx +++ b/services/web/test/frontend/shared/hooks/use-detach-layout.spec.tsx @@ -36,17 +36,12 @@ const DetachLayoutTest = () => { describe('useDetachLayout', function () { beforeEach(function () { - window.metaAttributesCache = new Map() window.metaAttributesCache.set('ol-preventCompileOnLoad', true) cy.stub(window, 'open').as('openWindow') cy.stub(window, 'close').as('closeWindow') cy.interceptEvents() }) - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('detaching', function () { // 1. create hook in normal mode cy.mount( diff --git a/services/web/test/frontend/shared/hooks/use-detach-state.spec.tsx b/services/web/test/frontend/shared/hooks/use-detach-state.spec.tsx index b471977025..cd06f86165 100644 --- a/services/web/test/frontend/shared/hooks/use-detach-state.spec.tsx +++ b/services/web/test/frontend/shared/hooks/use-detach-state.spec.tsx @@ -28,14 +28,6 @@ const DetachStateTest: FC<{ } describe('useDetachState', function () { - beforeEach(function () { - window.metaAttributesCache = new Map() - }) - - afterEach(function () { - window.metaAttributesCache = new Map() - }) - it('create and update state', function () { cy.mount(