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:
Tilman Vatteroth 2021-12-11 21:17:23 +01:00 committed by GitHub
parent d4251519e2
commit 03725f5512
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 80 additions and 58 deletions

View file

@ -0,0 +1 @@
Invalid json

View file

@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC0-1.0

View file

@ -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(`![](${imageUrl})`)
})
@ -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]()')
})

View file

@ -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'

View file

@ -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'
})