hedgedoc/cypress/integration/import.spec.ts
renovate[bot] b42cb8fc49
Update dependency cypress to v7 (#1183)
* Update dependency cypress to v7

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* Use global beforeEach for config loading

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Erik Michelson <github@erik.michelson.eu>
2021-04-14 22:28:50 +02:00

43 lines
1.6 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Import markdown file', () => {
beforeEach(() => {
cy.visitTestEditor()
})
it('import on blank note', () => {
cy.get('[data-cy="menu-import"]')
.click()
cy.get('[data-cy="menu-import-markdown"]')
.click()
cy.get('[data-cy="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', ':)')
})
it('import on note with content', () => {
cy.codemirrorFill('test\nabc')
cy.get('[data-cy="menu-import"]')
.click()
cy.get('[data-cy="menu-import-markdown"]')
.click()
cy.get('[data-cy="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', ':)')
})
})