mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 21:31:41 +00:00
Merge pull request #13605 from overleaf/ae-meta-tests
[cypress] Set/reset window.metaAttributesCache globally GitOrigin-RevId: 5aa1d5e37780b53f6ddf7d34587e2119ba328003
This commit is contained in:
parent
e41bda3e61
commit
283c1d7282
23 changed files with 13 additions and 114 deletions
|
@ -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()
|
||||
})
|
||||
|
|
|
@ -9,19 +9,11 @@ import { EditorProviders } from '../../helpers/editor-providers'
|
|||
import { mockScope } from './scope'
|
||||
|
||||
describe('<EditorLeftMenu />', 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('<EditorLeftMenu />', function () {
|
|||
})
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
})
|
||||
|
||||
it('render full menu', function () {
|
||||
const scope = mockScope({
|
||||
ui: {
|
||||
|
@ -297,10 +285,6 @@ describe('<EditorLeftMenu />', function () {
|
|||
})
|
||||
|
||||
describe('settings menu', function () {
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
})
|
||||
|
||||
it('shows compiler menu correctly', function () {
|
||||
const scope = mockScope({
|
||||
ui: {
|
||||
|
|
|
@ -5,14 +5,9 @@ import { testDetachChannel } from '../../helpers/detach-channel'
|
|||
|
||||
describe('<DetachCompileButtonWrapper />', 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()
|
||||
|
||||
|
|
|
@ -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('<PdfLogsEntries/>', function () {
|
||||
const fakeEntity = { type: 'doc' }
|
||||
|
@ -36,10 +35,6 @@ describe('<PdfLogsEntries/>', function () {
|
|||
cy.interceptEvents()
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
})
|
||||
|
||||
it('displays human readable hint', function () {
|
||||
cy.mount(
|
||||
<EditorProviders {...props}>
|
||||
|
|
|
@ -6,21 +6,15 @@ describe('<PdfPreviewDetachedRoot/>', function () {
|
|||
beforeEach(function () {
|
||||
window.user = { id: 'user1' } as User
|
||||
|
||||
window.metaAttributesCache = new Map<string, unknown>([
|
||||
['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()
|
||||
|
||||
|
|
|
@ -4,15 +4,10 @@ import { testDetachChannel } from '../../helpers/detach-channel'
|
|||
|
||||
describe('<PdfPreviewHybridToolbar/>', 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(
|
||||
<EditorProviders>
|
||||
|
|
|
@ -30,10 +30,6 @@ describe('<PdfPreview/>', function () {
|
|||
cy.interceptEvents()
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
})
|
||||
|
||||
it('renders the PDF preview', function () {
|
||||
window.metaAttributesCache.set('ol-preventCompileOnLoad', false)
|
||||
cy.interceptCompile('compile')
|
||||
|
|
|
@ -78,16 +78,11 @@ const WithSelectedEntities = ({
|
|||
|
||||
describe('<PdfSynctexControls/>', 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()
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
|
||||
describe('<InlineTags />', function () {
|
||||
beforeEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
window.metaAttributesCache.set('ol-tags', [
|
||||
{
|
||||
_id: '789fff789fff',
|
||||
|
@ -36,7 +35,6 @@ describe('<InlineTags />', function () {
|
|||
|
||||
afterEach(function () {
|
||||
resetProjectListContextFetch()
|
||||
window.metaAttributesCache.clear()
|
||||
})
|
||||
|
||||
it('renders tags list for a project', function () {
|
||||
|
|
|
@ -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[] = [
|
||||
{
|
||||
|
|
|
@ -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('{{}')
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -30,10 +30,6 @@ describe('<CodeMirrorEditor/> 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()
|
||||
|
|
|
@ -17,10 +17,6 @@ describe('<CodeMirrorEditor/>', { scrollBehavior: false }, function () {
|
|||
cy.interceptSpelling()
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache = new Map()
|
||||
})
|
||||
|
||||
it('deletes selected text on Backspace', function () {
|
||||
const scope = mockScope()
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
<EditorProviders>
|
||||
|
|
Loading…
Reference in a new issue