mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-14 03:26:47 +00:00
fix(cypress) Fix flaky mutations/domains cypress test (#13310)
This commit is contained in:
parent
fb4c505800
commit
86daf2bd5b
@ -1,5 +1,6 @@
|
|||||||
import { FilterOutlined } from '@ant-design/icons';
|
import { FilterOutlined } from '@ant-design/icons';
|
||||||
import { Button, Typography, message } from 'antd';
|
import { Button, Typography, message } from 'antd';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ import { EntityAndType } from '@app/entity/shared/types';
|
|||||||
import { isListSubset } from '@app/entity/shared/utils';
|
import { isListSubset } from '@app/entity/shared/utils';
|
||||||
import { SearchBar } from '@app/search/SearchBar';
|
import { SearchBar } from '@app/search/SearchBar';
|
||||||
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
|
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
|
||||||
|
import { DEBOUNCE_SEARCH_MS } from '@app/shared/constants';
|
||||||
import { useEntityRegistry } from '@app/useEntityRegistry';
|
import { useEntityRegistry } from '@app/useEntityRegistry';
|
||||||
import { SearchCfg } from '@src/conf';
|
import { SearchCfg } from '@src/conf';
|
||||||
|
|
||||||
@ -112,9 +114,9 @@ export const SearchSelect = ({
|
|||||||
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
|
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
|
||||||
const facets = searchAcrossEntities?.facets || [];
|
const facets = searchAcrossEntities?.facets || [];
|
||||||
|
|
||||||
const onSearch = (q: string) => {
|
const onSearch = debounce((q: string) => {
|
||||||
setQuery(q);
|
setQuery(q);
|
||||||
};
|
}, DEBOUNCE_SEARCH_MS);
|
||||||
|
|
||||||
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
|
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
|
||||||
setPage(1);
|
setPage(1);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { FilterOutlined } from '@ant-design/icons';
|
import { FilterOutlined } from '@ant-design/icons';
|
||||||
import { Button, Typography, message } from 'antd';
|
import { Button, Typography, message } from 'antd';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useDebounce } from 'react-use';
|
import { useDebounce } from 'react-use';
|
||||||
import styled from 'styled-components';
|
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 { isListSubset } from '@app/entityV2/shared/utils';
|
||||||
import { SearchBar } from '@app/search/SearchBar';
|
import { SearchBar } from '@app/search/SearchBar';
|
||||||
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
|
import { ENTITY_FILTER_NAME, UnionType } from '@app/search/utils/constants';
|
||||||
|
import { DEBOUNCE_SEARCH_MS } from '@app/shared/constants';
|
||||||
import { useEntityRegistry } from '@app/useEntityRegistry';
|
import { useEntityRegistry } from '@app/useEntityRegistry';
|
||||||
import SearchSortSelect from '@src/app/searchV2/sorting/SearchSortSelect';
|
import SearchSortSelect from '@src/app/searchV2/sorting/SearchSortSelect';
|
||||||
import useSortInput from '@src/app/searchV2/sorting/useSortInput';
|
import useSortInput from '@src/app/searchV2/sorting/useSortInput';
|
||||||
@ -119,9 +121,9 @@ export const SearchSelect = ({
|
|||||||
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
|
const selectedEntityUrns = selectedEntities.map((entity) => entity.urn);
|
||||||
const facets = searchAcrossEntities?.facets || [];
|
const facets = searchAcrossEntities?.facets || [];
|
||||||
|
|
||||||
const onSearch = (q: string) => {
|
const onSearch = debounce((q: string) => {
|
||||||
setQuery(q);
|
setQuery(q);
|
||||||
};
|
}, DEBOUNCE_SEARCH_MS);
|
||||||
|
|
||||||
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
|
const onChangeFilters = (newFilters: Array<FacetFilterInput>) => {
|
||||||
setPage(1);
|
setPage(1);
|
||||||
|
|||||||
@ -10,3 +10,5 @@ export enum ErrorCodes {
|
|||||||
NotFound = 404,
|
NotFound = 404,
|
||||||
ServerError = 500,
|
ServerError = 500,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const DEBOUNCE_SEARCH_MS = 300;
|
||||||
|
|||||||
@ -44,8 +44,7 @@ describe("add remove domain", () => {
|
|||||||
cy.get(".ant-modal-content").within(() => {
|
cy.get(".ant-modal-content").within(() => {
|
||||||
cy.get('[data-testid="search-input"]')
|
cy.get('[data-testid="search-input"]')
|
||||||
.click()
|
.click()
|
||||||
.invoke("val", "cypress_project.jaffle_shop.")
|
.type("cypress_project.jaffle_shop.customer");
|
||||||
.type("customer");
|
|
||||||
cy.contains("BigQuery", { timeout: 30000 });
|
cy.contains("BigQuery", { timeout: 30000 });
|
||||||
cy.get(".ant-checkbox-input").first().click();
|
cy.get(".ant-checkbox-input").first().click();
|
||||||
cy.get("#continueButton").click();
|
cy.get("#continueButton").click();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user