2020-11-22 15:50:07 -05:00
|
|
|
/*
|
2021-01-06 15:37:59 -05:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 15:50:07 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-10-09 15:26:04 -04:00
|
|
|
describe('Import markdown file', () => {
|
|
|
|
beforeEach(() => {
|
2021-02-01 16:55:49 -05:00
|
|
|
cy.visitTestEditor()
|
2020-10-09 15:26:04 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on blank note', () => {
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('menu-import').click()
|
|
|
|
cy.getById('menu-import-markdown').click()
|
|
|
|
cy.getById('menu-import-markdown-input').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', ':)')
|
2020-10-09 15:26:04 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on note with content', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('test\nabc')
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('menu-import').click()
|
|
|
|
cy.getById('menu-import-markdown').click()
|
|
|
|
cy.getById('menu-import-markdown-input').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', ':)')
|
2020-10-09 15:26:04 -04:00
|
|
|
})
|
|
|
|
})
|