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"]'
).click();
verifyResponseStatusCode('@fetchGlossaries', 200);
// Remove all added tags
cy.get(
`[data-testid="selected-tag-${glossaryTerm}"] [data-testid="remove-tags"]`
).click();
verifyResponseStatusCode('@fetchGlossaries', 200);
cy.get('[data-testid="saveAssociatedTag"]').click();
verifyResponseStatusCode('@removeTags', 200, {
requestTimeout: 15000,

View File

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

View File

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

View File

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