test(e2e): dashboard notes (#18318)
* test: add typings for cy commands * test(dashboard): creation of note cellpull/18322/head
parent
17ccbbefcb
commit
eb1041c7d1
|
@ -40,7 +40,7 @@ describe('Dashboard', () => {
|
||||||
cy.getByTestID('dashboard-card').should('contain', newName)
|
cy.getByTestID('dashboard-card').should('contain', newName)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can create a cell', () => {
|
it('can create a View and Note cell', () => {
|
||||||
cy.get('@org').then(({id: orgID}: Organization) => {
|
cy.get('@org').then(({id: orgID}: Organization) => {
|
||||||
cy.createDashboard(orgID).then(({body}) => {
|
cy.createDashboard(orgID).then(({body}) => {
|
||||||
cy.fixture('routes').then(({orgs}) => {
|
cy.fixture('routes').then(({orgs}) => {
|
||||||
|
@ -49,9 +49,28 @@ describe('Dashboard', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// View cell
|
||||||
cy.getByTestID('add-cell--button').click()
|
cy.getByTestID('add-cell--button').click()
|
||||||
cy.getByTestID('save-cell--button').click()
|
cy.getByTestID('save-cell--button').click()
|
||||||
cy.getByTestID('cell--view-empty').should('have.length', 1)
|
cy.getByTestID('cell--view-empty').should('have.length', 1)
|
||||||
|
|
||||||
|
// Remove view cell
|
||||||
|
cy.getByTestID('cell-context--toggle').click()
|
||||||
|
cy.getByTestID('cell-context--delete').click()
|
||||||
|
cy.getByTestID('cell-context--delete-confirm').click()
|
||||||
|
|
||||||
|
cy.getByTestID('empty-state').should('exist')
|
||||||
|
|
||||||
|
const noteText = 'this is a note cell'
|
||||||
|
|
||||||
|
// Note cell
|
||||||
|
cy.getByTestID('add-note--button').click()
|
||||||
|
cy.getByTestID('note-editor--overlay').within(() => {
|
||||||
|
cy.get('.CodeMirror').type(noteText)
|
||||||
|
cy.getByTestID('save-note--button').click()
|
||||||
|
})
|
||||||
|
|
||||||
|
cy.getByTestID('cell--view-empty').contains(noteText)
|
||||||
})
|
})
|
||||||
|
|
||||||
// fix for https://github.com/influxdata/influxdb/issues/15239
|
// fix for https://github.com/influxdata/influxdb/issues/15239
|
||||||
|
|
|
@ -15,8 +15,9 @@ import {
|
||||||
getByInputValue,
|
getByInputValue,
|
||||||
getByTitle,
|
getByTitle,
|
||||||
createTask,
|
createTask,
|
||||||
createVariable,
|
|
||||||
createMapVariable,
|
createMapVariable,
|
||||||
|
createCSVVariable,
|
||||||
|
createQueryVariable,
|
||||||
createAndAddLabel,
|
createAndAddLabel,
|
||||||
createLabel,
|
createLabel,
|
||||||
createBucket,
|
createBucket,
|
||||||
|
@ -39,8 +40,9 @@ declare global {
|
||||||
signin: typeof signin
|
signin: typeof signin
|
||||||
setupUser: typeof setupUser
|
setupUser: typeof setupUser
|
||||||
createSource: typeof createSource
|
createSource: typeof createSource
|
||||||
|
createCSVVariable: typeof createCSVVariable
|
||||||
|
createQueryVariable: typeof createQueryVariable
|
||||||
createTask: typeof createTask
|
createTask: typeof createTask
|
||||||
createVariable: typeof createVariable
|
|
||||||
createMapVariable: typeof createMapVariable
|
createMapVariable: typeof createMapVariable
|
||||||
createDashboardTemplate: typeof createDashboardTemplate
|
createDashboardTemplate: typeof createDashboardTemplate
|
||||||
createDashboard: typeof createDashboard
|
createDashboard: typeof createDashboard
|
||||||
|
|
|
@ -160,6 +160,7 @@ const DashboardHeader: FC<Props> = ({
|
||||||
icon={IconFont.TextBlock}
|
icon={IconFont.TextBlock}
|
||||||
text="Add Note"
|
text="Add Note"
|
||||||
onClick={handleAddNote}
|
onClick={handleAddNote}
|
||||||
|
testID="add-note--button"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
icon={IconFont.Cube}
|
icon={IconFont.Cube}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class NoteEditorOverlay extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Overlay.Container maxWidth={900}>
|
<Overlay.Container maxWidth={900} testID="note-editor--overlay">
|
||||||
<Overlay.Header
|
<Overlay.Header
|
||||||
title={this.overlayTitle}
|
title={this.overlayTitle}
|
||||||
onDismiss={this.handleDismiss}
|
onDismiss={this.handleDismiss}
|
||||||
|
@ -123,6 +123,7 @@ class NoteEditorOverlay extends PureComponent<Props, State> {
|
||||||
color={ComponentColor.Success}
|
color={ComponentColor.Success}
|
||||||
status={this.saveButtonStatus}
|
status={this.saveButtonStatus}
|
||||||
onClick={this.handleSave}
|
onClick={this.handleSave}
|
||||||
|
testID="save-note--button"
|
||||||
/>
|
/>
|
||||||
</Overlay.Footer>
|
</Overlay.Footer>
|
||||||
</Overlay.Container>
|
</Overlay.Container>
|
||||||
|
|
Loading…
Reference in New Issue