hedgedoc/cypress/integration/import.spec.ts
mrdrogdrog 460badb97b
Update multiple packages (#719)
* Update multiple packages

- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint-config-react-app
- eslint-config-standard
- react-scripts

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* fix type

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* deduplicate code

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Disable test because it doesn't work

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* repair service worker

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* Lazy load mermaid

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* use show error

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* fix tsconfig in cypress

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>

* fix import integration test

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
2020-10-25 21:17:59 +01:00

42 lines
1.7 KiB
TypeScript

describe('Import markdown file', () => {
beforeEach(() => {
cy.visit('/n/test')
cy.get('.btn.active.btn-outline-secondary > i.fa-columns')
.should('exist')
cy.get('.CodeMirror textarea')
.type('{ctrl}a', { force: true })
.type('{backspace}')
})
it('import on blank note', () => {
cy.get('button#editor-menu-import')
.click()
cy.get('.import-md-file')
.click()
cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]')
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', '# Some short import test file')
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
.should('have.text', ':)')
})
it('import on note with content', () => {
cy.get('.CodeMirror textarea')
.type('test\nabc', { force: true })
cy.get('button#editor-menu-import')
.click()
cy.get('.import-md-file')
.click()
cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]')
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', 'test')
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
.should('have.text', 'abc')
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span > span')
.should('have.text', '# Some short import test file')
cy.get('.CodeMirror-code > div:nth-of-type(4) > .CodeMirror-line > span > span')
.should('have.text', ':)')
})
})