mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
fix: Flaky E2E tests (#22152)
This commit is contained in:
@@ -65,7 +65,7 @@ function openModalFromChartContext(targetMenuItem: string) {
|
||||
.first()
|
||||
.click();
|
||||
}
|
||||
|
||||
cy.getBySel('metadata-bar').should('be.visible');
|
||||
cy.wait('@samples');
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +457,7 @@ describe('Native filters', () => {
|
||||
search.split('').slice(1, search.length).join('');
|
||||
|
||||
cy.location().then(loc => {
|
||||
cy.url().should('contain', 'native_filters_key');
|
||||
const queryParams = qs.parse(removeFirstChar(loc.search));
|
||||
filterKey = queryParams.native_filters_key as string;
|
||||
expect(typeof filterKey).eq('string');
|
||||
@@ -465,6 +466,7 @@ describe('Native filters', () => {
|
||||
addCountryNameFilter();
|
||||
saveNativeFilterSettings([SAMPLE_CHART]);
|
||||
cy.location().then(loc => {
|
||||
cy.url().should('contain', 'native_filters_key');
|
||||
const queryParams = qs.parse(removeFirstChar(loc.search));
|
||||
const newfilterKey = queryParams.native_filters_key;
|
||||
expect(newfilterKey).eq(filterKey);
|
||||
|
||||
@@ -158,6 +158,10 @@ export function interceptDatasets() {
|
||||
cy.intercept('GET', `/api/v1/dashboard/*/datasets`).as('getDatasets');
|
||||
}
|
||||
|
||||
export function interceptDashboardasync() {
|
||||
cy.intercept('GET', `/dashboardasync/api/read*`).as('getDashboardasync');
|
||||
}
|
||||
|
||||
export function setFilter(filter: string, option: string) {
|
||||
interceptFiltering();
|
||||
|
||||
@@ -346,8 +350,8 @@ export function cancelNativeFilterSettings() {
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get(nativeFilters.modal.alertXUnsavedFilters)
|
||||
.should('have.text', 'There are unsaved changes.')
|
||||
.should('be.visible');
|
||||
.should('be.visible')
|
||||
.should('have.text', 'There are unsaved changes.');
|
||||
cy.get(nativeFilters.modal.footer)
|
||||
.find(nativeFilters.modal.yesCancelButton)
|
||||
.contains('cancel')
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { interceptGet as interceptDashboardGet } from '../dashboard/utils';
|
||||
import {
|
||||
interceptGet as interceptDashboardGet,
|
||||
interceptDashboardasync,
|
||||
} from '../dashboard/utils';
|
||||
|
||||
export function interceptFiltering() {
|
||||
cy.intercept('GET', `/api/v1/chart/?q=*`).as('filtering');
|
||||
@@ -58,10 +61,13 @@ export function setFilter(filter: string, option: string) {
|
||||
|
||||
export function saveChartToDashboard(dashboardName: string) {
|
||||
interceptDashboardGet();
|
||||
interceptDashboardasync();
|
||||
interceptUpdate();
|
||||
interceptExploreGet();
|
||||
|
||||
cy.getBySel('query-save-button').click();
|
||||
cy.wait('@getDashboardasync');
|
||||
cy.getBySelLike('chart-modal').should('be.visible');
|
||||
cy.get(
|
||||
'[data-test="save-chart-modal-select-dashboard-form"] [aria-label="Select a dashboard"]',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user