Fixed Failing cypress part 2 (#7784)

* Fixed Failing cypress part 2

* added api wait for search

* added test for profiler check

* fixed failing cypress

* fixed failing tests
This commit is contained in:
Shailesh Parmar 2022-09-29 15:21:33 +05:30 committed by GitHub
parent 6cfd16925a
commit 2c3802525f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 82 deletions

View File

@ -422,7 +422,7 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => {
.click(); .click();
} else { } else {
// if term is not available in search suggestion, hitting enter to search box so it will redirect to explore page // if term is not available in search suggestion, hitting enter to search box so it will redirect to explore page
cy.get('body').click(); cy.get('body').click(1, 1);
cy.get('[data-testid="searchBox"]').type('{enter}'); cy.get('[data-testid="searchBox"]').type('{enter}');
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click(); cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
@ -439,15 +439,23 @@ export const visitEntityDetailsPage = (term, serviceName, entity) => {
}); });
verifyResponseStatusCode('@getEntityDetails', 200); verifyResponseStatusCode('@getEntityDetails', 200);
cy.get('body').click(); cy.get('body').then(($body) => {
if ($body.find('[data-testid="suggestion-overlay"]').length) {
cy.get('[data-testid="suggestion-overlay"]').click(1, 1);
}
});
cy.get('body').click(1, 1);
cy.get('[data-testid="searchBox"]').clear(); cy.get('[data-testid="searchBox"]').clear();
}; };
// add new tag to entity and its table // add new tag to entity and its table
export const addNewTagToEntity = (entity, term) => { export const addNewTagToEntity = (entityObj, term) => {
searchEntity(entity); visitEntityDetailsPage(
entityObj.term,
entityObj.serviceName,
entityObj.entity
);
cy.wait(500); cy.wait(500);
cy.get('[data-testid="table-link"]').first().contains(entity).click();
cy.get('[data-testid="tags"] > [data-testid="add-tag"]') cy.get('[data-testid="tags"] > [data-testid="add-tag"]')
.eq(0) .eq(0)
.should('be.visible') .should('be.visible')
@ -651,7 +659,12 @@ export const toastNotification = (msg) => {
cy.get('.Toastify__close-button').should('be.visible').click(); cy.get('.Toastify__close-button').should('be.visible').click();
}; };
export const addCustomPropertiesForEntity = (entityType, customType, value) => { export const addCustomPropertiesForEntity = (
entityType,
customType,
value,
entityObj
) => {
const propertyName = `entity${entityType.name}test${uuid()}`; const propertyName = `entity${entityType.name}test${uuid()}`;
//Add Custom property for selected entity //Add Custom property for selected entity
@ -677,19 +690,12 @@ export const addCustomPropertiesForEntity = (entityType, customType, value) => {
cy.clickOnLogo(); cy.clickOnLogo();
//Checking the added property in Entity //Checking the added property in Entity
//cy.contains(entityType.name).scrollIntoView().should('be.visible').click();
cy.get(`[data-testid*="${entityType.name}"] > .ant-btn > span`) visitEntityDetailsPage(
.scrollIntoView() entityObj.term,
.should('be.visible') entityObj.serviceName,
.click(); entityObj.entity
);
cy.wait(1000);
cy.get('[data-testid="table-link"]')
.first()
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="Custom Properties"]') cy.get('[data-testid="Custom Properties"]')
.should('exist') .should('exist')

View File

@ -68,20 +68,15 @@ export const SEARCH_ENTITY_DASHBOARD = {
serviceName: 'sample_superset', serviceName: 'sample_superset',
}, },
}; };
// Note:- Please do not change term name of pipeline
export const SEARCH_ENTITY_PIPELINE = { export const SEARCH_ENTITY_PIPELINE = {
pipeline_1: { pipeline_1: {
term: 'Snowflake ETL', term: 'dim_product_etl',
entity: MYDATA_SUMMARY_OPTIONS.pipelines, entity: MYDATA_SUMMARY_OPTIONS.pipelines,
serviceName: 'sample_airflow', serviceName: 'sample_airflow',
}, },
pipeline_2: { pipeline_2: {
term: 'Hive ETL', term: 'dim_location_etl',
entity: MYDATA_SUMMARY_OPTIONS.pipelines,
serviceName: 'sample_airflow',
},
pipeline_3: {
term: 'Trino ETL',
entity: MYDATA_SUMMARY_OPTIONS.pipelines, entity: MYDATA_SUMMARY_OPTIONS.pipelines,
serviceName: 'sample_airflow', serviceName: 'sample_airflow',
}, },
@ -208,6 +203,7 @@ export const ENTITIES = {
integerValue: '45', integerValue: '45',
stringValue: 'This is string propery', stringValue: 'This is string propery',
markdownValue: 'This is markdown value', markdownValue: 'This is markdown value',
entityObj: SEARCH_ENTITY_TABLE.table_1,
}, },
entity_topic: { entity_topic: {
name: 'topic', name: 'topic',
@ -215,6 +211,7 @@ export const ENTITIES = {
integerValue: '23', integerValue: '23',
stringValue: 'This is string propery', stringValue: 'This is string propery',
markdownValue: 'This is markdown value', markdownValue: 'This is markdown value',
entityObj: SEARCH_ENTITY_TOPIC.topic_1,
}, },
entity_dashboard: { entity_dashboard: {
name: 'dashboard', name: 'dashboard',
@ -222,6 +219,7 @@ export const ENTITIES = {
integerValue: '14', integerValue: '14',
stringValue: 'This is string propery', stringValue: 'This is string propery',
markdownValue: 'This is markdown value', markdownValue: 'This is markdown value',
entityObj: SEARCH_ENTITY_DASHBOARD.dashboard_1,
}, },
entity_pipeline: { entity_pipeline: {
name: 'pipeline', name: 'pipeline',
@ -229,6 +227,7 @@ export const ENTITIES = {
integerValue: '78', integerValue: '78',
stringValue: 'This is string propery', stringValue: 'This is string propery',
markdownValue: 'This is markdown value', markdownValue: 'This is markdown value',
entityObj: SEARCH_ENTITY_PIPELINE.pipeline_1,
}, },
}; };

View File

@ -16,7 +16,7 @@ import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Metabase'; const serviceType = 'Metabase';
const serviceName = `${serviceType}-ct-test-${uuid()}`; const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'jaffle_shop'; const tableName = 'jaffle_shop dashboard';
const description = `This is ${serviceName} description`; const description = `This is ${serviceName} description`;
describe('Metabase Ingestion', () => { describe('Metabase Ingestion', () => {

View File

@ -15,15 +15,24 @@ import { addCustomPropertiesForEntity, deleteCreatedProperty, editCreatedPropert
import { ENTITIES, LOGIN } from '../../constants/constants'; import { ENTITIES, LOGIN } from '../../constants/constants';
describe('Custom Properties should work properly', () => { describe('Custom Properties should work properly', () => {
beforeEach(() => { before(() => {
cy.clearLocalStorageSnapshot();
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
cy.saveLocalStorage('localstorage');
});
beforeEach(() => {
cy.log('Restoring local storage snapshot');
cy.restoreLocalStorage('localstorage');
cy.clickOnLogo();
interceptURL('GET', '/api/v1/users*', 'settingsPage');
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
verifyResponseStatusCode('@settingsPage', 200);
cy.get('[data-testid="settings-left-panel"]').should('be.visible');
}); });
it('Add Integer custom property for all Entities', () => {
Object.values(ENTITIES).forEach((entity) => { Object.values(ENTITIES).forEach((entity) => {
it(`Add Integer custom property for ${entity.name} Entities`, () => {
interceptURL( interceptURL(
'GET', 'GET',
`/api/v1/metadata/types/name/${entity.name}*`, `/api/v1/metadata/types/name/${entity.name}*`,
@ -41,7 +50,8 @@ describe('Custom Properties should work properly', () => {
const propertyName = addCustomPropertiesForEntity( const propertyName = addCustomPropertiesForEntity(
entity, entity,
'integer', 'integer',
entity.integerValue entity.integerValue,
entity.entityObj
); );
//Navigating back to custom properties page //Navigating back to custom properties page
cy.get('[data-testid="appbar-item-settings"]') cy.get('[data-testid="appbar-item-settings"]')
@ -60,8 +70,8 @@ describe('Custom Properties should work properly', () => {
}); });
}); });
it('Add String custom property for all Entities', () => {
Object.values(ENTITIES).forEach((entity) => { Object.values(ENTITIES).forEach((entity) => {
it(`Add String custom property for ${entity.name} Entities`, () => {
interceptURL( interceptURL(
'GET', 'GET',
`/api/v1/metadata/types/name/${entity.name}*`, `/api/v1/metadata/types/name/${entity.name}*`,
@ -79,7 +89,8 @@ describe('Custom Properties should work properly', () => {
const propertyName = addCustomPropertiesForEntity( const propertyName = addCustomPropertiesForEntity(
entity, entity,
'string', 'string',
entity.stringValue entity.stringValue,
entity.entityObj
); );
//Navigating back to custom properties page //Navigating back to custom properties page
@ -100,8 +111,8 @@ describe('Custom Properties should work properly', () => {
}); });
}); });
it('Add Markdown custom property for all Entities', () => {
Object.values(ENTITIES).forEach((entity) => { Object.values(ENTITIES).forEach((entity) => {
it(`Add Markdown custom property for ${entity.name} Entities`, () => {
interceptURL( interceptURL(
'GET', 'GET',
`/api/v1/metadata/types/name/${entity.name}*`, `/api/v1/metadata/types/name/${entity.name}*`,
@ -119,7 +130,8 @@ describe('Custom Properties should work properly', () => {
const propertyName = addCustomPropertiesForEntity( const propertyName = addCustomPropertiesForEntity(
entity, entity,
'markdown', 'markdown',
entity.markdownValue entity.markdownValue,
entity.entityObj
); );
//Navigating back to custom properties page //Navigating back to custom properties page
cy.get('[data-testid="appbar-item-settings"]') cy.get('[data-testid="appbar-item-settings"]')

View File

@ -13,25 +13,19 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import { deleteCreatedService, descriptionBox, goToAddNewServicePage, handleIngestionRetry, interceptURL, login, mySqlConnectionInput, scheduleIngestion, searchEntity, testServiceCreationAndIngestion, uuid, verifyResponseStatusCode } from '../../common/common'; import { deleteCreatedService, descriptionBox, goToAddNewServicePage, handleIngestionRetry, interceptURL, login, mySqlConnectionInput, scheduleIngestion, testServiceCreationAndIngestion, uuid, verifyResponseStatusCode, visitEntityDetailsPage } from '../../common/common';
import { DELETE_TERM, LOGIN, NEW_COLUMN_TEST_CASE, NEW_TABLE_TEST_CASE, NEW_TEST_SUITE, SERVICE_TYPE, TEAM_ENTITY } from '../../constants/constants'; import { 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()}`;
const columnTestName = `${NEW_COLUMN_TEST_CASE.column}_${NEW_COLUMN_TEST_CASE.type}`; const columnTestName = `${NEW_COLUMN_TEST_CASE.column}_${NEW_COLUMN_TEST_CASE.type}`;
const goToProfilerTab = () => { const goToProfilerTab = () => {
// click on the 1st result and go to entity details page and follow the entity visitEntityDetailsPage(
interceptURL( TEAM_ENTITY,
'GET', serviceName,
'/api/v1/tables/name/*?fields=columns,usageSummary,followers,joins,tags,owner,dataModel,profile,tests,tableConstraints,extension&include=all', MYDATA_SUMMARY_OPTIONS.tables
'getEntityDetails'
); );
cy.get('[data-testid="table-link"]')
.first()
.contains(TEAM_ENTITY, { matchCase: false })
.click();
verifyResponseStatusCode('@getEntityDetails', 200);
cy.get('[data-testid="Profiler & Data Quality"]') cy.get('[data-testid="Profiler & Data Quality"]')
.should('be.visible') .should('be.visible')
@ -62,7 +56,6 @@ describe('Data Quality and Profiler should work properly', () => {
it('Add Profiler ingestion', () => { it('Add Profiler ingestion', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="no-profiler-placeholder"]').should('be.visible'); cy.get('[data-testid="no-profiler-placeholder"]').should('be.visible');
@ -107,17 +100,18 @@ describe('Data Quality and Profiler should work properly', () => {
.click(); .click();
handleIngestionRetry('database', true, 0, 'profiler'); handleIngestionRetry('database', true, 0, 'profiler');
});
// check if profiler is ingested properly it('Check if profiler is ingested properly or not', () => {
searchEntity(TEAM_ENTITY, false); login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="no-profiler-placeholder"]').should('not.exist'); cy.get('[data-testid="no-profiler-placeholder"]').should('not.exist');
}); })
it('Add table test case with new test suite', () => { it('Add table test case with new test suite', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="profiler-add-table-test-btn"]') cy.get('[data-testid="profiler-add-table-test-btn"]')
@ -182,7 +176,6 @@ describe('Data Quality and Profiler should work properly', () => {
const testName = `${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`; const testName = `${TEAM_ENTITY}_${NEW_TABLE_TEST_CASE.type}`;
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="profiler-switch"] > :nth-child(2)') cy.get('[data-testid="profiler-switch"] > :nth-child(2)')
@ -213,7 +206,6 @@ describe('Data Quality and Profiler should work properly', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="profiler-switch"] > :nth-child(2)') cy.get('[data-testid="profiler-switch"] > :nth-child(2)')
@ -249,7 +241,6 @@ describe('Data Quality and Profiler should work properly', () => {
it('Add Column test case should work properly', () => { it('Add Column test case should work properly', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
goToProfilerTab(); goToProfilerTab();
cy.get('[data-testid="add-test-id"]') cy.get('[data-testid="add-test-id"]')
.scrollIntoView() .scrollIntoView()
@ -302,7 +293,6 @@ describe('Data Quality and Profiler should work properly', () => {
it('Edit column test case should work properly', () => { it('Edit column test case should work properly', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
interceptURL('GET', '/api/v1/testCase?*', 'testCase'); interceptURL('GET', '/api/v1/testCase?*', 'testCase');
goToProfilerTab(); goToProfilerTab();
verifyResponseStatusCode('@testCase', 200); verifyResponseStatusCode('@testCase', 200);
@ -330,7 +320,6 @@ describe('Data Quality and Profiler should work properly', () => {
it('Delete Column Test Case should work properly', () => { it('Delete Column Test Case should work properly', () => {
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
searchEntity(TEAM_ENTITY);
interceptURL('GET', '/api/v1/testCase?*', 'testCase'); interceptURL('GET', '/api/v1/testCase?*', 'testCase');
goToProfilerTab(); goToProfilerTab();
verifyResponseStatusCode('@testCase', 200); verifyResponseStatusCode('@testCase', 200);

View File

@ -103,7 +103,7 @@ describe('Tags page should work', () => {
}); });
it('Use newly created tag to any entity should work', () => { it('Use newly created tag to any entity should work', () => {
const entity = SEARCH_ENTITY_TABLE.table_2.term; const entity = SEARCH_ENTITY_TABLE.table_2;
addNewTagToEntity(entity, `${NEW_TAG_CATEGORY.name}.${NEW_TAG.name}`); addNewTagToEntity(entity, `${NEW_TAG_CATEGORY.name}.${NEW_TAG.name}`);
}); });

View File

@ -28,19 +28,24 @@ const TEAM_DETAILS = {
}; };
describe('Teams flow should work properly', () => { describe('Teams flow should work properly', () => {
beforeEach(() => { before(() => {
cy.clearLocalStorageSnapshot();
login(LOGIN.username, LOGIN.password); login(LOGIN.username, LOGIN.password);
cy.goToHomePage(); cy.goToHomePage();
cy.saveLocalStorage('localstorage');
});
beforeEach(() => {
cy.log('Restoring local storage snapshot');
cy.restoreLocalStorage('localstorage');
cy.clickOnLogo();
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click(); cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
interceptURL('GET', '/api/v1/users*', 'getTeams');
//Clicking on teams //Clicking on teams
cy.get('[data-menu-id*="teams"]') cy.get('[data-menu-id*="teams"]')
.should('exist') .should('exist')
.should('be.visible') .should('be.visible')
.click(); .click();
verifyResponseStatusCode('@getTeams', 200);
}); });
it('Add new team', () => { it('Add new team', () => {
@ -431,23 +436,6 @@ describe('Teams flow should work properly', () => {
.should('exist') .should('exist')
.should('be.disabled'); .should('be.disabled');
cy.get('[data-testid="discard-button"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="manage-button"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-menu-id*="delete-button"]').should('be.visible');
cy.get('[data-testid="delete-button-title"]')
.should('exist')
.should('be.visible')
.click();
//Check if soft delete option is present //Check if soft delete option is present
cy.get('[data-testid="soft-delete-option"]') cy.get('[data-testid="soft-delete-option"]')
.should('contain', TEAM_DETAILS.name) .should('contain', TEAM_DETAILS.name)