Skip to content

Commit

Permalink
chore(tests): Streamline Cypress login to fix fails/flakes (apache#22844
Browse files Browse the repository at this point in the history
)
  • Loading branch information
codyml authored and PawankumarES committed Feb 13, 2023
1 parent 90a9dc1 commit cb04059
Show file tree
Hide file tree
Showing 56 changed files with 10 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ describe('Alert list view', () => {
cy.visit(ALERT_LIST);
});

beforeEach(() => {
cy.preserveLogin();
});

it('should load alert lists', () => {
cy.getBySel('listview-table').should('be.visible');
cy.getBySel('sort-header').eq(1).contains('Last run');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ describe('Report list view', () => {
cy.visit(REPORT_LIST);
});

beforeEach(() => {
cy.preserveLogin();
});

it('should load report lists', () => {
cy.getBySel('listview-table').should('be.visible');
cy.getBySel('sort-header').eq(1).contains('Last run');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { CHART_LIST } from 'cypress/utils/urls';

describe('charts list view', () => {
beforeEach(() => {
cy.login();
cy.visit(CHART_LIST);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('Charts filters', () => {
});

beforeEach(() => {
cy.preserveLogin();
clearAllInputs();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ function visitChartList() {
}

describe('Charts list', () => {
beforeEach(() => {
cy.preserveLogin();
});

describe.skip('Cross-referenced dashboards', () => {
beforeEach(() => {
cy.createSampleDashboards([0, 1, 2, 3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { isLegacyResponse } from '../../utils/vizPlugins';

describe.skip('Dashboard top-level controls', () => {
beforeEach(() => {
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { WORLD_HEALTH_CHARTS } from './utils';

describe.skip('Dashboard filter', () => {
before(() => {
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ interface QueryString {

describe.skip('nativefilter url param key', () => {
// const urlParams = { param1: '123', param2: 'abc' };
before(() => {
cy.login();
});

let initialFilterKey: string;
it('should have cachekey in nativefilter param', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { WORLD_HEALTH_CHARTS } from './utils';
describe.skip('Dashboard form data', () => {
const urlParams = { param1: '123', param2: 'abc' };
before(() => {
cy.login();

cy.visit(WORLD_HEALTH_DASHBOARD, { qs: urlParams });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { WORLD_HEALTH_CHARTS } from './utils';

describe('Dashboard load', () => {
beforeEach(() => {
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ function testTimeChart(vizType: string) {

describe('Drill to detail modal', () => {
beforeEach(() => {
cy.preserveLogin();
closeModal();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ function openExplore(chartName: string) {
}

describe('Dashboard edit', () => {
beforeEach(() => {
cy.preserveLogin();
});

describe('Color consistency', () => {
beforeEach(() => {
visitResetTabbedDashboard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ import { waitForChartLoad } from 'cypress/utils';
import { WORLD_HEALTH_CHARTS, interceptLog } from './utils';

describe('Dashboard load', () => {
before(() => {
cy.login();
});

beforeEach(() => {
cy.preserveLogin();
});

it('should load dashboard', () => {
cy.visit(WORLD_HEALTH_DASHBOARD);
WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,6 @@ function openMoreFilters(intercetFilterState = true) {
}

describe('Horizontal FilterBar', () => {
before(() => {
cy.login();
});

beforeEach(() => {
cy.preserveLogin();
});

it('should go from vertical to horizontal and the opposite', () => {
visitDashboard();
openVerticalFilterBar();
Expand Down Expand Up @@ -412,10 +404,6 @@ describe('Horizontal FilterBar', () => {
});

describe('Native filters', () => {
beforeEach(() => {
cy.preserveLogin();
});

describe('Nativefilters tests initial state required', () => {
beforeEach(() => {
cy.createSampleDashboards([0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ describe('Dashboard tabs', () => {
});

beforeEach(() => {
cy.preserveLogin();
resetTabs();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { DASHBOARD_LIST } from 'cypress/utils/urls';

describe('dashboard list view', () => {
beforeEach(() => {
cy.login();
cy.visit(DASHBOARD_LIST);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('Dashboards filters', () => {
});

beforeEach(() => {
cy.preserveLogin();
clearAllInputs();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ function confirmDelete() {
}

describe('Dashboards list', () => {
beforeEach(() => {
cy.preserveLogin();
});

describe('list mode', () => {
before(() => {
cy.visit(DASHBOARD_LIST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('Add database', () => {
});

beforeEach(() => {
cy.preserveLogin();
closeModal();
cy.getBySel('btn-create-database').click();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ describe('Dataset list', () => {
cy.visit(DATASET_LIST_PATH);
});

beforeEach(() => {
cy.preserveLogin();
});

it('should open Explore on dataset name click', () => {
cy.intercept('**/api/v1/explore/**').as('explore');
cy.get('[data-test="listview-table"] [data-test="internal-link"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('AdhocMetrics', () => {
beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
cy.visitChartByName('Num Births Trend');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe.skip('AdhocFilters', () => {
beforeEach(() => {
cy.login();
cy.intercept('GET', '/superset/filter/table/*/name').as('filterValues');
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Advanced analytics', () => {
beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
cy.intercept('PUT', '/api/v1/explore/**').as('putExplore');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Annotations', () => {
beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('Cross-referenced dashboards', () => {
beforeEach(() => {
interceptFiltering();

cy.preserveLogin();
cy.createSampleDashboards(SAMPLE_DASHBOARDS_INDEXES);
cy.createSampleCharts([0]);
cy.visit(CHART_LIST);
Expand Down Expand Up @@ -125,7 +124,6 @@ describe('Cross-referenced dashboards', () => {

describe('No Results', () => {
beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import { interceptChart } from 'cypress/utils';
import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';

describe('Datasource control', () => {
beforeEach(() => {
cy.preserveLogin();
});

const newMetricName = `abc${Date.now()}`;

it('should allow edit dataset', () => {
Expand Down Expand Up @@ -89,7 +85,6 @@ describe('Datasource control', () => {

describe('Color scheme control', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: true }).as('chartData');

cy.visitChartByName('Num Births Trend');
Expand Down Expand Up @@ -120,7 +115,6 @@ describe('Color scheme control', () => {
});
describe('VizType control', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: false }).as('tableChartData');
interceptChart({ legacy: true }).as('lineChartData');
});
Expand All @@ -147,7 +141,6 @@ describe('VizType control', () => {

describe('Test datatable', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: false }).as('tableChartData');
interceptChart({ legacy: true }).as('lineChartData');
cy.visitChartByName('Daily Totals');
Expand All @@ -174,7 +167,6 @@ describe('Test datatable', () => {

describe('Time range filter', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: true }).as('chartData');
});

Expand Down Expand Up @@ -288,7 +280,6 @@ describe('Time range filter', () => {

describe('Groupby control', () => {
it('Set groupby', () => {
cy.login();
interceptChart({ legacy: true }).as('chartData');

cy.visitChartByName('Num Births Trend');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';

describe('explore view', () => {
beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('Edit FilterBox Chart', () => {
}

beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const apiURL = (endpoint: string, queryObject: Record<string, unknown>) =>

describe('Test explore links', () => {
beforeEach(() => {
cy.login();
interceptChart({ legacy: true }).as('chartData');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Visualization > Area', () => {
beforeEach(() => {
cy.preserveLogin();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { interceptChart } from 'cypress/utils';

describe('Visualization > Big Number with Trendline', () => {
beforeEach(() => {
cy.preserveLogin();
interceptChart({ legacy: false }).as('chartData');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper';

describe('Visualization > Big Number Total', () => {
beforeEach(() => {
cy.preserveLogin();
interceptChart({ legacy: false }).as('chartData');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Visualization > Box Plot', () => {
beforeEach(() => {
cy.preserveLogin();
cy.intercept('POST', '/api/v1/chart/data*').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Visualization > Bubble', () => {
beforeEach(() => {
cy.preserveLogin();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
describe('Visualization > Compare', () => {
beforeEach(() => {
cy.preserveLogin();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper';

describe('Visualization > Distribution bar chart', () => {
beforeEach(() => {
cy.preserveLogin();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Download Chart > Distribution bar chart', () => {
const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'dist_bar' };

beforeEach(() => {
cy.login();
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
});

Expand Down
Loading

0 comments on commit cb04059

Please sign in to comment.