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,
videoUploadOnPasses: false,
chromeWebSecurity: false,
numTestsKeptInMemory: 0,
e2e: {
// We've imported your old cypress plugins here.
// 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/search/query?q=*&from=*&size=*&index=${SEARCH_INDEX[entity]}`,
`/api/v1/search/query?q=*&index=${SEARCH_INDEX[entity]}&from=*&size=**`,
'explorePageTabSearch'
);
interceptURL(
'GET',
`/api/v1/search/suggest?q=*&index=*`,
'searchQuery'
);
interceptURL('GET', `/api/v1/search/suggest?q=*&index=*`, 'searchQuery');
interceptURL('GET', `/api/v1/search/*`, 'explorePageSearch');
// searching term in search box
@ -447,8 +443,7 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => {
verifyResponseStatusCode('@explorePageSearch', 200);
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
cy.get(`[data-testid="${entity}-tab"]`)
.should('be.visible')
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible');
verifyResponseStatusCode('@explorePageTabSearch', 200);
cy.get(`[data-testid="${serviceName}-${term}"]`)

View File

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

View File

@ -13,8 +13,31 @@
/// <reference types="cypress" />
import { 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';
import {
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 serviceName = `${serviceType}-ct-test-${uuid()}`;
@ -158,15 +181,13 @@ describe('Data Quality and Profiler should work properly', () => {
// wait for ingestion to run
cy.clock();
cy.wait(10000);
interceptURL(
'GET',
'/api/v1/testCase?fields=testCaseResult,testDefinition,testSuite&testSuiteId=*&limit=10',
'testCase'
);
interceptURL('GET', '/api/v1/testCase?fields=*', 'testCase');
cy.get('[data-testid="view-service-button"]')
.should('be.visible')
.click({ force: true });
verifyResponseStatusCode('@getEntityDetails', 200);
verifyResponseStatusCode('@testCase', 200);
cy.contains(`${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`).should(
'be.visible'

View File

@ -11,10 +11,15 @@
* 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';
const roles = {
dataConsumer: 'Data Consumer',
dataSteward: 'Data Steward',
@ -111,8 +116,6 @@ describe('Roles page should work properly', () => {
.scrollIntoView()
.should('be.visible')
.click();
//Clicking outside to close the dropdown
cy.get('.ant-card-body').click();
//Save the role
cy.get('[data-testid="submit-btn"]')
.scrollIntoView()
@ -158,9 +161,9 @@ describe('Roles page should work properly', () => {
//Navigating to roles tab to verify the added role
cy.get('[data-testid="breadcrumb-link"]').first().click();
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')
.contains('+1 more')
.click();
// second policy should be visible on tooltip

View File

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

View File

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

View File

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