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(() => {
|
|
|
|
cy.visit('/n/test')
|
|
|
|
})
|
|
|
|
|
|
|
|
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]')
|
2020-10-25 16:17:59 -04:00
|
|
|
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
|
2020-10-09 15:26:04 -04:00
|
|
|
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', () => {
|
2021-01-11 17:22:11 -05:00
|
|
|
|
2021-01-15 16:54:43 -05:00
|
|
|
cy.codemirrorFill('test\nabc')
|
2020-10-09 15:26:04 -04:00
|
|
|
cy.get('button#editor-menu-import')
|
|
|
|
.click()
|
|
|
|
cy.get('.import-md-file')
|
|
|
|
.click()
|
|
|
|
cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]')
|
2020-10-25 16:17:59 -04:00
|
|
|
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
|
2020-10-09 15:26:04 -04:00
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
2020-10-25 16:17:59 -04:00
|
|
|
.should('have.text', 'test')
|
2020-10-09 15:26:04 -04:00
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
|
2020-10-25 16:17:59 -04:00
|
|
|
.should('have.text', 'abc')
|
2020-10-09 15:26:04 -04:00
|
|
|
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', ':)')
|
|
|
|
})
|
|
|
|
})
|