mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19791 from overleaf/jpa-enable-synctex-test
[server-ce] tests: re-enable test for sync to pdf GitOrigin-RevId: fd111ba1ff846acfe82735b4bc47f68929266254
This commit is contained in:
parent
051089d466
commit
eede7fe313
3 changed files with 21 additions and 29 deletions
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
"cypress:run": "cypress run",
|
"cypress:run": "cypress run --browser chrome",
|
||||||
"format": "prettier --list-different $PWD/'**/*.{js,mjs,ts,tsx,json}'",
|
"format": "prettier --list-different $PWD/'**/*.{js,mjs,ts,tsx,json}'",
|
||||||
"format:fix": "prettier --write $PWD/'**/*.{js,mjs,ts,tsx,json}'"
|
"format:fix": "prettier --write $PWD/'**/*.{js,mjs,ts,tsx,json}'"
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,9 +63,8 @@ describe('SandboxedCompiles', function () {
|
||||||
function checkSyncTeX() {
|
function checkSyncTeX() {
|
||||||
describe('SyncTeX', () => {
|
describe('SyncTeX', () => {
|
||||||
let projectName: string
|
let projectName: string
|
||||||
beforeWithReRunOnTestRetry(function () {
|
beforeEach(function () {
|
||||||
projectName = `Project ${uuid()}`
|
projectName = `Project ${uuid()}`
|
||||||
login('user@example.com')
|
|
||||||
cy.visit('/project')
|
cy.visit('/project')
|
||||||
createProject(projectName)
|
createProject(projectName)
|
||||||
const recompile = throttledRecompile()
|
const recompile = throttledRecompile()
|
||||||
|
@ -76,12 +75,13 @@ describe('SandboxedCompiles', function () {
|
||||||
`\n\\pagebreak\n\\section{{}Section A}\n\\pagebreak\n\\section{{}Section B}\n\\pagebreak`
|
`\n\\pagebreak\n\\section{{}Section A}\n\\pagebreak\n\\section{{}Section B}\n\\pagebreak`
|
||||||
)
|
)
|
||||||
recompile()
|
recompile()
|
||||||
|
cy.log('wait for pdf-rendering')
|
||||||
|
cy.get('.pdf-viewer').within(() => {
|
||||||
|
cy.findByText(projectName)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should sync to code', () => {
|
it('should sync to code', () => {
|
||||||
cy.visit('/project')
|
|
||||||
cy.findByText(projectName).click()
|
|
||||||
|
|
||||||
cy.log('navigate to \\maketitle using double click in PDF')
|
cy.log('navigate to \\maketitle using double click in PDF')
|
||||||
cy.get('.pdf-viewer').within(() => {
|
cy.get('.pdf-viewer').within(() => {
|
||||||
cy.findByText(projectName).dblclick()
|
cy.findByText(projectName).dblclick()
|
||||||
|
@ -112,26 +112,13 @@ describe('SandboxedCompiles', function () {
|
||||||
cy.get('.cm-activeLine').should('have.text', '\\section{Section B}')
|
cy.get('.cm-activeLine').should('have.text', '\\section{Section B}')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Waiting for a fix of https://github.com/overleaf/internal/issues/18603
|
it('should sync to pdf', () => {
|
||||||
it.skip('should sync to pdf', () => {
|
|
||||||
cy.visit('/project')
|
|
||||||
cy.findByText(projectName).click()
|
|
||||||
|
|
||||||
cy.log('wait for compile')
|
|
||||||
cy.get('.pdf-viewer').within(() => {
|
|
||||||
cy.findByText(projectName)
|
|
||||||
})
|
|
||||||
|
|
||||||
cy.log('zoom in')
|
cy.log('zoom in')
|
||||||
for (let i = 0; i < 8; i++) {
|
cy.findByText('45%').click()
|
||||||
cy.get('[aria-label="Zoom in"]').click({ force: true })
|
cy.findByText('400%').click()
|
||||||
}
|
|
||||||
cy.log('scroll to top')
|
cy.log('scroll to top')
|
||||||
cy.get('.pdfjs-viewer-inner').scrollTo('top')
|
cy.get('.pdfjs-viewer-inner').scrollTo('top')
|
||||||
waitUntilScrollingFinished('.pdfjs-viewer-inner', -1)
|
waitUntilScrollingFinished('.pdfjs-viewer-inner', -1).as('start')
|
||||||
cy.get('.pdfjs-viewer-inner')
|
|
||||||
.should('have.prop', 'scrollTop')
|
|
||||||
.as('start')
|
|
||||||
|
|
||||||
cy.log('navigate to title')
|
cy.log('navigate to title')
|
||||||
cy.findByText('\\maketitle').parent().click()
|
cy.findByText('\\maketitle').parent().click()
|
||||||
|
|
|
@ -341,7 +341,7 @@ function PdfJsViewer({ url, pdfFile }: PdfJsViewerProps) {
|
||||||
timers.push(
|
timers.push(
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
element.style.opacity = '0'
|
element.style.opacity = '0'
|
||||||
}, 1000)
|
}, 1100)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,11 +367,16 @@ function PdfJsViewer({ url, pdfFile }: PdfJsViewerProps) {
|
||||||
|
|
||||||
if (firstElement) {
|
if (firstElement) {
|
||||||
// scroll to the first highlighted element
|
// scroll to the first highlighted element
|
||||||
|
// Briefly delay the scrolling after adding the element to the DOM.
|
||||||
|
timers.push(
|
||||||
|
window.setTimeout(() => {
|
||||||
firstElement.scrollIntoView({
|
firstElement.scrollIntoView({
|
||||||
block: 'center',
|
block: 'center',
|
||||||
inline: 'start',
|
inline: 'start',
|
||||||
behavior: 'smooth',
|
behavior: 'smooth',
|
||||||
})
|
})
|
||||||
|
}, 100)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
Loading…
Reference in a new issue