e2e: refactors the most flaky tests (#33727)
This commit is contained in:
@@ -2,6 +2,7 @@ import { e2e } from '@grafana/e2e';
|
|||||||
import { expect } from '../../../public/test/lib/common';
|
import { expect } from '../../../public/test/lib/common';
|
||||||
|
|
||||||
const PANEL_UNDER_TEST = 'Random walk series';
|
const PANEL_UNDER_TEST = 'Random walk series';
|
||||||
|
const flakyTimeout = 10000;
|
||||||
|
|
||||||
e2e.scenario({
|
e2e.scenario({
|
||||||
describeName: 'Panel edit tests - queries',
|
describeName: 'Panel edit tests - queries',
|
||||||
@@ -25,31 +26,17 @@ e2e.scenario({
|
|||||||
expect(rows.length).equals(1);
|
expect(rows.length).equals(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
e2e().server();
|
|
||||||
e2e()
|
|
||||||
.route({
|
|
||||||
method: 'POST',
|
|
||||||
url: '/api/ds/query',
|
|
||||||
})
|
|
||||||
.as('apiPostQuery');
|
|
||||||
|
|
||||||
// Add query button should be visible and clicking on it should create a new row
|
// Add query button should be visible and clicking on it should create a new row
|
||||||
e2e.components.QueryTab.addQuery().scrollIntoView().should('be.visible').click();
|
e2e.components.QueryTab.addQuery().scrollIntoView().should('be.visible').click();
|
||||||
|
|
||||||
// We expect row with refId A and B to exist and be visible
|
// We expect row with refId A and B to exist and be visible
|
||||||
e2e.components.QueryEditorRows.rows().within((rows) => {
|
e2e.components.QueryEditorRows.rows({ timeout: flakyTimeout }).should('have.length', 2);
|
||||||
expect(rows.length).equals(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove refId A
|
// Remove refId A
|
||||||
e2e.components.QueryEditorRow.actionButton('Remove query').eq(0).should('be.visible').click();
|
e2e.components.QueryEditorRow.actionButton('Remove query').eq(0).should('be.visible').click();
|
||||||
|
|
||||||
e2e().wait('@apiPostQuery');
|
|
||||||
|
|
||||||
// We expect row with refId B to exist and be visible
|
// We expect row with refId B to exist and be visible
|
||||||
e2e.components.QueryEditorRows.rows().within((rows) => {
|
e2e.components.QueryEditorRows.rows({ timeout: flakyTimeout }).should('have.length', 1);
|
||||||
expect(rows.length).equals(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Duplicate refId B
|
// Duplicate refId B
|
||||||
e2e.components.QueryEditorRow.actionButton('Duplicate query').eq(0).should('be.visible').click();
|
e2e.components.QueryEditorRow.actionButton('Duplicate query').eq(0).should('be.visible').click();
|
||||||
@@ -68,8 +55,6 @@ e2e.scenario({
|
|||||||
cy.contains('CSV Metric Values').scrollIntoView().should('be.visible').eq(0).click();
|
cy.contains('CSV Metric Values').scrollIntoView().should('be.visible').eq(0).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
e2e().wait('@apiPostQuery');
|
|
||||||
|
|
||||||
// Disable / enable row
|
// Disable / enable row
|
||||||
expectInspectorResultAndClose((keys) => {
|
expectInspectorResultAndClose((keys) => {
|
||||||
const length = keys.length;
|
const length = keys.length;
|
||||||
@@ -85,8 +70,6 @@ e2e.scenario({
|
|||||||
// Disable row with refId A
|
// Disable row with refId A
|
||||||
e2e.components.QueryEditorRow.actionButton('Disable/enable query').eq(1).should('be.visible').click();
|
e2e.components.QueryEditorRow.actionButton('Disable/enable query').eq(1).should('be.visible').click();
|
||||||
|
|
||||||
e2e().wait('@apiPostQuery');
|
|
||||||
|
|
||||||
expectInspectorResultAndClose((keys) => {
|
expectInspectorResultAndClose((keys) => {
|
||||||
const length = keys.length;
|
const length = keys.length;
|
||||||
expect(keys[length - 1].innerText).equals('B:');
|
expect(keys[length - 1].innerText).equals('B:');
|
||||||
@@ -95,8 +78,6 @@ e2e.scenario({
|
|||||||
// Enable row with refId B
|
// Enable row with refId B
|
||||||
e2e.components.QueryEditorRow.actionButton('Disable/enable query').eq(1).should('be.visible').click();
|
e2e.components.QueryEditorRow.actionButton('Disable/enable query').eq(1).should('be.visible').click();
|
||||||
|
|
||||||
e2e().wait('@apiPostQuery');
|
|
||||||
|
|
||||||
expectInspectorResultAndClose((keys) => {
|
expectInspectorResultAndClose((keys) => {
|
||||||
const length = keys.length;
|
const length = keys.length;
|
||||||
const resultIds = new Set<string>([
|
const resultIds = new Set<string>([
|
||||||
@@ -115,9 +96,7 @@ const expectInspectorResultAndClose = (expectCallBack: (keys: any[]) => void) =>
|
|||||||
|
|
||||||
e2e.components.PanelInspector.Query.refreshButton().should('be.visible').click();
|
e2e.components.PanelInspector.Query.refreshButton().should('be.visible').click();
|
||||||
|
|
||||||
e2e().wait('@apiPostQuery');
|
e2e.components.PanelInspector.Query.jsonObjectKeys({ timeout: flakyTimeout })
|
||||||
|
|
||||||
e2e.components.PanelInspector.Query.jsonObjectKeys()
|
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.within((keys: any) => expectCallBack(keys));
|
.within((keys: any) => expectCallBack(keys));
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import { e2e } from '@grafana/e2e';
|
import { e2e } from '@grafana/e2e';
|
||||||
|
|
||||||
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
|
const PAGE_UNDER_TEST = '-Y-tnEDWk/templating-nested-template-variables';
|
||||||
|
const flakyTimeout = 5000;
|
||||||
|
|
||||||
describe('Variables - Set options from ui', () => {
|
describe('Variables - Set options from ui', () => {
|
||||||
it('clicking a value that is not part of dependents options should change these to All', () => {
|
it('clicking a value that is not part of dependents options should change these to All', () => {
|
||||||
e2e.flows.login('admin', 'admin');
|
e2e.flows.login('admin', 'admin');
|
||||||
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=A&var-server=AA&var-pod=AAA` });
|
e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1&var-datacenter=A&var-server=AA&var-pod=AAA` });
|
||||||
e2e().intercept('/api/ds/query').as('query');
|
|
||||||
|
|
||||||
e2e().wait('@query');
|
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A').should('be.visible').click();
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('A').should('be.visible').click();
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible').click();
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible').click();
|
||||||
@@ -16,11 +14,9 @@ describe('Variables - Set options from ui', () => {
|
|||||||
|
|
||||||
e2e.components.PageToolbar.container().click();
|
e2e.components.PageToolbar.container().click();
|
||||||
|
|
||||||
e2e().wait('@query');
|
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').scrollIntoView().should('be.visible');
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').scrollIntoView().should('be.visible');
|
||||||
|
|
||||||
e2e.components.LoadingIndicator.icon().should('have.length', 0);
|
e2e().wait(flakyTimeout);
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All')
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All')
|
||||||
.should('have.length', 2)
|
.should('have.length', 2)
|
||||||
@@ -28,8 +24,6 @@ describe('Variables - Set options from ui', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
e2e().wait(2000);
|
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.within(() => {
|
.within(() => {
|
||||||
@@ -41,9 +35,9 @@ describe('Variables - Set options from ui', () => {
|
|||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BB').should('be.visible');
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BC').should('be.visible');
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All').should('be.visible').click();
|
e2e().wait(flakyTimeout);
|
||||||
|
|
||||||
e2e().wait(2000);
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('All').should('be.visible').click();
|
||||||
|
|
||||||
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
|
|||||||
Reference in New Issue
Block a user