mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-25 20:44:49 -04:00
Switch the base framework from Create React App to Next.JS
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a979b6ffdd
commit
77a60c6c48
361 changed files with 5130 additions and 9605 deletions
|
@ -18,7 +18,7 @@ describe('Autocompletion works for', () => {
|
|||
cy.get('.CodeMirror-hints').should('not.exist')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line').contains('```abnf')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line').contains('```')
|
||||
cy.getMarkdownBody().findById('highlighted-code-block').should('exist')
|
||||
cy.getMarkdownBody().findByCypressId('highlighted-code-block').should('exist')
|
||||
})
|
||||
it('via doubleclick', () => {
|
||||
cy.setCodemirrorContent('```')
|
||||
|
@ -26,7 +26,7 @@ describe('Autocompletion works for', () => {
|
|||
cy.get('.CodeMirror-hints').should('not.exist')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line').contains('```abnf')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line').contains('```')
|
||||
cy.getMarkdownBody().findById('highlighted-code-block').should('exist')
|
||||
cy.getMarkdownBody().findByCypressId('highlighted-code-block').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -109,14 +109,14 @@ describe('Autocompletion works for', () => {
|
|||
cy.get('@codeinput').type('{enter}')
|
||||
cy.get('.CodeMirror-hints').should('not.exist')
|
||||
cy.get('.CodeMirror-activeline').contains('')
|
||||
cy.getMarkdownBody().find('.image-drop').should('exist')
|
||||
cy.getMarkdownBody().findByCypressId('image-placeholder-image-drop').should('exist')
|
||||
})
|
||||
it('via doubleclick', () => {
|
||||
cy.setCodemirrorContent('!')
|
||||
cy.get('.CodeMirror-hints > li').first().dblclick()
|
||||
cy.get('.CodeMirror-hints').should('not.exist')
|
||||
cy.get('.CodeMirror-activeline').contains('')
|
||||
cy.getMarkdownBody().find('.image-drop').should('exist')
|
||||
cy.getMarkdownBody().findByCypressId('image-placeholder-image-drop').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -9,10 +9,14 @@ describe('Diagram codeblock ', () => {
|
|||
cy.visitTestEditor()
|
||||
})
|
||||
|
||||
it('renders markmap', () => {
|
||||
cy.setCodemirrorContent('```markmap\n- pro\n- contra\n```')
|
||||
cy.getMarkdownBody().findById('markmap').children().should('be.visible')
|
||||
})
|
||||
/*
|
||||
TODO: Readd test after fixing https://github.com/hedgedoc/react-client/issues/1709
|
||||
|
||||
it('renders markmap', () => {
|
||||
cy.setCodemirrorContent('```markmap\n- pro\n- contra\n```')
|
||||
cy.getMarkdownBody().findByCypressId('markmap').children().should('be.visible')
|
||||
})
|
||||
*/
|
||||
|
||||
it('renders vega-lite', () => {
|
||||
cy.setCodemirrorContent(
|
||||
|
@ -23,27 +27,27 @@ describe('Diagram codeblock ', () => {
|
|||
|
||||
it('renders graphviz', () => {
|
||||
cy.setCodemirrorContent('```graphviz\ngraph {\na -- b\n}\n```')
|
||||
cy.getMarkdownBody().findById('graphviz').children().should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('graphviz').children().should('be.visible')
|
||||
})
|
||||
|
||||
it('renders mermaid', () => {
|
||||
cy.setCodemirrorContent('```mermaid\ngraph TD;\n A-->B;\n```')
|
||||
cy.getMarkdownBody().find('.mermaid').children().should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('mermaid-frame').children().should('be.visible')
|
||||
})
|
||||
|
||||
it('renders flowcharts', () => {
|
||||
cy.setCodemirrorContent('```flow\nst=>start: Start\ne=>end: End\nst->e\n```')
|
||||
cy.getMarkdownBody().findById('flowchart').children().should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('flowchart').children().should('be.visible')
|
||||
})
|
||||
|
||||
it('renders abc scores', () => {
|
||||
cy.setCodemirrorContent('```abc\nM:4/4\nK:G\n|:GABc dedB:|\n```')
|
||||
cy.getMarkdownBody().findById('abcjs').children().should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('abcjs').children().should('be.visible')
|
||||
})
|
||||
|
||||
it('renders csv as table', () => {
|
||||
cy.setCodemirrorContent('```csv delimiter=; header\na;b;c;d\n1;2;3;4\n```')
|
||||
cy.getMarkdownBody().findById('csv-html-table').first().should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('csv-html-table').first().should('be.visible')
|
||||
})
|
||||
|
||||
it('renders plantuml', () => {
|
||||
|
|
|
@ -10,7 +10,7 @@ const title = 'This is a test title'
|
|||
describe('Document Title', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitTestEditor()
|
||||
cy.getById('view-mode-both').should('exist')
|
||||
cy.getByCypressId('view-mode-both').should('exist')
|
||||
})
|
||||
|
||||
describe('title should be yaml metadata title', () => {
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
describe('Editor mode from URL parameter is used', () => {
|
||||
it('mode view', () => {
|
||||
cy.visitTestEditor('view')
|
||||
cy.get('.splitter.left').should('not.be.visible')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
cy.getByCypressId('splitter-left').should('not.be.visible')
|
||||
cy.getByCypressId('splitter-right').should('be.visible')
|
||||
})
|
||||
it('mode both', () => {
|
||||
cy.visitTestEditor('both')
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.separator').should('exist')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
cy.getByCypressId('splitter-left').should('be.visible')
|
||||
cy.getByCypressId('splitter-separator').should('exist')
|
||||
cy.getByCypressId('splitter-right').should('be.visible')
|
||||
})
|
||||
it('mode edit', () => {
|
||||
cy.visitTestEditor('edit')
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.right').should('not.be.visible')
|
||||
cy.getByCypressId('splitter-left').should('be.visible')
|
||||
cy.getByCypressId('splitter-right').should('not.be.visible')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -14,8 +14,8 @@ describe('Export', () => {
|
|||
})
|
||||
|
||||
it('Markdown', () => {
|
||||
cy.getById('menu-export').click()
|
||||
cy.getById('menu-export-markdown').click()
|
||||
cy.getByCypressId('menu-export').click()
|
||||
cy.getByCypressId('menu-export-markdown').click()
|
||||
cy.get('a[download]')
|
||||
.then(
|
||||
(anchor) =>
|
||||
|
|
|
@ -40,8 +40,8 @@ describe('File upload', () => {
|
|||
)
|
||||
})
|
||||
it('via button', () => {
|
||||
cy.getById('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFixture({
|
||||
cy.getByCypressId('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getByCypressId('editor-toolbar-upload-image-input').attachFixture({
|
||||
filePath: 'demo.png',
|
||||
mimeType: 'image/png'
|
||||
})
|
||||
|
@ -86,8 +86,8 @@ describe('File upload', () => {
|
|||
statusCode: 400
|
||||
}
|
||||
)
|
||||
cy.getById('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getById('editor-toolbar-upload-image-input').attachFixture({
|
||||
cy.getByCypressId('editor-toolbar-upload-image-button').should('be.visible')
|
||||
cy.getByCypressId('editor-toolbar-upload-image-input').attachFixture({
|
||||
filePath: 'demo.png',
|
||||
mimeType: 'image/png'
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Help Dialog', () => {
|
|||
})
|
||||
|
||||
it('ToDo-List', () => {
|
||||
cy.getById('editor-help-button').click()
|
||||
cy.getByCypressId('editor-help-button').click()
|
||||
cy.get('input[type="checkbox"]').should('exist').should('not.be.checked')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
const findHljsCodeBlock = () => {
|
||||
return cy.getMarkdownBody().find('.code-highlighter > code.hljs').should('be.visible')
|
||||
return cy.getMarkdownBody().findByCypressId('code-highlighter').should('be.visible')
|
||||
}
|
||||
|
||||
describe('Code', () => {
|
||||
|
@ -16,17 +16,18 @@ describe('Code', () => {
|
|||
describe('with just the language', () => {
|
||||
it("doesn't show a gutter", () => {
|
||||
cy.setCodemirrorContent('```javascript \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('not.have.class', 'showGutter')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'false')
|
||||
|
||||
findHljsCodeBlock().find('.linenumber').should('not.be.visible')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('not.be.visible')
|
||||
})
|
||||
|
||||
describe('and line wrapping', () => {
|
||||
it("doesn't show a gutter", () => {
|
||||
cy.setCodemirrorContent('```javascript! \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('not.have.class', 'showGutter').should('have.class', 'wrapLines')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'false')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-wrapLines', 'true')
|
||||
|
||||
findHljsCodeBlock().find('.linenumber').should('not.be.visible')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('not.be.visible')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -34,17 +35,18 @@ describe('Code', () => {
|
|||
describe('with the language and show gutter', () => {
|
||||
it('shows the correct line number', () => {
|
||||
cy.setCodemirrorContent('```javascript= \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('have.class', 'showGutter')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
|
||||
findHljsCodeBlock().find('.linenumber').should('be.visible').text().should('eq', '1')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('be.visible').text().should('eq', '1')
|
||||
})
|
||||
|
||||
describe('and line wrapping', () => {
|
||||
it('shows the correct line number', () => {
|
||||
cy.setCodemirrorContent('```javascript=! \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('have.class', 'showGutter').should('have.class', 'wrapLines')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-wrapLines', 'true')
|
||||
|
||||
findHljsCodeBlock().find('.linenumber').should('be.visible').text().should('eq', '1')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('be.visible').text().should('eq', '1')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -52,45 +54,40 @@ describe('Code', () => {
|
|||
describe('with the language, show gutter with a start number', () => {
|
||||
it('shows the correct line number', () => {
|
||||
cy.setCodemirrorContent('```javascript=100 \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('have.class', 'showGutter')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
|
||||
findHljsCodeBlock().find('.linenumber').should('be.visible').text().should('eq', '100')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('be.visible').text().should('eq', '100')
|
||||
})
|
||||
|
||||
it('shows the correct line number and continues in another codeblock', () => {
|
||||
cy.setCodemirrorContent('```javascript=100 \nlet x = 0\nlet y = 1\n```\n\n```javascript=+\nlet y = 2\n```\n')
|
||||
findHljsCodeBlock()
|
||||
.should('have.class', 'showGutter')
|
||||
.first()
|
||||
.find('.linenumber')
|
||||
.first()
|
||||
.should('be.visible')
|
||||
.text()
|
||||
.should('eq', '100')
|
||||
findHljsCodeBlock().first().find('.linenumber').last().should('be.visible').text().should('eq', '101')
|
||||
findHljsCodeBlock().last().find('.linenumber').first().should('be.visible').text().should('eq', '102')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
findHljsCodeBlock().first().findByCypressId('linenumber').first().should('be.visible').text().should('eq', '100')
|
||||
findHljsCodeBlock().first().findByCypressId('linenumber').last().should('be.visible').text().should('eq', '101')
|
||||
findHljsCodeBlock().last().findByCypressId('linenumber').first().should('be.visible').text().should('eq', '102')
|
||||
})
|
||||
|
||||
describe('and line wrapping', () => {
|
||||
it('shows the correct line number', () => {
|
||||
cy.setCodemirrorContent('```javascript=100! \nlet x = 0\n```')
|
||||
findHljsCodeBlock().should('have.class', 'showGutter').should('have.class', 'wrapLines')
|
||||
findHljsCodeBlock().find('.linenumber').should('be.visible').text().should('eq', '100')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-wrapLines', 'true')
|
||||
findHljsCodeBlock().findByCypressId('linenumber').should('be.visible').text().should('eq', '100')
|
||||
})
|
||||
|
||||
it('shows the correct line number and continues in another codeblock', () => {
|
||||
cy.setCodemirrorContent('```javascript=100! \nlet x = 0\nlet y = 1\n```\n\n```javascript=+\nlet y = 2\n```\n')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-showgutter', 'true')
|
||||
findHljsCodeBlock().should('have.attr', 'data-cypress-wrapLines', 'true')
|
||||
findHljsCodeBlock()
|
||||
.should('have.class', 'showGutter')
|
||||
.should('have.class', 'wrapLines')
|
||||
.first()
|
||||
.find('.linenumber')
|
||||
.findByCypressId('linenumber')
|
||||
.first()
|
||||
.should('be.visible')
|
||||
.text()
|
||||
.should('eq', '100')
|
||||
findHljsCodeBlock().first().find('.linenumber').last().should('be.visible').text().should('eq', '101')
|
||||
findHljsCodeBlock().last().find('.linenumber').first().should('be.visible').text().should('eq', '102')
|
||||
findHljsCodeBlock().first().findByCypressId('linenumber').last().should('be.visible').text().should('eq', '101')
|
||||
findHljsCodeBlock().last().findByCypressId('linenumber').first().should('be.visible').text().should('eq', '102')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -98,7 +95,7 @@ describe('Code', () => {
|
|||
it('has a working copy button', () => {
|
||||
cy.setCodemirrorContent('```javascript \nlet x = 0\n```')
|
||||
|
||||
cy.getById('documentIframe').then((element: JQuery<HTMLElement>) => {
|
||||
cy.getByCypressId('documentIframe').then((element: JQuery<HTMLElement>) => {
|
||||
const frame = element.get(0) as HTMLIFrameElement
|
||||
if (frame === null || frame.contentWindow === null) {
|
||||
return cy.wrap(null)
|
||||
|
@ -107,7 +104,7 @@ describe('Code', () => {
|
|||
cy.spy(frame.contentWindow.navigator.clipboard, 'writeText').as('copy')
|
||||
})
|
||||
|
||||
cy.getIframeBody().findById('copy-code-button').click()
|
||||
cy.getIframeBody().findByCypressId('copy-code-button').click()
|
||||
|
||||
cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n')
|
||||
})
|
||||
|
|
|
@ -11,12 +11,12 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('Cards', () => {
|
||||
cy.getById('history-card').should('be.visible')
|
||||
cy.getByCypressId('history-card').should('be.visible')
|
||||
})
|
||||
|
||||
it('Table', () => {
|
||||
cy.getById('history-mode-table').click()
|
||||
cy.getById('history-table').should('be.visible')
|
||||
cy.getByCypressId('history-mode-table').click()
|
||||
cy.getByCypressId('history-table').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -39,13 +39,13 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('in table view', () => {
|
||||
cy.getById('history-mode-table').click()
|
||||
cy.getById('history-table').should('be.visible')
|
||||
cy.getById('history-entry-title').contains('Features')
|
||||
cy.getByCypressId('history-mode-table').click()
|
||||
cy.getByCypressId('history-table').should('be.visible')
|
||||
cy.getByCypressId('history-entry-title').contains('Features')
|
||||
})
|
||||
|
||||
it('in cards view', () => {
|
||||
cy.getById('history-entry-title').contains('Features')
|
||||
cy.getByCypressId('history-entry-title').contains('Features')
|
||||
})
|
||||
})
|
||||
describe('is untitled when not empty', () => {
|
||||
|
@ -66,13 +66,13 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('in table view', () => {
|
||||
cy.getById('history-mode-table').click()
|
||||
cy.getById('history-table').should('be.visible')
|
||||
cy.getById('history-entry-title').contains('Untitled')
|
||||
cy.getByCypressId('history-mode-table').click()
|
||||
cy.getByCypressId('history-table').should('be.visible')
|
||||
cy.getByCypressId('history-entry-title').contains('Untitled')
|
||||
})
|
||||
|
||||
it('in cards view', () => {
|
||||
cy.getById('history-entry-title').contains('Untitled')
|
||||
cy.getByCypressId('history-entry-title').contains('Untitled')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -90,17 +90,17 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('Cards', () => {
|
||||
cy.getById('history-card').should('be.visible')
|
||||
cy.getById('history-entry-pin-button').first().as('pin-button')
|
||||
cy.get('@pin-button').should('have.class', 'pinned').click()
|
||||
cy.get('@pin-button').should('not.have.class', 'pinned')
|
||||
cy.getByCypressId('history-card').should('be.visible')
|
||||
cy.getByCypressId('history-entry-pin-button').first().as('pin-button')
|
||||
cy.get('@pin-button').should('have.attr', 'data-cypress-pinned', 'true').click()
|
||||
cy.get('@pin-button').should('have.attr', 'data-cypress-pinned', 'false')
|
||||
})
|
||||
|
||||
it('Table', () => {
|
||||
cy.getById('history-mode-table').click()
|
||||
cy.getById('history-entry-pin-button').first().as('pin-button')
|
||||
cy.get('@pin-button').should('have.class', 'pinned').click()
|
||||
cy.get('@pin-button').should('not.have.class', 'pinned')
|
||||
cy.getByCypressId('history-mode-table').click()
|
||||
cy.getByCypressId('history-entry-pin-button').first().as('pin-button')
|
||||
cy.get('@pin-button').should('have.attr', 'data-cypress-pinned', 'true').click()
|
||||
cy.get('@pin-button').should('have.attr', 'data-cypress-pinned', 'false')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -112,15 +112,15 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('Cards', () => {
|
||||
cy.getById('history-card').should('be.visible')
|
||||
cy.getById('history-entry-pin-button').first().click()
|
||||
cy.getById('notification-toast').should('be.visible')
|
||||
cy.getByCypressId('history-card').should('be.visible')
|
||||
cy.getByCypressId('history-entry-pin-button').first().click()
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
})
|
||||
|
||||
it('Table', () => {
|
||||
cy.getById('history-mode-table').click()
|
||||
cy.getById('history-entry-pin-button').first().click()
|
||||
cy.getById('notification-toast').should('be.visible')
|
||||
cy.getByCypressId('history-mode-table').click()
|
||||
cy.getByCypressId('history-entry-pin-button').first().click()
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -136,37 +136,37 @@ describe('History', () => {
|
|||
})
|
||||
|
||||
it('works with valid file', () => {
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getById('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
})
|
||||
|
||||
it('fails on invalid file', () => {
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'invalid-history.txt',
|
||||
mimeType: 'text/plain'
|
||||
})
|
||||
cy.getById('notification-toast').should('be.visible')
|
||||
cy.getByCypressId('notification-toast').should('be.visible')
|
||||
})
|
||||
|
||||
it('works when selecting two files with the same name', () => {
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getById('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
cy.getById('import-history-file-button').should('be.visible')
|
||||
cy.getById('import-history-file-input').attachFixture({
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 1).contains('cy-Test')
|
||||
cy.getByCypressId('import-history-file-button').should('be.visible')
|
||||
cy.getByCypressId('import-history-file-input').attachFixture({
|
||||
filePath: 'history-2.json',
|
||||
fileName: 'history.json',
|
||||
mimeType: 'application/json'
|
||||
})
|
||||
cy.getById('history-entry-title').should('have.length', 2).contains('cy-Test2')
|
||||
cy.getByCypressId('history-entry-title').should('have.length', 2).contains('cy-Test2')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('Iframe capsule', () => {
|
|||
|
||||
it('shows a clickable click shield instead of the iframe', () => {
|
||||
cy.setCodemirrorContent('<iframe src="https://example.org"></iframe>')
|
||||
cy.getMarkdownBody().findById('iframe-capsule-click-shield').should('exist').click()
|
||||
cy.getMarkdownBody().findByCypressId('iframe-capsule-click-shield').should('exist').click()
|
||||
cy.getMarkdownBody().find('iframe').should('exist').should('have.attr', 'src', 'https://example.org')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -10,9 +10,9 @@ describe('Import markdown file', () => {
|
|||
})
|
||||
|
||||
it('import on blank note', () => {
|
||||
cy.getById('menu-import').click()
|
||||
cy.getById('menu-import-markdown-button').should('be.visible')
|
||||
cy.getById('menu-import-markdown-input').attachFixture({
|
||||
cy.getByCypressId('menu-import').click()
|
||||
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
||||
cy.getByCypressId('menu-import-markdown-input').attachFixture({
|
||||
filePath: 'import.md',
|
||||
mimeType: 'text/markdown'
|
||||
})
|
||||
|
@ -25,9 +25,9 @@ describe('Import markdown file', () => {
|
|||
|
||||
it('import on note with content', () => {
|
||||
cy.setCodemirrorContent('test\nabc')
|
||||
cy.getById('menu-import').click()
|
||||
cy.getById('menu-import-markdown-button').should('be.visible')
|
||||
cy.getById('menu-import-markdown-input').attachFixture({
|
||||
cy.getByCypressId('menu-import').click()
|
||||
cy.getByCypressId('menu-import-markdown-button').should('be.visible')
|
||||
cy.getByCypressId('menu-import-markdown-input').attachFixture({
|
||||
filePath: 'import.md',
|
||||
mimeType: 'text/markdown'
|
||||
})
|
||||
|
|
|
@ -22,39 +22,39 @@ describe('Intro page', () => {
|
|||
})
|
||||
cy.visit('/')
|
||||
|
||||
cy.getById('documentIframe').should('not.exist')
|
||||
cy.getByCypressId('documentIframe').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('features button', () => {
|
||||
it('is hidden when logged in', () => {
|
||||
cy.getById('features-button').should('not.exist')
|
||||
cy.getByCypressId('features-button').should('not.exist')
|
||||
})
|
||||
|
||||
it('is visible when logged out', () => {
|
||||
cy.logout()
|
||||
cy.getById('features-button').should('exist')
|
||||
cy.getByCypressId('features-button').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('sign in button', () => {
|
||||
it('is hidden when logged in', () => {
|
||||
cy.getById('sign-in-button').should('not.exist')
|
||||
cy.getByCypressId('sign-in-button').should('not.exist')
|
||||
})
|
||||
|
||||
it('is visible when logged out', () => {
|
||||
cy.logout()
|
||||
cy.getById('sign-in-button').should('exist')
|
||||
cy.getByCypressId('sign-in-button').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('version dialog', () => {
|
||||
it('can be opened and closed', () => {
|
||||
cy.getById('version-modal').should('not.exist')
|
||||
cy.getById('show-version-modal').click()
|
||||
cy.getById('version-modal').should('be.visible')
|
||||
cy.getById('version-modal').find('.modal-header .close').click()
|
||||
cy.getById('version-modal').should('not.exist')
|
||||
cy.getByCypressId('version-modal').should('not.exist')
|
||||
cy.getByCypressId('show-version-modal').click()
|
||||
cy.getByCypressId('version-modal').should('be.visible')
|
||||
cy.getByCypressId('version-modal').find('.modal-header .close').click()
|
||||
cy.getByCypressId('version-modal').should('not.exist')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('Languages', () => {
|
|||
})
|
||||
|
||||
it('all languages are available', () => {
|
||||
cy.getById('language-picker').find('option').as('languages')
|
||||
cy.getByCypressId('language-picker').find('option').as('languages')
|
||||
cy.get('@languages').should('have.length', 28)
|
||||
languages.forEach((language) => {
|
||||
cy.get('@languages').contains(language)
|
||||
|
@ -20,9 +20,9 @@ describe('Languages', () => {
|
|||
})
|
||||
|
||||
it('language changes affect the UI', () => {
|
||||
cy.getById('language-picker').select('English')
|
||||
cy.getById('new-note-button').find('span').contains('New note')
|
||||
cy.getById('language-picker').select('Deutsch')
|
||||
cy.getById('new-note-button').find('span').contains('Neue Notiz')
|
||||
cy.getByCypressId('language-picker').select('English')
|
||||
cy.getByCypressId('new-note-button').find('span').contains('New note')
|
||||
cy.getByCypressId('language-picker').select('Deutsch')
|
||||
cy.getByCypressId('new-note-button').find('span').contains('Neue Notiz')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,9 +12,9 @@ describe('Links Intro', () => {
|
|||
})
|
||||
|
||||
it('History', () => {
|
||||
cy.getById('navLinkHistory').click()
|
||||
cy.getByCypressId('navLinkHistory').click()
|
||||
cy.url().should('include', '/history')
|
||||
cy.getById('navLinkIntro').click()
|
||||
cy.getByCypressId('navLinkIntro').click()
|
||||
cy.url().should('include', '/intro')
|
||||
})
|
||||
|
||||
|
@ -24,29 +24,29 @@ describe('Links Intro', () => {
|
|||
})
|
||||
|
||||
it('New guest note', () => {
|
||||
cy.getById('new-guest-note-button').click()
|
||||
cy.getByCypressId('new-guest-note-button').click()
|
||||
cy.url().should('include', '/new')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Menu Buttons logged in', () => {
|
||||
it('New note', () => {
|
||||
cy.getById('new-note-button').click()
|
||||
cy.getByCypressId('new-note-button').click()
|
||||
cy.url().should('include', '/new')
|
||||
})
|
||||
|
||||
describe('User Menu', () => {
|
||||
beforeEach(() => {
|
||||
cy.getById('user-dropdown').click()
|
||||
cy.getByCypressId('user-dropdown').click()
|
||||
})
|
||||
|
||||
it('Features', () => {
|
||||
cy.getById('user-dropdown-features-button').click()
|
||||
cy.getByCypressId('user-dropdown-features-button').click()
|
||||
cy.url().should('include', '/features')
|
||||
})
|
||||
|
||||
it('Profile', () => {
|
||||
cy.getById('user-dropdown-profile-button').click()
|
||||
cy.getByCypressId('user-dropdown-profile-button').click()
|
||||
cy.url().should('include', '/profile')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -13,14 +13,14 @@ describe('Link gets replaced with embedding: ', () => {
|
|||
|
||||
it('GitHub Gist', () => {
|
||||
cy.setCodemirrorContent('https://gist.github.com/schacon/1')
|
||||
cy.getMarkdownBody().findById('click-shield-gist').find('.preview-background').parent().click()
|
||||
cy.getMarkdownBody().findById('gh-gist').should('be.visible')
|
||||
cy.getMarkdownBody().findByCypressId('click-shield-gist').find('.preview-background').parent().click()
|
||||
cy.getMarkdownBody().findByCypressId('gh-gist').should('be.visible')
|
||||
})
|
||||
|
||||
it('YouTube', () => {
|
||||
cy.setCodemirrorContent('https://www.youtube.com/watch?v=YE7VzlLtp-4')
|
||||
cy.getMarkdownBody()
|
||||
.findById('click-shield-youtube')
|
||||
.findByCypressId('click-shield-youtube')
|
||||
.find('.preview-background')
|
||||
.should('have.attr', 'src', 'https://i.ytimg.com/vi/YE7VzlLtp-4/maxresdefault.jpg')
|
||||
.parent()
|
||||
|
@ -46,7 +46,7 @@ describe('Link gets replaced with embedding: ', () => {
|
|||
)
|
||||
cy.setCodemirrorContent('https://vimeo.com/23237102')
|
||||
cy.getMarkdownBody()
|
||||
.findById('click-shield-vimeo')
|
||||
.findByCypressId('click-shield-vimeo')
|
||||
.find('.preview-background')
|
||||
.should('have.attr', 'src', 'https://i.vimeocdn.com/video/503631401_640.jpg')
|
||||
.parent()
|
||||
|
@ -57,7 +57,7 @@ describe('Link gets replaced with embedding: ', () => {
|
|||
it('Asciinema', () => {
|
||||
cy.setCodemirrorContent('https://asciinema.org/a/117928')
|
||||
cy.getMarkdownBody()
|
||||
.findById('click-shield-asciinema')
|
||||
.findByCypressId('click-shield-asciinema')
|
||||
.find('.preview-background')
|
||||
.should('have.attr', 'src', 'https://asciinema.org/a/117928.png')
|
||||
.parent()
|
||||
|
|
|
@ -14,21 +14,21 @@ describe('The status bar text length info', () => {
|
|||
})
|
||||
|
||||
it('shows the maximal length of the document as number of available characters in the tooltip', () => {
|
||||
cy.getById('remainingCharacters').attribute('title').should('contain', ' 200 ')
|
||||
cy.getByCypressId('remainingCharacters').attribute('title').should('contain', ' 200 ')
|
||||
})
|
||||
|
||||
it('color is set to "warning" on <= 100 characters remaining', () => {
|
||||
cy.setCodemirrorContent(warningTestContent)
|
||||
cy.getById('remainingCharacters').should('have.class', 'text-warning')
|
||||
cy.getByCypressId('remainingCharacters').should('have.class', 'text-warning')
|
||||
})
|
||||
|
||||
it('color is set to danger on <= 0 characters remaining', () => {
|
||||
cy.setCodemirrorContent(dangerTestContent)
|
||||
cy.getById('remainingCharacters').should('have.class', 'text-danger')
|
||||
cy.getByCypressId('remainingCharacters').should('have.class', 'text-danger')
|
||||
})
|
||||
|
||||
it('opens a modal', () => {
|
||||
cy.setCodemirrorContent(tooMuchTestContent)
|
||||
cy.getById('limitReachedModal').should('be.visible')
|
||||
cy.getByCypressId('limitReachedModal').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -29,63 +29,63 @@ describe('Motd', () => {
|
|||
it('shows the correct alert Motd text', () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
})
|
||||
|
||||
it('can be dismissed', () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getById('motd-dismiss')
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd-dismiss')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
})
|
||||
|
||||
it("won't show again after dismiss and reload", () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getById('motd-dismiss')
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd-dismiss')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
cy.reload()
|
||||
cy.get('main').should('exist')
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
})
|
||||
|
||||
it('will show again after reload without dismiss', () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
cy.reload()
|
||||
cy.get('main').should('exist')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
})
|
||||
|
||||
it("won't show again after dismiss and page navigation", () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.getById('motd').contains(motdMockContent)
|
||||
cy.getById('motd-dismiss')
|
||||
cy.getByCypressId('motd').contains(motdMockContent)
|
||||
cy.getByCypressId('motd-dismiss')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getById('navLinkHistory').click()
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
cy.getByCypressId('navLinkHistory').click()
|
||||
cy.get('main').should('exist')
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
})
|
||||
|
||||
it("won't show if no file exists", () => {
|
||||
cy.visit('/')
|
||||
cy.get('main').should('exist')
|
||||
cy.getById('motd').should('not.exist')
|
||||
cy.getByCypressId('motd').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -53,22 +53,22 @@ describe('profile page', () => {
|
|||
|
||||
describe('access tokens', () => {
|
||||
it('list existing tokens', () => {
|
||||
cy.getById('access-token-label').contains('cypress-App')
|
||||
cy.getByCypressId('access-token-label').contains('cypress-App')
|
||||
})
|
||||
|
||||
it('delete token', () => {
|
||||
cy.getById('access-token-delete-button').click()
|
||||
cy.getById('access-token-modal-delete').as('deletion-modal')
|
||||
cy.getByCypressId('access-token-delete-button').click()
|
||||
cy.getByCypressId('access-token-modal-delete').as('deletion-modal')
|
||||
cy.get('@deletion-modal').should('be.visible').find('.modal-footer .btn-danger').click()
|
||||
cy.get('@deletion-modal').should('not.exist')
|
||||
})
|
||||
|
||||
it('add token', () => {
|
||||
cy.getById('access-token-add-button').should('be.disabled')
|
||||
cy.getById('access-token-add-input-label').type('cypress')
|
||||
cy.getById('access-token-modal-add').should('not.exist')
|
||||
cy.getById('access-token-add-button').should('not.be.disabled').click()
|
||||
cy.getById('access-token-modal-add')
|
||||
cy.getByCypressId('access-token-add-button').should('be.disabled')
|
||||
cy.getByCypressId('access-token-add-input-label').type('cypress')
|
||||
cy.getByCypressId('access-token-modal-add').should('not.exist')
|
||||
cy.getByCypressId('access-token-add-button').should('not.be.disabled').click()
|
||||
cy.getByCypressId('access-token-modal-add')
|
||||
.should('be.visible')
|
||||
.find('input[readonly]')
|
||||
.should('have.value', 'c-y-p-r-e-s-s')
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('Short code gets replaced or rendered: ', () => {
|
|||
describe('youtube', () => {
|
||||
it('renders click-shield', () => {
|
||||
cy.setCodemirrorContent(`{%youtube YE7VzlLtp-4 %}`)
|
||||
cy.getMarkdownBody().findById('click-shield-youtube')
|
||||
cy.getMarkdownBody().findByCypressId('click-shield-youtube')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -34,7 +34,7 @@ const initLoggedOutTestWithCustomAuthProviders = (
|
|||
describe('When logged-in, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
cy.visit('/')
|
||||
cy.getById('sign-in-button').should('not.exist')
|
||||
cy.getByCypressId('sign-in-button').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -42,7 +42,7 @@ describe('When logged-out ', () => {
|
|||
describe('and no auth-provider is enabled, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, {})
|
||||
cy.getById('sign-in-button').should('not.exist')
|
||||
cy.getByCypressId('sign-in-button').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -51,14 +51,14 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
local: true
|
||||
})
|
||||
cy.getById('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
||||
it('sign-in button points to login route: ldap', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
ldap: true
|
||||
})
|
||||
cy.getById('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -67,7 +67,7 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
saml: true
|
||||
})
|
||||
cy.getById('sign-in-button')
|
||||
cy.getByCypressId('sign-in-button')
|
||||
.should('be.visible')
|
||||
// The absolute URL is used because it is defined as API base URL absolute.
|
||||
.should('have.attr', 'href', '/mock-backend/auth/saml')
|
||||
|
@ -80,7 +80,7 @@ describe('When logged-out ', () => {
|
|||
saml: true,
|
||||
github: true
|
||||
})
|
||||
cy.getById('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -90,7 +90,7 @@ describe('When logged-out ', () => {
|
|||
saml: true,
|
||||
local: true
|
||||
})
|
||||
cy.getById('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -10,33 +10,33 @@ describe('Split view', () => {
|
|||
})
|
||||
|
||||
it('can show both panes', () => {
|
||||
cy.getById('view-mode-both').click()
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
cy.getByCypressId('view-mode-both').click()
|
||||
cy.getByCypressId('splitter-left').should('be.visible')
|
||||
cy.getByCypressId('splitter-right').should('be.visible')
|
||||
})
|
||||
|
||||
it('can show only preview pane', () => {
|
||||
cy.getById('view-mode-preview').click()
|
||||
cy.get('.splitter.left').should('be.not.visible')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
cy.getByCypressId('view-mode-preview').click()
|
||||
cy.getByCypressId('splitter-left').should('be.not.visible')
|
||||
cy.getByCypressId('splitter-right').should('be.visible')
|
||||
})
|
||||
|
||||
it('can show only editor pane', () => {
|
||||
cy.getById('view-mode-editor').click()
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.right').should('be.not.visible')
|
||||
cy.getByCypressId('view-mode-editor').click()
|
||||
cy.getByCypressId('splitter-left').should('be.visible')
|
||||
cy.getByCypressId('splitter-right').should('be.not.visible')
|
||||
})
|
||||
|
||||
it('can change the split by dragging', () => {
|
||||
cy.get('.splitter.left').then((leftPanebefore) => {
|
||||
cy.getByCypressId('splitter-left').then((leftPanebefore) => {
|
||||
const widthBefore = leftPanebefore.outerWidth()
|
||||
|
||||
cy.getById('view-mode-both').click()
|
||||
cy.get('.split-divider').should('be.visible').trigger('mousedown', { buttons: 1 })
|
||||
cy.getByCypressId('view-mode-both').click()
|
||||
cy.getByCypressId('split-divider').should('be.visible').trigger('mousedown', { buttons: 1 })
|
||||
cy.document().trigger('mousemove', { buttons: 1, pageX: 0, pageY: 0 })
|
||||
cy.get('.split-divider').trigger('mouseup')
|
||||
cy.getByCypressId('split-divider').trigger('mouseup')
|
||||
|
||||
cy.get('.splitter.left').should('not.eq', widthBefore)
|
||||
cy.getByCypressId('splitter-left').should('not.eq', widthBefore)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -26,17 +26,17 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format as bold', () => {
|
||||
cy.getById('format-bold').click()
|
||||
cy.getByCypressId('format-bold').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `**${testText}**`)
|
||||
})
|
||||
|
||||
it('should format as italic', () => {
|
||||
cy.getById('format-italic').click()
|
||||
cy.getByCypressId('format-italic').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `*${testText}*`)
|
||||
})
|
||||
|
||||
it('should format as underline', () => {
|
||||
cy.getById('format-underline').click()
|
||||
cy.getByCypressId('format-underline').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `++${testText}++`)
|
||||
})
|
||||
|
||||
|
@ -46,17 +46,17 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format as subscript', () => {
|
||||
cy.getById('format-subscript').click()
|
||||
cy.getByCypressId('format-subscript').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `~${testText}~`)
|
||||
})
|
||||
|
||||
it('should format as superscript', () => {
|
||||
cy.getById('format-superscript').click()
|
||||
cy.getByCypressId('format-superscript').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `^${testText}^`)
|
||||
})
|
||||
|
||||
it('should format the line as code block', () => {
|
||||
cy.getById('format-code-block').click()
|
||||
cy.getByCypressId('format-code-block').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span').should('have.text', '```')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span').should('have.text', testText)
|
||||
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span').should(
|
||||
|
@ -66,65 +66,65 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format links', () => {
|
||||
cy.getById('format-link').click()
|
||||
cy.getByCypressId('format-link').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `[${testText}](https://)`)
|
||||
})
|
||||
|
||||
it('should format as image', () => {
|
||||
cy.getById('format-image').click()
|
||||
cy.getByCypressId('format-image').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', ``)
|
||||
})
|
||||
})
|
||||
|
||||
it('should format line as heading', () => {
|
||||
cy.getById('format-heading').click()
|
||||
cy.getByCypressId('format-heading').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `# ${testText}`)
|
||||
cy.get('.fa-header').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `## ${testText}`)
|
||||
})
|
||||
|
||||
it('should format the line as code', () => {
|
||||
cy.getById('format-code-block').click()
|
||||
cy.getByCypressId('format-code-block').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span').should('have.text', '```')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span').should('have.text', testText)
|
||||
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span').should('have.text', '```')
|
||||
})
|
||||
|
||||
it('should add a quote', () => {
|
||||
cy.getById('format-block-quote').click()
|
||||
cy.getByCypressId('format-block-quote').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `> ${testText}`)
|
||||
cy.getById('format-block-quote').click()
|
||||
cy.getByCypressId('format-block-quote').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `> > ${testText}`)
|
||||
})
|
||||
|
||||
it('should format as unordered list', () => {
|
||||
cy.getById('format-unordered-list').click()
|
||||
cy.getByCypressId('format-unordered-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `- ${testText}`)
|
||||
cy.getById('format-unordered-list').click()
|
||||
cy.getByCypressId('format-unordered-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `- - ${testText}`)
|
||||
})
|
||||
|
||||
it('should format as ordered list', () => {
|
||||
cy.getById('format-ordered-list').click()
|
||||
cy.getByCypressId('format-ordered-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `1. ${testText}`)
|
||||
cy.getById('format-ordered-list').click()
|
||||
cy.getByCypressId('format-ordered-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `1. 1. ${testText}`)
|
||||
})
|
||||
|
||||
it('should format as check list', () => {
|
||||
cy.getById('format-check-list').click()
|
||||
cy.getByCypressId('format-check-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `- [ ] ${testText}`)
|
||||
cy.getById('format-check-list').click()
|
||||
cy.getByCypressId('format-check-list').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `- [ ] - [ ] ${testText}`)
|
||||
})
|
||||
|
||||
it('should insert links', () => {
|
||||
cy.getById('format-link').click()
|
||||
cy.getByCypressId('format-link').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `${testText}[](https://)`)
|
||||
})
|
||||
|
||||
it('should insert an empty image link', () => {
|
||||
cy.getById('format-image').click()
|
||||
cy.getByCypressId('format-image').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `${testText}`)
|
||||
})
|
||||
})
|
||||
|
@ -137,30 +137,30 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format as link', () => {
|
||||
cy.getById('format-link').click()
|
||||
cy.getByCypressId('format-link').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', `[](${testLink})`)
|
||||
})
|
||||
|
||||
it('should format as image', () => {
|
||||
cy.getById('format-image').click()
|
||||
cy.getByCypressId('format-image').click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span').should('have.text', ``)
|
||||
})
|
||||
})
|
||||
|
||||
describe('for no text', () => {
|
||||
it('should add an empty code block', () => {
|
||||
cy.getById('format-code-block').click()
|
||||
cy.getByCypressId('format-code-block').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span').should('have.text', '```')
|
||||
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span').should('have.text', '```')
|
||||
})
|
||||
|
||||
it('should insert lines', () => {
|
||||
cy.getById('format-add-line').click()
|
||||
cy.getByCypressId('format-add-line').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span').should('have.text', '----')
|
||||
})
|
||||
|
||||
it('should add a collapsable block', () => {
|
||||
cy.getById('format-collapsable-block').click()
|
||||
cy.getByCypressId('format-collapsable-block').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span').should(
|
||||
'have.text',
|
||||
':::spoiler Toggle label'
|
||||
|
@ -168,36 +168,34 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should add a comment', () => {
|
||||
cy.getById('format-add-comment').click()
|
||||
cy.getByCypressId('format-add-comment').click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span').should('have.text', '> []')
|
||||
})
|
||||
})
|
||||
|
||||
describe('for new tables', () => {
|
||||
beforeEach(() => {
|
||||
cy.getById('table-size-picker-popover').should('not.exist')
|
||||
cy.getById('table-size-picker-button').last().click()
|
||||
cy.getById('table-size-picker-popover').should('be.visible')
|
||||
cy.getByCypressId('table-size-picker-popover').should('not.exist')
|
||||
cy.getByCypressId('table-size-picker-button').last().click()
|
||||
cy.getByCypressId('table-size-picker-popover').should('be.visible')
|
||||
})
|
||||
|
||||
it('should select table size', () => {
|
||||
cy.getById('table-size-picker-popover')
|
||||
.find('.table-container > .table-cell:nth-of-type(25)')
|
||||
cy.getByCypressId('table-size-picker-popover')
|
||||
.find('[data-cypress-col=5][data-cypress-row=3]')
|
||||
.trigger('mouseover')
|
||||
cy.getById('table-size-picker-popover')
|
||||
.find('.table-container > .table-cell[data-cypress-selected="true"]')
|
||||
.should('have.length', 15)
|
||||
cy.getById('table-size-picker-popover').find('.popover-header').contains('5x3')
|
||||
cy.getById('table-size-picker-popover').find('.table-container > .table-cell:nth-of-type(25)').click()
|
||||
cy.getByCypressId('table-size-picker-popover').find('[data-cypress-selected="true"]').should('have.length', 15)
|
||||
cy.getByCypressId('table-size-picker-popover').find('.popover-header').contains('5x3')
|
||||
cy.getByCypressId('table-size-picker-popover').find('[data-cypress-col=5][data-cypress-row=3]').click()
|
||||
})
|
||||
|
||||
it('should open a custom table size in the modal', () => {
|
||||
cy.getById('custom-table-size-modal').should('not.exist')
|
||||
cy.getById('show-custom-table-modal').first().click()
|
||||
cy.getById('custom-table-size-modal').should('be.visible')
|
||||
cy.getById('custom-table-size-modal').find('input').first().type('5')
|
||||
cy.getById('custom-table-size-modal').find('input').last().type('3')
|
||||
cy.getById('custom-table-size-modal').find('.modal-footer > button').click()
|
||||
cy.getByCypressId('custom-table-size-modal').should('not.exist')
|
||||
cy.getByCypressId('show-custom-table-modal').first().click()
|
||||
cy.getByCypressId('custom-table-size-modal').should('be.visible')
|
||||
cy.getByCypressId('custom-table-size-modal').find('input').first().type('5')
|
||||
cy.getByCypressId('custom-table-size-modal').find('input').last().type('3')
|
||||
cy.getByCypressId('custom-table-size-modal').find('.modal-footer > button').click()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -227,7 +225,7 @@ describe('Toolbar Buttons', () => {
|
|||
describe('for the emoji-picker', () => {
|
||||
it('should open overlay', () => {
|
||||
cy.get('emoji-picker').should('not.be.visible')
|
||||
cy.getById('show-emoji-picker').click()
|
||||
cy.getByCypressId('show-emoji-picker').click()
|
||||
cy.get('emoji-picker').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,32 +12,32 @@ describe('Test word count with', () => {
|
|||
it('empty note', () => {
|
||||
cy.setCodemirrorContent('')
|
||||
cy.wait(500)
|
||||
cy.getById('sidebar-btn-document-info').click()
|
||||
cy.getById('document-info-modal').should('be.visible')
|
||||
cy.getById('document-info-word-count').should('have.text', '0')
|
||||
cy.getByCypressId('sidebar-btn-document-info').click()
|
||||
cy.getByCypressId('document-info-modal').should('be.visible')
|
||||
cy.getByCypressId('document-info-word-count').should('have.text', '0')
|
||||
})
|
||||
|
||||
it('simple words', () => {
|
||||
cy.setCodemirrorContent('five words should be enough')
|
||||
cy.wait(500)
|
||||
cy.getById('sidebar-btn-document-info').click()
|
||||
cy.getById('document-info-modal').should('be.visible')
|
||||
cy.getById('document-info-word-count').should('have.text', '5')
|
||||
cy.getByCypressId('sidebar-btn-document-info').click()
|
||||
cy.getByCypressId('document-info-modal').should('be.visible')
|
||||
cy.getByCypressId('document-info-word-count').should('have.text', '5')
|
||||
})
|
||||
|
||||
it('excluded codeblocks', () => {
|
||||
cy.setCodemirrorContent('```\nthis is should be ignored\n```\n\ntwo `words`')
|
||||
cy.wait(500)
|
||||
cy.getById('sidebar-btn-document-info').click()
|
||||
cy.getById('document-info-modal').should('be.visible')
|
||||
cy.getById('document-info-word-count').should('have.text', '2')
|
||||
cy.getByCypressId('sidebar-btn-document-info').click()
|
||||
cy.getByCypressId('document-info-modal').should('be.visible')
|
||||
cy.getByCypressId('document-info-word-count').should('have.text', '2')
|
||||
})
|
||||
|
||||
it('excluded images', () => {
|
||||
cy.setCodemirrorContent(' not ignored text')
|
||||
cy.wait(500)
|
||||
cy.getById('sidebar-btn-document-info').click()
|
||||
cy.getById('document-info-modal').should('be.visible')
|
||||
cy.getById('document-info-word-count').should('have.text', '3')
|
||||
cy.getByCypressId('sidebar-btn-document-info').click()
|
||||
cy.getByCypressId('document-info-modal').should('be.visible')
|
||||
cy.getByCypressId('document-info-word-count').should('have.text', '3')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -11,16 +11,16 @@ describe('YAML Array for deprecated syntax of document tags in frontmatter', ()
|
|||
|
||||
it('is shown when using old syntax', () => {
|
||||
cy.setCodemirrorContent('---\ntags: a, b, c\n---')
|
||||
cy.getIframeBody().findById('yamlArrayDeprecationAlert').should('be.visible')
|
||||
cy.getIframeBody().findByCypressId('yamlArrayDeprecationAlert').should('be.visible')
|
||||
})
|
||||
|
||||
it("isn't shown when using inline yaml-array", () => {
|
||||
cy.setCodemirrorContent("---\ntags: ['a', 'b', 'c']\n---")
|
||||
cy.getIframeBody().findById('yamlArrayDeprecationAlert').should('not.exist')
|
||||
cy.getIframeBody().findByCypressId('yamlArrayDeprecationAlert').should('not.exist')
|
||||
})
|
||||
|
||||
it("isn't shown when using multi line yaml-array", () => {
|
||||
cy.setCodemirrorContent('---\ntags:\n - a\n - b\n - c\n---')
|
||||
cy.getIframeBody().findById('yamlArrayDeprecationAlert').should('not.exist')
|
||||
cy.getIframeBody().findByCypressId('yamlArrayDeprecationAlert').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue