Skip to content

Commit

Permalink
✅ (#2184): add callouts cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
  • Loading branch information
Vinicius Reis committed Mar 9, 2022
1 parent ad9a935 commit 7b9cc7b
Showing 1 changed file with 63 additions and 2 deletions.
65 changes: 63 additions & 2 deletions cypress/integration/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/


import { randHash } from '../utils/'
const randUser = randHash()

Expand Down Expand Up @@ -57,7 +56,7 @@ describe('Workspace', function() {
['bold', 'strong'],
['italic', 'em'],
['underline', 'u'],
['strike', 's']
['strike', 's'],
].forEach(([button, tag]) => {
menuButton(button)
.click()
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 7b9cc7b

Please sign in to comment.