fix glossary term selection (#16303)

* fix glossary term selection

* fix flaky tags cypress
This commit is contained in:
Karan Hotchandani 2024-05-16 18:19:54 +05:30 committed by GitHub
parent 9747315522
commit 46e14b79f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 29 deletions

View File

@ -95,13 +95,13 @@ export const removeGlossaryTerm = (
'[data-testid="entity-right-panel"] [data-testid="glossary-container"] [data-testid="edit-button"]' '[data-testid="entity-right-panel"] [data-testid="glossary-container"] [data-testid="edit-button"]'
).click(); ).click();
verifyResponseStatusCode('@fetchGlossaries', 200);
// Remove all added tags // Remove all added tags
cy.get( cy.get(
`[data-testid="selected-tag-${glossaryTerm}"] [data-testid="remove-tags"]` `[data-testid="selected-tag-${glossaryTerm}"] [data-testid="remove-tags"]`
).click(); ).click();
verifyResponseStatusCode('@fetchGlossaries', 200);
cy.get('[data-testid="saveAssociatedTag"]').click(); cy.get('[data-testid="saveAssociatedTag"]').click();
verifyResponseStatusCode('@removeTags', 200, { verifyResponseStatusCode('@removeTags', 200, {
requestTimeout: 15000, requestTimeout: 15000,

View File

@ -93,11 +93,12 @@ export const removeTags = (
.scrollIntoView() .scrollIntoView()
.click(); .click();
verifyResponseStatusCode('@searchTags', 200);
// Remove all added tags // Remove all added tags
cy.get( cy.get(
`[data-testid="selected-tag-${tag}"] [data-testid="remove-tags"]` `[data-testid="selected-tag-${tag}"] [data-testid="remove-tags"]`
).click(); ).click();
verifyResponseStatusCode('@searchTags', 200);
cy.get('[data-testid="saveAssociatedTag"]').click(); cy.get('[data-testid="saveAssociatedTag"]').click();
verifyResponseStatusCode('@removeTags', 200, { verifyResponseStatusCode('@removeTags', 200, {

View File

@ -124,33 +124,35 @@ describe('Search Index Application', { tags: 'Settings' }, () => {
); );
}); });
it('Run application', () => { if (Cypress.env('isOss')) {
interceptURL( it('Run application', () => {
'GET', interceptURL(
'/api/v1/apps/name/SearchIndexingApplication?fields=*', 'GET',
'getSearchIndexingApplication' '/api/v1/apps/name/SearchIndexingApplication?fields=*',
); 'getSearchIndexingApplication'
interceptURL( );
'POST', interceptURL(
'/api/v1/apps/trigger/SearchIndexingApplication', 'POST',
'triggerPipeline' '/api/v1/apps/trigger/SearchIndexingApplication',
); 'triggerPipeline'
cy.get( );
'[data-testid="search-indexing-application-card"] [data-testid="config-btn"]' cy.get(
).click(); '[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
verifyResponseStatusCode('@getSearchIndexingApplication', 200); ).click();
cy.get('[data-testid="run-now-button"]').click(); verifyResponseStatusCode('@getSearchIndexingApplication', 200);
verifyResponseStatusCode('@triggerPipeline', 200); cy.get('[data-testid="run-now-button"]').click();
verifyResponseStatusCode('@triggerPipeline', 200);
cy.wait(120000); // waiting for 2 minutes before we check if reindex was success cy.wait(120000); // waiting for 2 minutes before we check if reindex was success
interceptURL( interceptURL(
'GET', 'GET',
'/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1', '/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1',
'lastExecutionRun' 'lastExecutionRun'
); );
cy.reload(); cy.reload();
verifyLastExecutionRun('lastExecutionRun'); verifyLastExecutionRun('lastExecutionRun');
}); });
}
}); });

View File

@ -183,7 +183,13 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
value: string; value: string;
}[] }[]
) => { ) => {
const lastSelectedMap = new Map(
selectedTagsRef.current.map((tag) => [tag.value, tag])
);
const selectedValues = values.map(({ value }) => { const selectedValues = values.map(({ value }) => {
if (lastSelectedMap.has(value)) {
return lastSelectedMap.get(value) as SelectOption;
}
const initialData = findGlossaryTermByFqn( const initialData = findGlossaryTermByFqn(
[ [
...glossaries, ...glossaries,