mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 03:05:19 -04:00
Add cypress id attribute only in test mode (#1566)
* Add function for test attribute Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Adjust components Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Fix naming of attribute Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Rename method Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Rename method, interface, attribute and use interface Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Lint and format fix Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
2abe40ef1d
commit
a398660c18
48 changed files with 229 additions and 167 deletions
|
@ -12,7 +12,7 @@ describe('Diagram codeblock ', () => {
|
|||
it('renders markmap', () => {
|
||||
cy.setCodemirrorContent('```markmap\n- pro\n- contra\n```')
|
||||
cy.getMarkdownBody()
|
||||
.find('[data-cy=markmap]')
|
||||
.find('[data-cypress-id=markmap]')
|
||||
.children()
|
||||
.should('be.visible')
|
||||
})
|
||||
|
@ -28,7 +28,7 @@ describe('Diagram codeblock ', () => {
|
|||
it('renders graphviz', () => {
|
||||
cy.setCodemirrorContent('```graphviz\ngraph {\na -- b\n}\n```')
|
||||
cy.getMarkdownBody()
|
||||
.find('[data-cy=graphviz]')
|
||||
.find('[data-cypress-id=graphviz]')
|
||||
.children()
|
||||
.should('be.visible')
|
||||
})
|
||||
|
@ -44,7 +44,7 @@ describe('Diagram codeblock ', () => {
|
|||
it('renders flowcharts', () => {
|
||||
cy.setCodemirrorContent('```flow\nst=>start: Start\ne=>end: End\nst->e\n```')
|
||||
cy.getMarkdownBody()
|
||||
.find('[data-cy=flowchart]')
|
||||
.find('[data-cypress-id=flowchart]')
|
||||
.children()
|
||||
.should('be.visible')
|
||||
})
|
||||
|
|
|
@ -14,9 +14,9 @@ describe('Export', () => {
|
|||
})
|
||||
|
||||
it('Markdown', () => {
|
||||
cy.get('[data-cy="menu-export"]')
|
||||
cy.get('[data-cypress-id="menu-export"]')
|
||||
.click()
|
||||
cy.get('[data-cy="menu-export-markdown"]')
|
||||
cy.get('[data-cypress-id="menu-export-markdown"]')
|
||||
.click()
|
||||
cy.get('a[download]')
|
||||
.then((anchor) => (
|
||||
|
|
|
@ -151,7 +151,7 @@ describe('Code', () => {
|
|||
it('has a working copy button', () => {
|
||||
cy.setCodemirrorContent('```javascript \nlet x = 0\n```')
|
||||
|
||||
cy.get(`iframe[data-cy="documentIframe"]`)
|
||||
cy.get(`iframe[data-cypress-id="documentIframe"]`)
|
||||
.then(($element: JQuery) => {
|
||||
const frame = $element[0] as HTMLIFrameElement
|
||||
if (frame === null || frame.contentWindow === null) {
|
||||
|
@ -163,7 +163,7 @@ describe('Code', () => {
|
|||
})
|
||||
|
||||
cy.getIframeBody()
|
||||
.find('[data-cy="copy-code-button"]')
|
||||
.find('[data-cypress-id="copy-code-button"]')
|
||||
.click()
|
||||
|
||||
cy.get('@copy')
|
||||
|
|
|
@ -10,11 +10,11 @@ describe('Import markdown file', () => {
|
|||
})
|
||||
|
||||
it('import on blank note', () => {
|
||||
cy.get('[data-cy="menu-import"]')
|
||||
cy.get('[data-cypress-id="menu-import"]')
|
||||
.click()
|
||||
cy.get('[data-cy="menu-import-markdown"]')
|
||||
cy.get('[data-cypress-id="menu-import-markdown"]')
|
||||
.click()
|
||||
cy.get('[data-cy="menu-import-markdown-input"]')
|
||||
cy.get('[data-cypress-id="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')
|
||||
|
@ -25,11 +25,11 @@ describe('Import markdown file', () => {
|
|||
it('import on note with content', () => {
|
||||
|
||||
cy.setCodemirrorContent('test\nabc')
|
||||
cy.get('[data-cy="menu-import"]')
|
||||
cy.get('[data-cypress-id="menu-import"]')
|
||||
.click()
|
||||
cy.get('[data-cy="menu-import-markdown"]')
|
||||
cy.get('[data-cypress-id="menu-import-markdown"]')
|
||||
.click()
|
||||
cy.get('[data-cy="menu-import-markdown-input"]')
|
||||
cy.get('[data-cypress-id="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')
|
||||
|
|
|
@ -22,48 +22,48 @@ describe('Intro page', () => {
|
|||
statusCode: 404
|
||||
})
|
||||
|
||||
cy.get(`iframe[data-cy="documentIframe"]`)
|
||||
cy.get(`iframe[data-cypress-id="documentIframe"]`)
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('features button', () => {
|
||||
it('is hidden when logged in', () => {
|
||||
cy.get('[data-cy="features-button"]')
|
||||
cy.get('[data-cypress-id="features-button"]')
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('is visible when logged out', () => {
|
||||
cy.logout()
|
||||
cy.get('[data-cy="features-button"]')
|
||||
cy.get('[data-cypress-id="features-button"]')
|
||||
.should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('sign in button', () => {
|
||||
it('is hidden when logged in', () => {
|
||||
cy.get('[data-cy="sign-in-button"]')
|
||||
cy.get('[data-cypress-id="sign-in-button"]')
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('is visible when logged out', () => {
|
||||
cy.logout()
|
||||
cy.get('[data-cy="sign-in-button"]')
|
||||
cy.get('[data-cypress-id="sign-in-button"]')
|
||||
.should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('version dialog', () => {
|
||||
it('can be opened and closed', () => {
|
||||
cy.get('[data-cy="version-modal"]')
|
||||
cy.get('[data-cypress-id="version-modal"]')
|
||||
.should('not.exist')
|
||||
cy.get('[data-cy="show-version-modal"]')
|
||||
cy.get('[data-cypress-id="show-version-modal"]')
|
||||
.click()
|
||||
cy.get('[data-cy="version-modal"]')
|
||||
cy.get('[data-cypress-id="version-modal"]')
|
||||
.should('be.visible')
|
||||
cy.get('[data-cy="version-modal"] .modal-header .close')
|
||||
cy.get('[data-cypress-id="version-modal"] .modal-header .close')
|
||||
.click()
|
||||
cy.get('[data-cy="version-modal"]')
|
||||
cy.get('[data-cypress-id="version-modal"]')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('Link gets replaced with embedding: ', () => {
|
|||
.find('.one-click-embedding.gist-frame')
|
||||
.click()
|
||||
cy.getMarkdownBody()
|
||||
.find('iframe[data-cy=gh-gist]')
|
||||
.find('iframe[data-cypress-id=gh-gist]')
|
||||
.should('be.visible')
|
||||
})
|
||||
|
||||
|
|
|
@ -14,29 +14,29 @@ describe('The status bar text length info', () => {
|
|||
})
|
||||
|
||||
it('shows the maximal length of the document as number of available characters in the tooltip', () => {
|
||||
cy.get('.status-bar [data-cy="remainingCharacters"]')
|
||||
cy.get('.status-bar [data-cypress-id="remainingCharacters"]')
|
||||
.attribute('title')
|
||||
.should('contain', ' 200 ')
|
||||
})
|
||||
|
||||
it('color is set to "warning" on <= 100 characters remaining', () => {
|
||||
cy.setCodemirrorContent(warningTestContent)
|
||||
cy.get('.status-bar [data-cy="remainingCharacters"]')
|
||||
cy.get('.status-bar [data-cypress-id="remainingCharacters"]')
|
||||
.should('have.class', 'text-warning')
|
||||
})
|
||||
|
||||
it('color is set to danger on <= 0 characters remaining', () => {
|
||||
cy.setCodemirrorContent(dangerTestContent)
|
||||
cy.get('.status-bar [data-cy="remainingCharacters"]')
|
||||
cy.get('.status-bar [data-cypress-id="remainingCharacters"]')
|
||||
.should('have.class', 'text-danger')
|
||||
})
|
||||
|
||||
it('shows a warning and opens a modal', () => {
|
||||
cy.setCodemirrorContent(tooMuchTestContent)
|
||||
cy.get('[data-cy="limitReachedModal"]')
|
||||
cy.get('[data-cypress-id="limitReachedModal"]')
|
||||
.should('be.visible')
|
||||
cy.getIframeBody()
|
||||
.find('[data-cy="limitReachedMessage"]')
|
||||
.find('[data-cypress-id="limitReachedMessage"]')
|
||||
.should('be.visible')
|
||||
})
|
||||
|
||||
|
|
|
@ -29,63 +29,63 @@ describe('Motd', () => {
|
|||
it('shows the correct alert Motd text', () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
})
|
||||
|
||||
it('can be dismissed', () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cy="motd-dismiss"]')
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cypress-id="motd-dismiss"]')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
})
|
||||
|
||||
it("won't show again after dismiss and reload", () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cy="motd-dismiss"]')
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cypress-id="motd-dismiss"]')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
cy.reload()
|
||||
cy.get('main').should('exist')
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
})
|
||||
|
||||
it("will show again after reload without dismiss", () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
cy.reload()
|
||||
cy.get('main').should('exist')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
})
|
||||
|
||||
it("won't show again after dismiss and page navigation", () => {
|
||||
mockExistingMotd()
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cy="motd-dismiss"]')
|
||||
cy.get('[data-cypress-id="motd"]').contains(motdMockContent)
|
||||
cy.get('button[data-cypress-id="motd-dismiss"]')
|
||||
.click()
|
||||
.then(() => {
|
||||
expect(localStorage.getItem(MOTD_LOCAL_STORAGE_KEY)).to.equal(MOCK_LAST_MODIFIED)
|
||||
})
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
cy.get('#navLinkHistory').click()
|
||||
cy.get('main').should('exist')
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
})
|
||||
|
||||
it("won't show if no file exists", () => {
|
||||
cy.visit('/')
|
||||
cy.get('main').should('exist')
|
||||
cy.get('[data-cy="motd"]').should('not.exist')
|
||||
cy.get('[data-cypress-id="motd"]').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -32,7 +32,7 @@ const initLoggedOutTestWithCustomAuthProviders = (cy: Cypress.cy, enabledProvide
|
|||
describe('When logged-in, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
cy.visit('/')
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
@ -41,7 +41,7 @@ describe('When logged-out ', () => {
|
|||
describe('and no auth-provider is enabled, ', () => {
|
||||
it('sign-in button is hidden', () => {
|
||||
initLoggedOutTestWithCustomAuthProviders(cy, {})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
@ -51,7 +51,7 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
internal: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
@ -60,7 +60,7 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
ldap: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
@ -69,7 +69,7 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
openid: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
@ -80,7 +80,7 @@ describe('When logged-out ', () => {
|
|||
initLoggedOutTestWithCustomAuthProviders(cy, {
|
||||
saml: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=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/api/private/auth/saml')
|
||||
|
@ -93,7 +93,7 @@ describe('When logged-out ', () => {
|
|||
saml: true,
|
||||
github: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
@ -105,7 +105,7 @@ describe('When logged-out ', () => {
|
|||
saml: true,
|
||||
internal: true
|
||||
})
|
||||
cy.get('[data-cy=sign-in-button]')
|
||||
cy.get('[data-cypress-id=sign-in-button]')
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'href', '/login')
|
||||
})
|
||||
|
|
|
@ -10,19 +10,19 @@ describe('Split view', () => {
|
|||
})
|
||||
|
||||
it('can show both panes', () => {
|
||||
cy.get('[data-cy="view-mode-both"]').click()
|
||||
cy.get('[data-cypress-id="view-mode-both"]').click()
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
})
|
||||
|
||||
it('can show only preview pane', () => {
|
||||
cy.get('[data-cy="view-mode-preview"]').click()
|
||||
cy.get('[data-cypress-id="view-mode-preview"]').click()
|
||||
cy.get('.splitter.left').should('be.not.visible')
|
||||
cy.get('.splitter.right').should('be.visible')
|
||||
})
|
||||
|
||||
it('can show only editor pane', () => {
|
||||
cy.get('[data-cy="view-mode-editor"]').click()
|
||||
cy.get('[data-cypress-id="view-mode-editor"]').click()
|
||||
cy.get('.splitter.left').should('be.visible')
|
||||
cy.get('.splitter.right').should('be.not.visible')
|
||||
})
|
||||
|
@ -31,7 +31,7 @@ describe('Split view', () => {
|
|||
cy.get('.splitter.left').then((leftPanebefore) => {
|
||||
const widthBefore = leftPanebefore.outerWidth()
|
||||
|
||||
cy.get('[data-cy="view-mode-both"]').click()
|
||||
cy.get('[data-cypress-id="view-mode-both"]').click()
|
||||
cy.get('.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')
|
||||
|
|
|
@ -32,49 +32,49 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format as bold', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-bold"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-bold"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `**${ testText }**`)
|
||||
})
|
||||
|
||||
it('should format as italic', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-italic"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-italic"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `*${ testText }*`)
|
||||
})
|
||||
|
||||
it('should format as underline', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-underline"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-underline"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `++${ testText }++`)
|
||||
})
|
||||
|
||||
it('should format as strikethrough', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-strikethrough"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-strikethrough"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `~~${ testText }~~`)
|
||||
})
|
||||
|
||||
it('should format as subscript', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-subscript"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-subscript"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `~${ testText }~`)
|
||||
})
|
||||
|
||||
it('should format as superscript', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-superscript"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-superscript"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `^${ testText }^`)
|
||||
})
|
||||
|
||||
it('should format the line as code block', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-code-block"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-code-block"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
||||
.should('have.text', '```')
|
||||
|
@ -85,14 +85,14 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format links', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-link"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-link"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `[${ testText }](https://)`)
|
||||
})
|
||||
|
||||
it('should format as image', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-image"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-image"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', ``)
|
||||
|
@ -100,7 +100,7 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format line as heading', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-heading"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-heading"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `# ${ testText }`)
|
||||
|
@ -111,7 +111,7 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format the line as code', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-code-block"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-code-block"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
||||
.should('have.text', '```')
|
||||
|
@ -122,58 +122,58 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should add a quote', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-block-quote"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-block-quote"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `> ${ testText }`)
|
||||
cy.get('.btn-toolbar [data-cy="format-block-quote"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-block-quote"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `> > ${ testText }`)
|
||||
})
|
||||
|
||||
it('should format as unordered list', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-unordered-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-unordered-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `- ${ testText }`)
|
||||
cy.get('.btn-toolbar [data-cy="format-unordered-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-unordered-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `- - ${ testText }`)
|
||||
})
|
||||
|
||||
it('should format as ordered list', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-ordered-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-ordered-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `1. ${ testText }`)
|
||||
cy.get('.btn-toolbar [data-cy="format-ordered-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-ordered-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `1. 1. ${ testText }`)
|
||||
})
|
||||
|
||||
it('should format as check list', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-check-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-check-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `- [ ] ${ testText }`)
|
||||
cy.get('.btn-toolbar [data-cy="format-check-list"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-check-list"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `- [ ] - [ ] ${ testText }`)
|
||||
})
|
||||
|
||||
it('should insert links', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-link"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-link"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `${ testText }[](https://)`)
|
||||
})
|
||||
|
||||
it('should insert an empty image link', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-image"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-image"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `${ testText }`)
|
||||
|
@ -191,14 +191,14 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should format as link', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-link"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-link"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', `[](${ testLink })`)
|
||||
})
|
||||
|
||||
it('should format as image', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-image"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-image"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
||||
.should('have.text', ``)
|
||||
|
@ -207,7 +207,7 @@ describe('Toolbar Buttons', () => {
|
|||
|
||||
describe('for no text', () => {
|
||||
it('should add an empty code block', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-code-block"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-code-block"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
||||
.should('have.text', '```')
|
||||
|
@ -216,21 +216,21 @@ describe('Toolbar Buttons', () => {
|
|||
})
|
||||
|
||||
it('should insert lines', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-add-line"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="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.get('.btn-toolbar [data-cy="format-collapsable-block"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-collapsable-block"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span')
|
||||
.should('have.text', ':::spoiler Toggle label')
|
||||
})
|
||||
|
||||
it('should add a comment', () => {
|
||||
cy.get('.btn-toolbar [data-cy="format-add-comment"]')
|
||||
cy.get('.btn-toolbar [data-cypress-id="format-add-comment"]')
|
||||
.click()
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span')
|
||||
.should('have.text', '> []')
|
||||
|
@ -241,7 +241,7 @@ describe('Toolbar Buttons', () => {
|
|||
beforeEach(() => {
|
||||
cy.get('.table-picker-container')
|
||||
.should('not.be.visible')
|
||||
cy.get('[data-cy="show-table-overlay"]')
|
||||
cy.get('[data-cypress-id="show-table-overlay"]')
|
||||
.last()
|
||||
.click()
|
||||
cy.get('.table-picker-container')
|
||||
|
@ -262,7 +262,7 @@ describe('Toolbar Buttons', () => {
|
|||
it('should open a modal for custom table sizes in the overlay', () => {
|
||||
cy.get('.modal-dialog')
|
||||
.should('not.exist')
|
||||
cy.get('[data-cy="show-custom-table-modal"]')
|
||||
cy.get('[data-cypress-id="show-custom-table-modal"]')
|
||||
.first()
|
||||
.click()
|
||||
cy.get('.modal-dialog')
|
||||
|
@ -295,7 +295,7 @@ describe('Toolbar Buttons', () => {
|
|||
it('should open overlay', () => {
|
||||
cy.get('emoji-picker')
|
||||
.should('not.be.visible')
|
||||
cy.get('[data-cy="show-emoji-picker"]')
|
||||
cy.get('[data-cypress-id="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.get('[data-cy="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cy="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cy="document-info-word-count"]').should('have.text', '0')
|
||||
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '0')
|
||||
})
|
||||
|
||||
it('simple words', () => {
|
||||
cy.setCodemirrorContent('five words should be enough')
|
||||
cy.wait(500)
|
||||
cy.get('[data-cy="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cy="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cy="document-info-word-count"]').should('have.text', '5')
|
||||
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cypress-id="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.get('[data-cy="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cy="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cy="document-info-word-count"]').should('have.text', '2')
|
||||
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '2')
|
||||
})
|
||||
|
||||
it('excluded images', () => {
|
||||
cy.setCodemirrorContent(' not ignored text')
|
||||
cy.wait(500)
|
||||
cy.get('[data-cy="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cy="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cy="document-info-word-count"]').should('have.text', '3')
|
||||
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
||||
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
||||
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '3')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,21 +12,21 @@ 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()
|
||||
.find('[data-cy="yamlArrayDeprecationAlert"]')
|
||||
.find('[data-cypress-id="yamlArrayDeprecationAlert"]')
|
||||
.should('be.visible')
|
||||
})
|
||||
|
||||
it('isn\'t shown when using inline yaml-array', () => {
|
||||
cy.setCodemirrorContent('---\ntags: [\'a\', \'b\', \'c\']\n---')
|
||||
cy.getIframeBody()
|
||||
.find('[data-cy="yamlArrayDeprecationAlert"]')
|
||||
.find('[data-cypress-id="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()
|
||||
.find('[data-cy="yamlArrayDeprecationAlert"]')
|
||||
.find('[data-cypress-id="yamlArrayDeprecationAlert"]')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue