Feature/browserstack (#902)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2021-01-06 13:09:33 +01:00 committed by GitHub
parent 900affeac2
commit 887c3b9dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 404 additions and 86 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
const tenChars: string = '0123456789'
const tenChars = '0123456789'
describe('status-bar text-length info', () => {
beforeEach(() => {
@ -22,14 +22,14 @@ describe('status-bar text-length info', () => {
it('color is warning on <= 100 chars remaining', () => {
cy.get('.CodeMirror textarea')
.type(`${tenChars.repeat(10)}`)
.fill(tenChars.repeat(10))
cy.get('.status-bar div:nth-child(2) span:nth-child(2)')
.should('have.class', 'text-warning')
})
it('color is danger on <= 0 chars remaining', () => {
cy.get('.CodeMirror textarea')
.type(`${tenChars.repeat(20)}`)
.fill(tenChars.repeat(20))
cy.get('.status-bar div:nth-child(2) span:nth-child(2)')
.should('have.class', 'text-danger')
})
@ -41,7 +41,7 @@ describe('show warning if content length > configured max length', () => {
cy.get('.CodeMirror textarea')
.type('{ctrl}a', { force: true })
.type('{backspace}')
.type(`${tenChars.repeat(20)}`)
.fill(tenChars.repeat(20))
})
it('show warning alert in renderer and as modal', () => {

View file

@ -41,9 +41,6 @@ describe('Upload', () => {
link: imageUrl
}
})
cy.fixture('acme.png').then(image => {
this.image = image
})
})
it('via button', () => {
cy.get('.fa-upload')
@ -55,27 +52,31 @@ describe('Upload', () => {
})
it('via paste', () => {
const pasteEvent = {
clipboardData: {
files: [Cypress.Blob.base64StringToBlob(this.image, 'image/png')]
cy.fixture('acme.png').then((image: string) => {
const pasteEvent = {
clipboardData: {
files: [Cypress.Blob.base64StringToBlob(image, 'image/png')]
}
}
}
cy.get('.CodeMirror-scroll').trigger('paste', pasteEvent)
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
cy.get('.CodeMirror-scroll').trigger('paste', pasteEvent)
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', `![](${imageUrl})`)
})
})
it('via drag and drop', () => {
const dropEvent = {
dataTransfer: {
files: [Cypress.Blob.base64StringToBlob(this.image, 'image/png')],
effectAllowed: 'uninitialized'
cy.fixture('acme.png').then((image: string) => {
const dropEvent = {
dataTransfer: {
files: [Cypress.Blob.base64StringToBlob(image, 'image/png')],
effectAllowed: 'uninitialized'
}
}
}
cy.get('.CodeMirror-scroll').trigger('dragenter', dropEvent)
cy.get('.CodeMirror-scroll').trigger('drop', dropEvent)
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
cy.get('.CodeMirror-scroll').trigger('dragenter', dropEvent)
cy.get('.CodeMirror-scroll').trigger('drop', dropEvent)
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', `![](${imageUrl})`)
})
})
})