test(e2e): dashboard cell markdown and resize (#18549)

* test(cell): create a markdown note

* test(cell): resize

* test(cells): use aliases instead of vars
pull/18553/head
Andrew Watkins 2020-06-16 14:33:21 -07:00 committed by GitHub
parent ec3a857fd0
commit 55055b529d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View File

@ -73,15 +73,43 @@ describe('Dashboard', () => {
cy.getByTestID('empty-state').should('exist')
const noteText = 'this is a note cell'
const headerPrefix = '#'
// Note cell
cy.getByTestID('add-note--button').click()
cy.getByTestID('note-editor--overlay').within(() => {
cy.get('.CodeMirror').type(noteText)
cy.get('.CodeMirror').type(`${headerPrefix} ${noteText}`)
cy.getByTestID('note-editor--preview').contains(noteText)
cy.getByTestID('note-editor--preview').should('not.contain', headerPrefix)
cy.getByTestID('save-note--button').click()
})
cy.getByTestID('cell--view-empty').contains(noteText)
cy.getByTestID('cell--view-empty').should('not.contain', headerPrefix)
cy.getByTestID('cell--view-empty').within(([$cell]) => {
const prevWidth = $cell.clientWidth
const prevHeight = $cell.clientHeight
cy.wrap(prevWidth).as('prevWidth')
cy.wrap(prevHeight).as('prevHeight')
})
// Resize Cell
cy.get('.react-resizable-handle')
.trigger('mousedown', {which: 1, force: true})
.trigger('mousemove', {
clientX: 800,
clientY: 800,
})
.trigger('mouseup', {force: true})
cy.getByTestID('cell--view-empty').within(([$cell]) => {
const currWidth = $cell.clientWidth
const currHeight = $cell.clientHeight
cy.get('@prevWidth').should('be.lessThan', currWidth)
cy.get('@prevHeight').should('be.lessThan', currHeight)
})
// Remove note cell
cy.getByTestID('cell-context--toggle').click()

View File

@ -14,7 +14,7 @@ const cloudImageRenderer = (): any =>
const NoteEditorPreview: SFC<Props> = props => {
return (
<div className="note-editor--preview">
<div className="note-editor--preview" data-testid="note-editor--preview">
<DapperScrollbars
className="note-editor--preview-scroll"
scrollTop={props.scrollTop}