Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Flaky E2E tests #22152

Merged
merged 3 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function openModalFromChartContext(targetMenuItem: string) {
.first()
.click();
}

cy.getBySel('metadata-bar').should('be.visible');
cy.wait('@samples');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

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