Cypress: Fixed failing cypress for role page (#8381)

* Cypress: Fixed failing cypress for role page

* fixed data quality test

* fixed memory getting full and cypress getting crush issue

* fixed explore page getting unresponsive
This commit is contained in:
Shailesh Parmar 2022-10-29 09:05:20 +05:30 committed by GitHub
parent 80b9555ea2
commit 63f8f9a15b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 32 deletions

View File

@ -9,6 +9,7 @@ export default defineConfig({
defaultCommandTimeout: 5000, defaultCommandTimeout: 5000,
videoUploadOnPasses: false, videoUploadOnPasses: false,
chromeWebSecurity: false, chromeWebSecurity: false,
numTestsKeptInMemory: 0,
e2e: { e2e: {
// We've imported your old cypress plugins here. // We've imported your old cypress plugins here.
// You may want to clean this up later by importing these. // You may want to clean this up later by importing these.

View File

@ -413,14 +413,10 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => {
interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails'); interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails');
interceptURL( interceptURL(
'GET', 'GET',
`/api/v1/search/query?q=*&from=*&size=*&index=${SEARCH_INDEX[entity]}`, `/api/v1/search/query?q=*&index=${SEARCH_INDEX[entity]}&from=*&size=**`,
'explorePageTabSearch' 'explorePageTabSearch'
); );
interceptURL( interceptURL('GET', `/api/v1/search/suggest?q=*&index=*`, 'searchQuery');
'GET',
`/api/v1/search/suggest?q=*&index=*`,
'searchQuery'
);
interceptURL('GET', `/api/v1/search/*`, 'explorePageSearch'); interceptURL('GET', `/api/v1/search/*`, 'explorePageSearch');
// searching term in search box // searching term in search box
@ -447,8 +443,7 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => {
verifyResponseStatusCode('@explorePageSearch', 200); verifyResponseStatusCode('@explorePageSearch', 200);
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click(); cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
cy.get(`[data-testid="${entity}-tab"]`) cy.get(`[data-testid="${entity}-tab"]`).should('be.visible');
.should('be.visible')
verifyResponseStatusCode('@explorePageTabSearch', 200); verifyResponseStatusCode('@explorePageTabSearch', 200);
cy.get(`[data-testid="${serviceName}-${term}"]`) cy.get(`[data-testid="${serviceName}-${term}"]`)

View File

@ -60,8 +60,6 @@ describe("Test Add role and assign it to the user", () => {
.scrollIntoView() .scrollIntoView()
.should('be.visible') .should('be.visible')
.click(); .click();
//Clicking outside to close the dropdown
cy.get('.ant-card-body').click();
//Save the role //Save the role
cy.get('[data-testid="submit-btn"]') cy.get('[data-testid="submit-btn"]')
.scrollIntoView() .scrollIntoView()

View File

@ -13,8 +13,31 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import { deleteCreatedService, descriptionBox, goToAddNewServicePage, handleIngestionRetry, interceptURL, login, mySqlConnectionInput, scheduleIngestion, testServiceCreationAndIngestion, uuid, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common'; import {
import { DATA_QUALITY_SAMPLE_DATA_TABLE, DELETE_TERM, LOGIN, MYDATA_SUMMARY_OPTIONS, NEW_COLUMN_TEST_CASE, NEW_TABLE_TEST_CASE, NEW_TEST_SUITE, SERVICE_TYPE, TEAM_ENTITY } from '../../constants/constants'; deleteCreatedService,
descriptionBox,
goToAddNewServicePage,
handleIngestionRetry,
interceptURL,
login,
mySqlConnectionInput,
scheduleIngestion,
testServiceCreationAndIngestion,
uuid,
verifyResponseStatusCode,
visitEntityDetailsPage
} from '../../common/common';
import {
DATA_QUALITY_SAMPLE_DATA_TABLE,
DELETE_TERM,
LOGIN,
MYDATA_SUMMARY_OPTIONS,
NEW_COLUMN_TEST_CASE,
NEW_TABLE_TEST_CASE,
NEW_TEST_SUITE,
SERVICE_TYPE,
TEAM_ENTITY
} from '../../constants/constants';
const serviceType = 'Mysql'; const serviceType = 'Mysql';
const serviceName = `${serviceType}-ct-test-${uuid()}`; const serviceName = `${serviceType}-ct-test-${uuid()}`;
@ -158,15 +181,13 @@ describe('Data Quality and Profiler should work properly', () => {
// wait for ingestion to run // wait for ingestion to run
cy.clock(); cy.clock();
cy.wait(10000); cy.wait(10000);
interceptURL( interceptURL('GET', '/api/v1/testCase?fields=*', 'testCase');
'GET',
'/api/v1/testCase?fields=testCaseResult,testDefinition,testSuite&testSuiteId=*&limit=10',
'testCase'
);
cy.get('[data-testid="view-service-button"]') cy.get('[data-testid="view-service-button"]')
.should('be.visible') .should('be.visible')
.click({ force: true }); .click({ force: true });
verifyResponseStatusCode('@getEntityDetails', 200);
verifyResponseStatusCode('@testCase', 200); verifyResponseStatusCode('@testCase', 200);
cy.contains(`${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`).should( cy.contains(`${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`).should(
'be.visible' 'be.visible'

View File

@ -11,10 +11,15 @@
* limitations under the License. * limitations under the License.
*/ */
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common'; import {
descriptionBox,
interceptURL,
login,
uuid,
verifyResponseStatusCode
} from '../../common/common';
import { LOGIN } from '../../constants/constants'; import { LOGIN } from '../../constants/constants';
const roles = { const roles = {
dataConsumer: 'Data Consumer', dataConsumer: 'Data Consumer',
dataSteward: 'Data Steward', dataSteward: 'Data Steward',
@ -111,8 +116,6 @@ describe('Roles page should work properly', () => {
.scrollIntoView() .scrollIntoView()
.should('be.visible') .should('be.visible')
.click(); .click();
//Clicking outside to close the dropdown
cy.get('.ant-card-body').click();
//Save the role //Save the role
cy.get('[data-testid="submit-btn"]') cy.get('[data-testid="submit-btn"]')
.scrollIntoView() .scrollIntoView()
@ -158,9 +161,9 @@ describe('Roles page should work properly', () => {
//Navigating to roles tab to verify the added role //Navigating to roles tab to verify the added role
cy.get('[data-testid="breadcrumb-link"]').first().click(); cy.get('[data-testid="breadcrumb-link"]').first().click();
cy.get('table').should('be.visible').should('contain', roleName); cy.get('table').should('be.visible').should('contain', roleName);
cy.get('[data-testid="plus-more-count"]') cy.get(`[data-row-key="${roleName}"]`)
.find('[data-testid="plus-more-count"]')
.should('be.visible') .should('be.visible')
.contains('+1 more')
.click(); .click();
// second policy should be visible on tooltip // second policy should be visible on tooltip

View File

@ -85,17 +85,17 @@ const FacetFilter: React.FC<FacetFilterProps> = ({
.sort(([key1], [key2]) => compareAggregationKey(key1, key2)); .sort(([key1], [key2]) => compareAggregationKey(key1, key2));
}, [aggregations, filters]); }, [aggregations, filters]);
useEffect( useEffect(() => {
() => if (!isEmpty(aggregations)) {
setAggregationsPageSize( setAggregationsPageSize(
Object.fromEntries( Object.fromEntries(
Object.keys(aggregations).map((k) => Object.keys(aggregations).map((k) =>
k in aggregationsPageSize ? [k, aggregationsPageSize[k]] : [k, 5] k in aggregationsPageSize ? [k, aggregationsPageSize[k]] : [k, 5]
) )
) )
), );
[aggregations] }
); }, [aggregations]);
return ( return (
<> <>

View File

@ -29,6 +29,7 @@ import {
getEntityId, getEntityId,
getEntityName, getEntityName,
getEntityPlaceHolder, getEntityPlaceHolder,
getNameFromFQN,
getOwnerValue, getOwnerValue,
getPartialNameFromTableFQN, getPartialNameFromTableFQN,
} from '../../../utils/CommonUtils'; } from '../../../utils/CommonUtils';
@ -119,9 +120,7 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = ({
data-testid={`${getPartialNameFromTableFQN( data-testid={`${getPartialNameFromTableFQN(
source.fullyQualifiedName ?? '', source.fullyQualifiedName ?? '',
[FqnPart.Service] [FqnPart.Service]
)}-${getPartialNameFromTableFQN(source.fullyQualifiedName ?? '', [ )}-${getNameFromFQN(source.fullyQualifiedName ?? '')}`}
FqnPart.Table,
])}`}
id={`${id}Title`} id={`${id}Title`}
onClick={handleLinkClick}> onClick={handleLinkClick}>
{stringToHTML(source.name)} {stringToHTML(source.name)}

View File

@ -185,7 +185,7 @@ const RolesList: FC<RolesListProps> = ({ roles, fetchRoles }) => {
data-testid="roles-list-table" data-testid="roles-list-table"
dataSource={roles} dataSource={roles}
pagination={false} pagination={false}
rowKey="id" rowKey="name"
size="small" size="small"
/> />
{selectedRole && ( {selectedRole && (