mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-13 00:22:23 +00:00
CYPRESS: fix AUT cypress failure for user,persona and customizeLanding (#17338)
* fix aut cypress failure for user,persona and customizeLanding * fixes failure
This commit is contained in:
parent
71a57a83bb
commit
53ae052a3f
@ -93,7 +93,7 @@ export const navigateToLandingPage = () => {
|
||||
export const openAddWidgetModal = () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
`/api/v1/docStore?fqnPrefix=KnowledgePanel`,
|
||||
`/api/v1/docStore?fqnPrefix=KnowledgePanel&limit=25`,
|
||||
'getWidgetsList'
|
||||
);
|
||||
|
||||
|
||||
@ -196,9 +196,10 @@ class UsersTestClass {
|
||||
cy.get('[data-testid="displayName"]').clear();
|
||||
interceptURL('PATCH', '/api/v1/users/*', 'updateName');
|
||||
cy.get('[data-testid="inline-save-btn"]').click();
|
||||
cy.get('[data-testid="edit-displayName"]').scrollIntoView();
|
||||
verifyResponseStatusCode('@updateName', 200);
|
||||
|
||||
cy.get('[data-testid="user-name"]').should('contain', 'Add Display Name');
|
||||
|
||||
cy.get('.ant-collapse-expand-icon > .anticon > svg').click();
|
||||
cy.get('[data-testid="edit-teams-button"]').click();
|
||||
interceptURL('PATCH', '/api/v1/users/*', 'updateTeam');
|
||||
|
||||
@ -91,6 +91,18 @@ describe('Persona operations', { tags: 'Settings' }, () => {
|
||||
});
|
||||
|
||||
it('Persona creation should work properly', () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/users?limit=25&isBot=false',
|
||||
'getInitialUsers'
|
||||
);
|
||||
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/search/query?q=***%20AND%20isBot:false&from=0&size=25&index=user_search_index',
|
||||
'getUserSearch'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="add-persona-button"]').scrollIntoView().click();
|
||||
cy.get('[data-testid="name"]').clear().type(PERSONA_DETAILS.name);
|
||||
validateFormNameFieldInput({
|
||||
@ -105,8 +117,12 @@ describe('Persona operations', { tags: 'Settings' }, () => {
|
||||
cy.get(descriptionBox).type(PERSONA_DETAILS.description);
|
||||
cy.get('[data-testid="add-users"]').scrollIntoView().click();
|
||||
|
||||
verifyResponseStatusCode('@getInitialUsers', 200);
|
||||
|
||||
cy.get('[data-testid="searchbar"]').type(userSearchText);
|
||||
|
||||
verifyResponseStatusCode('@getUserSearch', 200);
|
||||
|
||||
cy.get(`.ant-popover [title="${userSearchText}"]`).click();
|
||||
cy.get('[data-testid="selectable-list-update-btn"]')
|
||||
.scrollIntoView()
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { PAGE_SIZE_MEDIUM } from '../../../../constants/constants';
|
||||
import { mockWidgetsData } from '../../../../mocks/AddWidgetModal.mock';
|
||||
import { getAllKnowledgePanels } from '../../../../rest/DocStoreAPI';
|
||||
import AddWidgetModal from './AddWidgetModal';
|
||||
@ -75,6 +76,11 @@ describe('AddWidgetModal component', () => {
|
||||
render(<AddWidgetModal {...mockProps} />);
|
||||
});
|
||||
|
||||
expect(getAllKnowledgePanels).toHaveBeenCalledWith({
|
||||
fqnPrefix: 'KnowledgePanel',
|
||||
limit: PAGE_SIZE_MEDIUM,
|
||||
});
|
||||
|
||||
expect(
|
||||
screen.getByTestId('ActivityFeed-widget-tab-label')
|
||||
).toBeInTheDocument();
|
||||
|
||||
@ -17,7 +17,10 @@ import { AxiosError } from 'axios';
|
||||
import { isEmpty, toString } from 'lodash';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { LIGHT_GREEN_COLOR } from '../../../../constants/constants';
|
||||
import {
|
||||
LIGHT_GREEN_COLOR,
|
||||
PAGE_SIZE_MEDIUM,
|
||||
} from '../../../../constants/constants';
|
||||
import { ERROR_PLACEHOLDER_TYPE } from '../../../../enums/common.enum';
|
||||
import { WidgetWidths } from '../../../../enums/CustomizablePage.enum';
|
||||
import { Document } from '../../../../generated/entity/docStore/document';
|
||||
@ -50,6 +53,7 @@ function AddWidgetModal({
|
||||
setLoading(true);
|
||||
const response = await getAllKnowledgePanels({
|
||||
fqnPrefix: 'KnowledgePanel',
|
||||
limit: PAGE_SIZE_MEDIUM,
|
||||
});
|
||||
|
||||
setWidgetsList(response.data);
|
||||
|
||||
@ -20,7 +20,10 @@ import { getEncodedFqn } from '../utils/StringsUtils';
|
||||
|
||||
const BASE_URL = 'docStore';
|
||||
|
||||
export const getAllKnowledgePanels = async (params: { fqnPrefix: string }) => {
|
||||
export const getAllKnowledgePanels = async (params: {
|
||||
fqnPrefix: string;
|
||||
limit: number;
|
||||
}) => {
|
||||
const response = await axiosClient.get<PagingResponse<Document[]>>(
|
||||
`${BASE_URL}`,
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user