2020-11-22 15:50:07 -05:00
|
|
|
/*
|
2022-06-08 07:19:51 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 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(() => {
|
2022-01-30 15:46:43 -05:00
|
|
|
cy.visitTestNote()
|
2022-02-05 13:32:58 -05:00
|
|
|
cy.fixture('import.md').as('import')
|
2020-10-09 15:26:04 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on blank note', () => {
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('menu-import').click()
|
|
|
|
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
2022-02-05 13:32:58 -05:00
|
|
|
cy.getByCypressId('menu-import-markdown-input').selectFile(
|
|
|
|
{
|
|
|
|
contents: '@import',
|
|
|
|
fileName: 'import.md',
|
|
|
|
mimeType: 'text/markdown'
|
|
|
|
},
|
|
|
|
{ force: true }
|
|
|
|
)
|
2022-02-13 06:14:01 -05: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 15:26:04 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('import on note with content', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('test\nabc')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('menu-import').click()
|
|
|
|
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
2022-02-05 13:32:58 -05:00
|
|
|
cy.getByCypressId('menu-import-markdown-input').selectFile(
|
|
|
|
{
|
|
|
|
contents: '@import',
|
|
|
|
fileName: 'import.md',
|
|
|
|
mimeType: 'text/markdown'
|
|
|
|
},
|
|
|
|
{ force: true }
|
|
|
|
)
|
2022-02-13 06:14:01 -05: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 15:26:04 -04:00
|
|
|
})
|
|
|
|
})
|