fix(cypress) Fix flaky mutations/domains cypress test (#13310)

This commit is contained in:
Chris Collins 2025-04-23 19:04:31 -04:00 committed by GitHub
parent fb4c505800
commit 86daf2bd5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import { FilterOutlined } from '@ant-design/icons';
import { Button, Typography, message } from 'antd';
import { debounce } from 'lodash';
import React, { useState } from 'react';
import styled from 'styled-components';
@ -11,6 +12,7 @@ import { EntityAndType } from '@app/entity/shared/types';
import { isListSubset } from '@app/entity/shared/utils';
import { SearchBar } from '@app/search/SearchBar';
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
import { DEBOUNCE_SEARCH_MS } from '@app/shared/constants';
import { useEntityRegistry } from '@app/useEntityRegistry';
import { SearchCfg } from '@src/conf';
@ -112,9 +114,9 @@ export const SearchSelect = ({
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
const facets = searchAcrossEntities?.facets || [];
const onSearch = (q: string) => {
const onSearch = debounce((q: string) => {
setQuery(q);
};
}, DEBOUNCE_SEARCH_MS);
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
setPage(1);

View File

@ -1,5 +1,6 @@
import { FilterOutlined } from '@ant-design/icons';
import { Button, Typography, message } from 'antd';
import { debounce } from 'lodash';
import React, { useState } from 'react';
import { useDebounce } from 'react-use';
import styled from 'styled-components';
@ -12,6 +13,7 @@ import { ANTD_GRAY } from '@app/entityV2/shared/constants';
import { isListSubset } from '@app/entityV2/shared/utils';
import { SearchBar } from '@app/search/SearchBar';
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
import { DEBOUNCE_SEARCH_MS } from '@app/shared/constants';
import { useEntityRegistry } from '@app/useEntityRegistry';
import SearchSortSelect from '@src/app/searchV2/sorting/SearchSortSelect';
import useSortInput from '@src/app/searchV2/sorting/useSortInput';
@ -119,9 +121,9 @@ export const SearchSelect = ({
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
const facets = searchAcrossEntities?.facets || [];
const onSearch = (q: string) => {
const onSearch = debounce((q: string) => {
setQuery(q);
};
}, DEBOUNCE_SEARCH_MS);
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
setPage(1);

View File

@ -10,3 +10,5 @@ export enum ErrorCodes {
NotFound = 404,
ServerError = 500,
}
export const DEBOUNCE_SEARCH_MS = 300;

View File

@ -44,8 +44,7 @@ describe("add remove domain", () => {
cy.get(".ant-modal-content").within(() => {
cy.get('[data-testid="search-input"]')
.click()
.invoke("val", "cypress_project.jaffle_shop.")
.type("customer");
.type("cypress_project.jaffle_shop.customer");
cy.contains("BigQuery", { timeout: 30000 });
cy.get(".ant-checkbox-input").first().click();
cy.get("#continueButton").click();