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(() => {
|
2022-01-30 20:46:43 +00:00
|
|
|
cy.visitTestNote()
|
2022-02-05 18:32:58 +00:00
|
|
|
cy.fixture('import.md').as('import')
|
2020-10-09 19:26:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on blank note', () => {
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('menu-import').click()
|
|
|
|
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
2022-02-05 18:32:58 +00:00
|
|
|
cy.getByCypressId('menu-import-markdown-input').selectFile(
|
|
|
|
{
|
|
|
|
contents: '@import',
|
|
|
|
fileName: 'import.md',
|
|
|
|
mimeType: 'text/markdown'
|
|
|
|
},
|
|
|
|
{ force: true }
|
|
|
|
)
|
2022-02-13 11:14:01 +00:00
|
|
|
cy.get('.cm-editor .cm-line:nth-child(1)').should('have.text', '# Some short import test file')
|
|
|
|
cy.get('.cm-editor .cm-line:nth-child(2)').should('have.text', ':)')
|
2020-10-09 19:26:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on note with content', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('test\nabc')
|
2021-12-25 15:44:24 +00:00
|
|
|
cy.getByCypressId('menu-import').click()
|
|
|
|
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
2022-02-05 18:32:58 +00:00
|
|
|
cy.getByCypressId('menu-import-markdown-input').selectFile(
|
|
|
|
{
|
|
|
|
contents: '@import',
|
|
|
|
fileName: 'import.md',
|
|
|
|
mimeType: 'text/markdown'
|
|
|
|
},
|
|
|
|
{ force: true }
|
|
|
|
)
|
2022-02-13 11:14:01 +00:00
|
|
|
cy.get('.cm-editor .cm-line:nth-child(1)').should('have.text', 'test')
|
|
|
|
cy.get('.cm-editor .cm-line:nth-child(2)').should('have.text', 'abc')
|
|
|
|
cy.get('.cm-editor .cm-line:nth-child(3)').should('have.text', '# Some short import test file')
|
|
|
|
cy.get('.cm-editor .cm-line:nth-child(4)').should('have.text', ':)')
|
2020-10-09 19:26:04 +00:00
|
|
|
})
|
|
|
|
})
|