mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
Update to cypress 9 and fix firefox upload crash (#1653)
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
parent
d4251519e2
commit
03725f5512
11 changed files with 80 additions and 58 deletions
1
cypress/fixtures/invalid-history.txt
Normal file
1
cypress/fixtures/invalid-history.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Invalid json
|
3
cypress/fixtures/invalid-history.txt.license
Normal file
3
cypress/fixtures/invalid-history.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
|
@ -40,8 +40,11 @@ describe('File upload', () => {
|
|||
)
|
||||
})
|
||||
it('via button', () => {
|
||||
cy.getById('editor-toolbar-upload-image-button').click()
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFile({ filePath: 'demo.png', mimeType: 'image/png' })
|
||||
cy.getById('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFixture({
|
||||
filePath: 'demo.png',
|
||||
mimeType: 'image/png'
|
||||
})
|
||||
cy.get('.CodeMirror-activeline').contains(``)
|
||||
})
|
||||
|
||||
|
@ -83,9 +86,10 @@ describe('File upload', () => {
|
|||
statusCode: 400
|
||||
}
|
||||
)
|
||||
cy.getById('editor-toolbar-upload-image-button').click()
|
||||
cy.fixture('demo.png').then(() => {
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFile({ filePath: 'demo.png', mimeType: 'image/png' })
|
||||
cy.getById('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFixture({
|
||||
filePath: 'demo.png',
|
||||
mimeType: 'image/png'
|
||||
})
|
||||
cy.get('.CodeMirror-activeline').contains('![upload of demo.png failed]()')
|
||||
})
|
||||
|
|
|
@ -136,8 +136,8 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('works with valid file', () => {
|
||||
cy.getById('import-history-file-button').click()
|
||||
cy.getById('import-history-file-input').attachFile({
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
|
@ -145,23 +145,23 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('fails on invalid file', () => {
|
||||
cy.getById('import-history-file-button').click()
|
||||
cy.getById('import-history-file-input').attachFile({
|
||||
filePath: 'history.json.license',
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
filePath: 'invalid-history.txt',
|
||||
mimeType: 'text/plain'
|
||||
})
|
||||
cy.getById('notification-toast').should('be.visible')
|
||||
})
|
||||
|
||||
it('works when selecting two files with the same name', () => {
|
||||
cy.getById('import-history-file-button').click()
|
||||
cy.getById('import-history-file-input').attachFile({
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getById('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
cy.getById('import-history-file-button').click()
|
||||
cy.getById('import-history-file-input').attachFile({
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
filePath: 'history-2.json',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
|
|
|
@ -11,8 +11,8 @@ describe('Import markdown file', () => {
|
|||
|
||||
it('import on blank note', () => {
|
||||
cy.getById('menu-import').click()
|
||||
cy.getById('menu-import-markdown').click()
|
||||
cy.getById('menu-import-markdown-input').attachFile({
|
||||
cy.getById('menu-import-markdown-button').should('be.visible')
|
||||
cy.getById('menu-import-markdown-input').attachFixture({
|
||||
filePath: 'import.md',
|
||||
mimeType: 'text/markdown'
|
||||
})
|
||||
|
@ -26,8 +26,8 @@ describe('Import markdown file', () => {
|
|||
it('import on note with content', () => {
|
||||
cy.setCodemirrorContent('test\nabc')
|
||||
cy.getById('menu-import').click()
|
||||
cy.getById('menu-import-markdown').click()
|
||||
cy.getById('menu-import-markdown-input').attachFile({
|
||||
cy.getById('menu-import-markdown-button').should('be.visible')
|
||||
cy.getById('menu-import-markdown-input').attachFixture({
|
||||
filePath: 'import.md',
|
||||
mimeType: 'text/markdown'
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue