Skip to content

Commit

Permalink
fix(cypress): Fix failing/flaky E2E tests (#22460)
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml committed Dec 20, 2022
1 parent 71982ee commit 21b56b2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,21 @@ 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');
});
cy.get('.ant-pagination-item').eq(4).click();
// 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');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 21b56b2

Please sign in to comment.