2020-11-22 20:50:07 +00:00
|
|
|
/*
|
2021-01-06 20:37:59 +00:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-10-09 19:26:04 +00:00
|
|
|
describe('Import markdown file', () => {
|
|
|
|
beforeEach(() => {
|
2021-02-01 21:55:49 +00:00
|
|
|
cy.visitTestEditor()
|
2020-10-09 19:26:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on blank note', () => {
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import"]')
|
2020-10-09 19:26:04 +00:00
|
|
|
.click()
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import-markdown"]')
|
2020-10-09 19:26:04 +00:00
|
|
|
.click()
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import-markdown-input"]')
|
2020-10-25 20:17:59 +00:00
|
|
|
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
|
2020-10-09 19:26:04 +00: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 22:22:11 +00:00
|
|
|
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('test\nabc')
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import"]')
|
2020-10-09 19:26:04 +00:00
|
|
|
.click()
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import-markdown"]')
|
2020-10-09 19:26:04 +00:00
|
|
|
.click()
|
2021-10-17 19:20:23 +00:00
|
|
|
cy.get('[data-cypress-id="menu-import-markdown-input"]')
|
2020-10-25 20:17:59 +00:00
|
|
|
.attachFile({ filePath: 'import.md', mimeType: 'text/markdown' })
|
2020-10-09 19:26:04 +00:00
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
2020-10-25 20:17:59 +00:00
|
|
|
.should('have.text', 'test')
|
2020-10-09 19:26:04 +00:00
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
|
2020-10-25 20:17:59 +00:00
|
|
|
.should('have.text', 'abc')
|
2020-10-09 19:26:04 +00: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', ':)')
|
|
|
|
})
|
|
|
|
})
|