From aa641c7bc2db140080217547dfd803e69ac3ce94 Mon Sep 17 00:00:00 2001 From: Sam Feifer Date: Mon, 25 Mar 2024 13:50:06 -0400 Subject: [PATCH] update ci tests for grafana 10 --- cypress/e2e/datasources/redis.cy.ts | 29 +++++++++++++++++++++++- cypress/e2e/datasources/vector.cy.ts | 34 +++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/datasources/redis.cy.ts b/cypress/e2e/datasources/redis.cy.ts index 22e688c..9b8e212 100644 --- a/cypress/e2e/datasources/redis.cy.ts +++ b/cypress/e2e/datasources/redis.cy.ts @@ -18,7 +18,7 @@ describe('PCP Redis data source', () => { cy.contains('Dashboard Imported'); }); - it('should auto-complete metric names', () => { + it('should auto-complete metric names grafana 9', () => { cy.visit('/dashboard/new'); cy.contains('Add a new panel').click(); @@ -40,4 +40,31 @@ describe('PCP Redis data source', () => { // if the following assertion fails, check the wordPattern setting in the Monaco Editor cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_rawactive').blur(); }); + + it('should complete metric names grafana 10', () => { + cy.visit('/dashboard/new'); + cy.contains('Add visualization').click(); + + //select redis datasource from the modal + cy.type('PCP Redis'); + cy.contains('PCP Redis').click(); + + // start typing + cy.get('.monaco-editor textarea').type('disk.dev.by', { force: true }); + cy.contains('disk.dev.total_bytes'); // auto-complete + + // click on one auto-completion entry + cy.contains('disk.dev.write_bytes').click(); + cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_bytes').blur(); + + // remove '_bytes' from query editor and type '_' to open auto-completion again + cy.get('.monaco-editor textarea').type('{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}_', { + force: true, + }); + + // click on one auto-completion entry + cy.contains('disk.dev.write_rawactive').click(); + // if the following assertion fails, check the wordPattern setting in the Monaco Editor + cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_rawactive').blur(); + }) }); diff --git a/cypress/e2e/datasources/vector.cy.ts b/cypress/e2e/datasources/vector.cy.ts index e6c41b7..96f15f6 100644 --- a/cypress/e2e/datasources/vector.cy.ts +++ b/cypress/e2e/datasources/vector.cy.ts @@ -18,7 +18,7 @@ describe('PCP Vector data source', () => { cy.contains('Dashboard Imported'); }); - it('should auto-complete metric names', () => { + it('should auto-complete metric names grafana 9', () => { cy.visit('/dashboard/new'); cy.contains('Add a new panel').click(); @@ -44,4 +44,36 @@ describe('PCP Vector data source', () => { // if the following assertion fails, check the wordPattern setting in the Monaco Editor cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_rawactive').blur(); }); + + it('should auto-complete metric names grafana 10', () => { + cy.visit('/dashboard/new'); + cy.contains('Add visualization').click(); + + //select vector datasource from the modal + cy.contains('PCP Vector').click(); + + // start typing + cy.get('.monaco-editor').type('disk.dev.write_b'); + // auto-complete + cy.contains('disk.dev.write_bytes'); + cy.contains('Semantics: counter'); + cy.contains('Units: Kbyte'); + cy.contains('per-disk count of bytes written'); + + // accept a suggestion + cy.contains('disk.dev.write_bytes').type('{enter}'); + cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_bytes').blur(); + + // remove '_bytes' from query editor and type '_' to open auto-completion again + cy.get('.monaco-editor textarea').type('{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}_', { + force: true, + }); + + // click on one auto-completion entry + cy.contains('disk.dev.write_rawactive').click(); + // if the following assertion fails, check the wordPattern setting in the Monaco Editor + cy.get('.monaco-editor textarea').should('have.value', 'disk.dev.write_rawactive').blur(); + + }); + });