fix(cypress): Fix failing/flaky E2E tests (#22460)

This commit is contained in:
Cody Leff 2022-12-20 12:36:42 +00:00 committed by GitHub
parent 71982ee174
commit 21b56b2d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -172,13 +172,13 @@ describe('Drill to detail modal', () => {
openModalFromMenu('big_number_total');
// checking the data
cy.getBySel('row-count-label').should('contain', '75.7k rows');
cy.get('.virtual-table-cell').then($rows => {
cy.get('.virtual-table-cell').should($rows => {
expect($rows).to.contain('Amy');
});
// checking the paginated data
cy.get('.ant-pagination-item')
.should('have.length', 6)
.then($pages => {
.should($pages => {
expect($pages).to.contain('1');
expect($pages).to.contain('1514');
});
@ -186,7 +186,7 @@ describe('Drill to detail modal', () => {
// skips error on pagination
cy.on('uncaught:exception', () => false);
cy.wait('@samples');
cy.get('.virtual-table-cell').then($rows => {
cy.get('.virtual-table-cell').should($rows => {
expect($rows).to.contain('Kelly');
});

View File

@ -82,7 +82,7 @@ function prepareDashboardFilters(
}).then(res => {
const { body } = res;
const dashboardId = body.result.id;
const allFilters: Record<string, any>[] = [];
const allFilters: Record<string, unknown>[] = [];
filters.forEach((f, i) => {
allFilters.push({
id: `NATIVE_FILTER-fLH0pxFQ${i}`,
@ -202,6 +202,7 @@ function openVerticalFilterBar() {
function setFilterBarOrientation(orientation: 'vertical' | 'horizontal') {
cy.getBySel('filterbar-orientation-icon').click();
cy.wait(250);
cy.getBySel('dropdown-selectable-info')
.contains('Orientation of filter bar')
.should('exist');

View File

@ -306,8 +306,7 @@ export function getNativeFilterPlaceholderWithIndex(index: number) {
export function applyNativeFilterValueWithIndex(index: number, value: string) {
cy.get(nativeFilters.filterFromDashboardView.filterValueInput)
.eq(index)
.parent()
.should('be.visible', { timeout: 10000 })
.should('exist', { timeout: 10000 })
.type(`${value}{enter}`);
// click the title to dismiss shown options
cy.get(nativeFilters.filterFromDashboardView.filterName)

View File

@ -82,6 +82,7 @@ export function saveChartToDashboard(dashboardName: string) {
cy.wait('@update');
cy.wait('@get');
cy.wait('@getExplore');
cy.contains(`was added to dashboard [${dashboardName}]`);
}
export function visitSampleChartFromList(chartName: string) {