Skip to content

Commit

Permalink
test: failing cypress tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubone21 committed Nov 11, 2020
1 parent 0ef8afc commit d77610d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 52 deletions.
56 changes: 28 additions & 28 deletions cypress/e2e/dashboardsIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,34 @@ describe('Dashboards', () => {
cy.getByTestID('context-delete-dashboard').click()
})

const dashboardDescription = 'this dashboard contains secret information'

// change description
cy.getByTestID('resource-list--editable-description')
.click('topLeft')
.within(() => {
cy.getByTestID('input-field')
.type(dashboardDescription)
.type('{enter}')
})
cy.getByTestID('resource-list--editable-description').should(
'contain',
dashboardDescription
)
// remove description
cy.getByTestID('resource-list--editable-description')
.click('topLeft')
.within(() => {
cy.getByTestID('input-field')
.clear()
.type('{enter}')
})
cy.getByTestID('resource-list--editable-description').should(
'not.contain',
dashboardDescription
)
const dashboardDescription = 'this dashboard contains secret information'

// change description
cy.getByTestID('resource-list--editable-description')
.click('topLeft')
.within(() => {
cy.getByTestID('input-field')
.type(dashboardDescription)
.type('{enter}')
})
cy.getByTestID('resource-list--editable-description').should(
'contain',
dashboardDescription
)

// remove description
cy.getByTestID('resource-list--editable-description')
.click('topLeft')
.within(() => {
cy.getByTestID('input-field')
.clear()
.type('{enter}')
})
cy.getByTestID('resource-list--editable-description').should(
'not.contain',
dashboardDescription
)

cy.getByTestID('dashboard-card')
.first()
.trigger('mouseover')
Expand Down
57 changes: 34 additions & 23 deletions cypress/e2e/explorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const makeGraphSnapshot = (() => {
},
}
}
})
})()

describe('DataExplorer', () => {
beforeEach(() => {
Expand Down Expand Up @@ -724,9 +724,6 @@ describe('DataExplorer', () => {
cy.getByTestID('selector-list v').should('be.visible')
cy.getByTestID('selector-list v').clickAttached()

cy.getByTestID('selector-list tv1')
.scrollIntoView()
.should('be.visible')
cy.getByTestID('selector-list tv1').clickAttached()

cy.getByTestID('selector-list last')
Expand Down Expand Up @@ -849,10 +846,15 @@ describe('DataExplorer', () => {
cy.getByTestID('giraffe-layer-line').then(([canvas]) => {
const {width, height} = canvas

cy.wrap(canvas).trigger('mousedown', {x: width / 3, y: height / 2})
cy.wrap(canvas).trigger('mousedown', {
x: width / 3,
y: height / 2,
force: true,
})
cy.wrap(canvas).trigger('mousemove', {
x: (width * 2) / 3,
y: height / 2,
force: true,
})
cy.wrap(canvas).trigger('mouseup', {force: true})
})
Expand All @@ -876,10 +878,15 @@ describe('DataExplorer', () => {
cy.getByTestID('giraffe-layer-line').then(([canvas]) => {
const {width, height} = canvas

cy.wrap(canvas).trigger('mousedown', {x: width / 2, y: height / 3})
cy.wrap(canvas).trigger('mousedown', {
x: width / 2,
y: height / 3,
force: true,
})
cy.wrap(canvas).trigger('mousemove', {
x: width / 2,
y: (height * 2) / 3,
force: true,
})
cy.wrap(canvas).trigger('mouseup', {force: true})
})
Expand Down Expand Up @@ -907,7 +914,7 @@ describe('DataExplorer', () => {
cy.wait(100)
cy.getByTestID('giraffe-layer-line').trigger('mousemove', {force: true})

cy.getByTestID('giraffe-tooltip').should('visible')
cy.getByTestID('giraffe-tooltip').should('be.visible')
cy.getByTestID('giraffe-layer-line').trigger('mouseout', {force: true})
cy.getByTestID('giraffe-tooltip').should('not.visible')
})
Expand Down Expand Up @@ -1033,11 +1040,12 @@ describe('DataExplorer', () => {

// graph will slightly move
cy.wait(200)
cy.getByTestID('autorefresh-dropdown-refresh').click()
cy.get('.autorefresh-dropdown--pause').click()
makeGraphSnapshot().shouldBeSameAs(snapshot, false)
})

it('auto refresh', () => {
//skip until the auto-refresh feature is added back
it.skip('auto refresh', () => {
const snapshot = makeGraphSnapshot()
cy.getByTestID('autorefresh-dropdown--button').click()
cy.getByTestID('auto-refresh-5s').click()
Expand Down Expand Up @@ -1076,9 +1084,9 @@ describe('DataExplorer', () => {
// test all tabs
cy.getByTestID('task--radio-button').click()
cy.getByTestID('task-form-name').should('be.visible')
cy.getByTestID('variable--radio-button').click()
cy.getByTestID('variable-radio-button').click()
cy.getByTestID('flux-editor').should('be.visible')
cy.getByTestID('cell--radio-button').click()
cy.getByTestID('cell-radio-button').click()
cy.getByTestID('save-as-dashboard-cell--dropdown').should('be.visible')

// close save as
Expand All @@ -1102,10 +1110,11 @@ describe('DataExplorer', () => {
})
})

// setup query for saving and open dasboard dialog
// setup query for saving and open dashboard dialog
cy.getByTestID(`selector-list m`).click()
cy.getByTestID(`time-machine-submit-button`).click()
cy.getByTestID('save-query-as').click()
cy.getByTestID('cell--radio-button').click()
cy.getByTestID('cell-radio-button').click()
})

it('can save as cell into multiple dashboards', () => {
Expand All @@ -1120,6 +1129,7 @@ describe('DataExplorer', () => {
cy.getByTestID('save-as-dashboard-cell--cell-name').type(cellName)

cy.getByTestID('save-as-dashboard-cell--submit').click()
cy.wait(250)

// ensure cell exists at dashboards
cy.get('@org').then(({id: orgID}: Organization) => {
Expand Down Expand Up @@ -1290,20 +1300,21 @@ describe('DataExplorer', () => {
cy.getByTestID('nav-item-data-explorer').click({force: true})
cy.getByTestID(`selector-list m`).click()
cy.getByTestID('save-query-as').click({force: true})
cy.getByTestID('variable--radio-button').click()
cy.getByTestID('variable-radio-button').click()
})

it('can save and enable/disable submit button', () => {
cy.getByTestID('variable-form-save').should('be.disabled')
cy.getByTestID('variable-name-input').type(variableName)
cy.getByTestID('variable-form-save').should('be.enabled')
cy.getByTestID('variable-name-input').clear()
cy.getByTestID('variable-form-save').should('be.disabled')
cy.getByTestID('variable-name-input').type(variableName)
cy.getByTestID('variable-form-save').should('be.enabled')

cy.getByTestID('variable-form-save').click()
cy.getByTestID('overlay--container').within(() => {
cy.get('.cf-button-success').should('be.disabled')
cy.getByTestID('input-field').type(variableName)
cy.get('.cf-button-success').should('be.enabled')
cy.getByTestID('input-field').clear()
cy.get('.cf-button-success').should('be.disabled')
cy.getByTestID('input-field').type(variableName)
cy.get('.cf-button-success').should('be.enabled')

cy.get('.cf-button-success').click()
})
visitVariables()
cy.getByTestID(`variable-card--name ${variableName}`).should('exist')
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ describe('The Login Page', () => {
cy.getByTestID('notification-error').should('exist')
})
})
})
})

0 comments on commit d77610d

Please sign in to comment.