Merge branch 'master' into e2e/chronograf_admin_all_users

pull/5948/head
k3yi0 2022-06-29 11:56:18 +02:00
commit 32f6dcef22
1 changed files with 35 additions and 23 deletions

View File

@ -5,47 +5,42 @@ describe('Use Dashboards', () => {
beforeEach(() => {
cy.toInitialState()
cy.createInfluxDBConnection()
.then((src: Source) => {
source = src
cy.visit(`/sources/${source.id}/dashboards`)
cy.createDashboard('Reader Dashboard')
})
cy.createInfluxDBConnection().then((src: Source) => {
source = src
cy.visit(`/sources/${source.id}/dashboards`)
})
})
it('create, rename and delete a dashboard', () => {
// create a dashboard
cy.get('button').contains('Create Dashboard').click()
const newName = 'DashboardQA'
// rename the dashboard
cy.get('button').contains('Create Dashboard').click()
cy.get('.rename-dashboard')
.should('have.text', 'Name This Dashboard')
.type(`${newName}{enter}`)
.should('have.text', newName)
// delete the dashboard
cy.visit(`/sources/${source.id}/dashboards`)
// DOM Element where the dashboard resides
cy.get('.panel-body > table > tbody')
.should('exist')
.within(() => {
// delete button
cy.get('.confirm-button--confirmation').eq(1).click({force: true})
cy.get('.confirm-button--confirmation').click({force: true})
})
})
describe('Use Dashboards as reader', () => {
beforeEach(() => {
cy.getByTestID('sidebar')
.should('be.visible')
.then(() => {
cy.createChronografUser('Reader', 'oauth-mock', 'oauth2').then(() => {
cy.OAuthLoginAsDiffUser('Reader')
})
cy.createDashboard('Reader Dashboard').then(() => {
cy.createChronografUser('Reader', 'oauth-mock', 'oauth2').then(() => {
cy.getByTestID('dashboard-panel')
.should('be.visible')
.then(() => {
cy.OAuthLoginAsDiffUser('Reader')
})
})
})
})
it('ensure that all elements used to edit Chronograf are not visible', () => {
@ -65,11 +60,28 @@ describe('Use Dashboards', () => {
cy.get('.dashboard-empty--menu').should('not.exist')
cy.getByTestID('add-cell').should('not.exist')
cy.get('.template-control-bar').should('not.exist')
cy.getByTestID('show-variables--button').should('be.visible').click()
cy.getByTestID('add-template-variable').should('not.exist')
cy.getByTestID('show-annotations--button').click()
cy.getByTestID('add-annotation--button').should('not.exist')
cy.getByTestID('add-annotation-filter--button').should('not.exist')
cy.get('.template-control-bar').should('exist').and('be.visible')
cy.get('.annotation-control-bar').should('not.exist')
cy.getByTestID('show-annotations--button').should('be.visible').click()
cy.get('.annotation-control-bar').should('exist').and('be.visible').within(() => {
cy.getByTestID('add-template-variable').should('not.exist')
cy.getByTestID('add-annotation--button').should('not.exist')
cy.getByTestID('wizard-bucket-selected').click()
cy.getByTestID('dropdown--item').contains('Filter Annotations By Tags').click()
cy.getByTestID('add-annotation-filter--button').should('exist').and('be.visible')
})
cy.reload().then(() => {
cy.get('.page-header--title')
.should('exist')
.and('be.visible')
.then(() => {
cy.get('.template-control-bar').should('exist').and('be.visible')
cy.get('.annotation-control-bar').should('exist').and('be.visible')
})
})
})
})
})