diff options
author | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-03-10 01:13:59 +0300 |
---|---|---|
committer | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-03-14 17:38:29 +0300 |
commit | afe74b4450781ecff2e10fa6bf8807c39212aec0 (patch) | |
tree | 9f4a036e29e785a4f124203446c6b932d2b2cb4e /cypress | |
parent | 0ee23b93d8cccbbf6e1725073cf9b4f8867cc353 (diff) |
✅ (#2184): add callouts cypress tests
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/integration/workspace.spec.js | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/cypress/integration/workspace.spec.js b/cypress/integration/workspace.spec.js index 06ca947c5..85e616693 100644 --- a/cypress/integration/workspace.spec.js +++ b/cypress/integration/workspace.spec.js @@ -20,7 +20,6 @@ * */ - import { randHash } from '../utils/' const randUser = randHash() @@ -57,7 +56,7 @@ describe('Workspace', function() { ['bold', 'strong'], ['italic', 'em'], ['underline', 'u'], - ['strike', 's'] + ['strike', 's'], ].forEach(([button, tag]) => { menuButton(button) .click() @@ -152,6 +151,68 @@ describe('Workspace', function() { cy.get('.empty-workspace').should('contain', 'Ajoutez des notes, listes ou liens') }) + describe('callouts', () => { + const types = ['info', 'warn', 'error', 'success'] + it('create callouts', () => { + const workspace = openWorkspace() + workspace.type('Callout') + + types.forEach(type => { + // enable callout + menuButton('info').click() + submenuButton(type).click() + + // check if is active + menuButton(type).should('have.class', 'is-active') + + // check content + cy.get(`.ProseMirror .callout.callout-${type}`) + .should('contain', 'Callout') + + // disable + menuButton(type).click() + submenuButton(type).click() + + // check if is inactive + menuButton('info').should('not.have.class', 'is-active') + }) + }) + + it('toggle callouts', () => { + const workspace = openWorkspace() + workspace.type('Callout') + + const [first, ...rest] = types + + let last = first + + // enable callout + menuButton('info').click() + submenuButton(first).click() + + rest.forEach(type => { + // enable callout + menuButton(last).click() + submenuButton(type).click() + + last = type + + // check if is active + menuButton(type).should('have.class', 'is-active') + + // check content + cy.get(`.ProseMirror .callout.callout-${type}`) + .should('contain', 'Callout') + }) + + // disable + menuButton(last).click() + submenuButton(last).click() + + // check if is inactive + menuButton('info').should('not.have.class', 'is-active') + }) + }) }) const menuButton = (name) => { |