test(ui): cypress tests added for re-run (#7713)

This commit is contained in:
Chirag Madlani 2022-09-27 18:55:58 +05:30 committed by GitHub
parent d3cd3f2b19
commit 95287ab71c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 224 additions and 9 deletions

View File

@ -334,7 +334,6 @@ export const editOwnerforCreatedService = (service_type, service_Name) => {
export const goToAddNewServicePage = (service_type) => {
cy.get('[data-testid="tables"]').should('be.visible');
//Click on settings page
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
@ -862,3 +861,122 @@ export const addTeam = (TEAM_DETAILS) => {
verifyResponseStatusCode('@saveTeam', 201);
verifyResponseStatusCode('@createTeam', 200);
};
export const retryIngestionRun = () => {
const retryTimes = 10;
let retryCount = 0;
const testIngestionsTab = () => {
cy.get('[data-testid="Ingestions"]').should('be.visible');
cy.get('[data-testid="Ingestions"] >> [data-testid="filter-count"]').should(
'have.text',
'1'
);
if (retryCount === 0) {
cy.wait(1000);
cy.get('[data-testid="Ingestions"]').should('be.visible');
}
};
const checkSuccessState = () => {
testIngestionsTab();
retryCount++;
// the latest run should be success
cy.get('[aria-describedby*="tippy-tooltip"] > .tw-h-5').then(
($ingestionStatus) => {
if (
($ingestionStatus.text() === 'Running' ||
$ingestionStatus.text() === 'Queued') &&
retryCount <= retryTimes
) {
// retry after waiting for 20 seconds
cy.wait(20000);
cy.reload();
checkSuccessState();
} else {
cy.get('[aria-describedby*="tippy-tooltip"] > .tw-h-5').should(
'have.text',
'Success'
);
}
}
);
};
checkSuccessState();
};
export const updateDescriptionForIngestedTables = (
serviceName,
tableName,
description,
type,
entity
) => {
//Navigate to ingested table
//Search entity
searchEntity(tableName);
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
cy.get(`[data-testid="${entity}-tab"]`)
.should('be.visible')
.should('have.class', 'active');
interceptURL('GET', `/api/v1/permissions/*/*`, 'getEntityDetails');
cy.get('[data-testid="table-link"]').first().click();
verifyResponseStatusCode('@getEntityDetails', 200);
//update description
cy.get('[data-testid="edit-description"]')
.should('be.visible')
.click({ force: true });
cy.get(descriptionBox).should('be.visible').clear().type(description);
interceptURL('PATCH', '/api/v1/*/*', 'updateEntity');
cy.get('[data-testid="save"]').click();
verifyResponseStatusCode('@updateEntity', 200);
//re-run ingestion flow
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
// Services page
cy.get('.ant-menu-title-content').contains(type).should('be.visible').click();
interceptURL(
'GET',
`/api/v1/services/*/name/${serviceName}*`,
'getSelectedService'
);
//click on created service
cy.get(`[data-testid="service-name-${serviceName}"]`)
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@getSelectedService', 200);
cy.get('[data-testid="Ingestions"]').should('be.visible').click();
interceptURL(
'POST',
'/api/v1/services/ingestionPipelines/trigger/*',
'checkRun'
);
cy.get('[data-testid="run"]').should('be.visible').click();
verifyResponseStatusCode('@checkRun', 200);
//Wait for success
retryIngestionRun();
//Navigate to table name
searchEntity(tableName);
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
cy.get(`[data-testid="${entity}-tab"]`)
.should('be.visible')
.should('have.class', 'active');
cy.get('[data-testid="table-link"]').first().click();
verifyResponseStatusCode('@getEntityDetails', 200);
cy.get('[data-testid="description"] > [data-testid="viewer-container"] ')
.first()
.invoke('text')
.should('eq', description);
};

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'BigQuery';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'augcustomers';
const description = `This is ${serviceName} description`;
describe('BigQuery Ingestion', () => {
beforeEach(() => {
@ -73,6 +75,16 @@ describe('BigQuery Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Database, serviceName);
});

View File

@ -11,17 +11,20 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Glue';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'cloudfront_logs2';
const description = `This is ${serviceName} description`;
describe('Glue Ingestion', () => {
beforeEach(() => {
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
});
it('add and ingest data', () => {
goToAddNewServicePage(SERVICE_TYPE.Database);
const connectionInput = () => {
@ -56,6 +59,16 @@ describe('Glue Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Database, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Kafka';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = '__consumer_offsets';
const description = `This is ${serviceName} description`;
describe('Kafka Ingestion', () => {
beforeEach(() => {
@ -55,6 +57,16 @@ describe('Kafka Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Messaging,
'topics'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Messaging, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Metabase';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'Customers Dashboard';
const description = `This is ${serviceName} description`;
describe('Metabase Ingestion', () => {
beforeEach(() => {
@ -51,6 +53,16 @@ describe('Metabase Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Dashboard,
'dashboards'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Dashboard, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, mySqlConnectionInput, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, mySqlConnectionInput, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Mysql';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'DATABASE_CHANGE_LOG';
const description = `This is ${tableName} description`;
describe('MySQL Ingestion', () => {
beforeEach(() => {
@ -40,6 +42,16 @@ describe('MySQL Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Database, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Redshift';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'boolean_test';
const description = `This is ${serviceName} description`;
describe('RedShift Ingestion', () => {
beforeEach(() => {
@ -53,6 +55,16 @@ describe('RedShift Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Database, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Snowflake';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'TEST_TABLE';
const description = `This is ${serviceName} description`;
describe('Snowflake Ingestion', () => {
beforeEach(() => {
@ -47,6 +49,16 @@ describe('Snowflake Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Database, serviceName);
});

View File

@ -11,11 +11,13 @@
* limitations under the License.
*/
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, uuid } from '../../common/common';
import { deleteCreatedService, editOwnerforCreatedService, goToAddNewServicePage, login, testServiceCreationAndIngestion, updateDescriptionForIngestedTables, uuid } from '../../common/common';
import { LOGIN, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Superset';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'NEW DASHBOARD';
const description = `This is ${serviceName} description`;
describe('Superset Ingestion', () => {
beforeEach(() => {
@ -53,6 +55,16 @@ describe('Superset Ingestion', () => {
);
});
it('Update table description and verify', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Dashboard,
'dashboards'
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(SERVICE_TYPE.Dashboard, serviceName);
});