mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 20:44:09 +00:00
Merge pull request #14860 from overleaf/mj-figure-modal-paste-image-test
[cypress] Add test for pasting a file to open figure modal GitOrigin-RevId: c9339bbf8d71d7765fe8db98d7edbe5bed047dbc
This commit is contained in:
parent
ec563e75e2
commit
61e49d3644
2 changed files with 17 additions and 0 deletions
BIN
services/web/cypress/fixtures/images/gradient.png
Normal file
BIN
services/web/cypress/fixtures/images/gradient.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -384,6 +384,23 @@ text below`,
|
|||
cy.get('.cm-content').should('have.text', 'text abovetext below')
|
||||
})
|
||||
|
||||
it('Opens figure modal on pasting image', function () {
|
||||
cy.fixture<Uint8Array>('images/gradient.png').then(gradientBuffer => {
|
||||
const gradientFile = new File([gradientBuffer], 'gradient.png', {
|
||||
type: 'image/png',
|
||||
})
|
||||
const clipboardData = new DataTransfer()
|
||||
clipboardData.items.add(gradientFile)
|
||||
cy.wrap(clipboardData.files).should('have.length', 1)
|
||||
cy.get('.cm-content').trigger('paste', { clipboardData })
|
||||
cy.findByText('Upload from computer').should('be.visible')
|
||||
cy.findByLabelText('File name in this project').should(
|
||||
'have.value',
|
||||
'gradient.png'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: Add tests for replacing image when we can match on image path
|
||||
// TODO: Add tests for changing image size when we can match on figure width
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue