e2e: add e2e for service requirement doc panel (#11367)

* e2e: add e2e for service requirement doc panel

* fix: bigquery field name
This commit is contained in:
Sachin Chaurasiya 2023-05-02 08:28:04 +05:30 committed by GitHub
parent fd243dc5cb
commit 1546e78dbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 132 additions and 48 deletions

View File

@ -27,6 +27,14 @@ const TEAM_TYPES = ['BusinessUnit', 'Department', 'Division', 'Group'];
const isDatabaseService = (type) => type === 'database';
export const checkServiceFieldSectionHighlighting = (field) => {
cy.get(`[data-id="${field}"]`).should(
'have.attr',
'data-highlighted',
'true'
);
};
const checkTeamTypeOptions = () => {
for (const teamType of TEAM_TYPES) {
cy.get(`.ant-select-dropdown [title="${teamType}"]`)
@ -41,8 +49,21 @@ export const interceptURL = (method, url, alias, callback) => {
};
// waiting for response and validating the response status code
export const verifyResponseStatusCode = (alias, responseCode, option) => {
cy.wait(alias, option).its('response.statusCode').should('eq', responseCode);
export const verifyResponseStatusCode = (
alias,
responseCode,
option,
hasMultipleResponseCode = false
) => {
if (hasMultipleResponseCode) {
cy.wait(alias, option)
.its('response.statusCode')
.should('be.oneOf', responseCode);
} else {
cy.wait(alias, option)
.its('response.statusCode')
.should('eq', responseCode);
}
};
// waiting for multiple response and validating the response status code
@ -180,14 +201,15 @@ export const scheduleIngestion = () => {
// Storing the created service name and the type of service for later use
export const testServiceCreationAndIngestion = (
export const testServiceCreationAndIngestion = ({
serviceType,
connectionInput,
addIngestionInput,
serviceName,
type = 'database',
testIngestionButton = true
) => {
testIngestionButton = true,
serviceCategory,
}) => {
// Storing the created service name and the type of service
// Select Service in step 1
cy.get(`[data-testid="${serviceType}"]`).should('exist').click();
@ -201,6 +223,12 @@ export const testServiceCreationAndIngestion = (
'api/v1/services/ingestionPipelines/*',
'ingestionPipelineStatus'
);
// intercept the service requirement md file fetch request
interceptURL(
'GET',
`en-US/${serviceCategory}/${serviceType}.md`,
'getServiceRequirements'
);
cy.get('[data-testid="next-button"]').should('exist').click();
verifyResponseStatusCode('@ingestionPipelineStatus', 200);
verifyResponseStatusCode('@ipApi', 204);
@ -214,6 +242,10 @@ export const testServiceCreationAndIngestion = (
});
cy.contains('Connection Details').scrollIntoView().should('be.visible');
// Requirement panel should be visible and fetch the requirements md file
cy.get('[data-testid="service-requirements"]').should('be.visible');
verifyResponseStatusCode('@getServiceRequirements', [200, 304], {}, true);
connectionInput();
// Test the connection
@ -909,9 +941,13 @@ export const updateOwner = () => {
export const mySqlConnectionInput = () => {
cy.get('#root\\/username').type(Cypress.env('mysqlUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password').type(Cypress.env('mysqlPassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/hostPort').type(Cypress.env('mysqlHostPort'));
checkServiceFieldSectionHighlighting('hostPort');
cy.get('#root\\/databaseSchema').type(Cypress.env('mysqlDatabaseSchema'));
checkServiceFieldSectionHighlighting('databaseSchema');
};
export const login = (username, password) => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -39,19 +40,25 @@ describe('BigQuery Ingestion', () => {
cy.get('.form-group > #root\\/type')
.scrollIntoView()
.type('service_account');
checkServiceFieldSectionHighlighting('type');
cy.get('#root\\/projectId')
.scrollIntoView()
.type(Cypress.env('bigqueryProjectId'));
checkServiceFieldSectionHighlighting('projectId');
cy.get('#root\\/privateKeyId')
.scrollIntoView()
.type(Cypress.env('bigqueryPrivateKeyId'));
checkServiceFieldSectionHighlighting('privateKeyId');
cy.get('#root\\/privateKey')
.scrollIntoView()
.type(Cypress.env('bigqueryPrivateKey'));
checkServiceFieldSectionHighlighting('privateKey');
cy.get('#root\\/clientEmail').scrollIntoView().type(clientEmail);
checkServiceFieldSectionHighlighting('clientEmail');
cy.get('#root\\/clientId')
.scrollIntoView()
.type(Cypress.env('bigqueryClientId'));
checkServiceFieldSectionHighlighting('clientId');
cy.get('#root\\/clientX509CertUrl')
.scrollIntoView()
.type(
@ -59,12 +66,15 @@ describe('BigQuery Ingestion', () => {
clientEmail
)}`
);
checkServiceFieldSectionHighlighting('clientX509CertUrl');
cy.get('[data-testid="add-item-Taxonomy Project IDs"]')
.scrollIntoView()
.click();
checkServiceFieldSectionHighlighting('taxonomyProjectID');
cy.get('#root\\/taxonomyProjectID_0')
.scrollIntoView()
.type(Cypress.env('bigqueryProjectIdTaxonomy'));
checkServiceFieldSectionHighlighting('taxonomyProjectID');
};
const addIngestionInput = () => {
@ -78,12 +88,13 @@ describe('BigQuery Ingestion', () => {
.type(filterPattern);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName
);
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -38,15 +39,19 @@ describe('Glue Ingestion', () => {
cy.get('#root\\/awsConfig\\/awsAccessKeyId')
.scrollIntoView()
.type(Cypress.env('glueAwsAccessKeyId'));
checkServiceFieldSectionHighlighting('awsAccessKeyId');
cy.get('#root\\/awsConfig\\/awsSecretAccessKey')
.scrollIntoView()
.type(Cypress.env('glueAwsSecretAccessKey'));
checkServiceFieldSectionHighlighting('awsSecretAccessKey');
cy.get('#root\\/awsConfig\\/awsRegion')
.scrollIntoView()
.type(Cypress.env('glueAwsRegion'));
checkServiceFieldSectionHighlighting('awsRegion');
cy.get('#root\\/awsConfig\\/endPointURL')
.scrollIntoView()
.type(Cypress.env('glueEndPointURL'));
checkServiceFieldSectionHighlighting('endPointURL');
};
const addIngestionInput = () => {
@ -60,14 +65,14 @@ describe('Glue Ingestion', () => {
.type(filterPattern);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName,
'database',
false
);
testIngestionButton: false,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -44,9 +45,11 @@ describe('Kafka Ingestion', () => {
cy.get('#root\\/bootstrapServers').type(
Cypress.env('kafkaBootstrapServers')
);
checkServiceFieldSectionHighlighting('bootstrapServers');
cy.get('#root\\/schemaRegistryURL').type(
Cypress.env('kafkaSchemaRegistryUrl')
);
checkServiceFieldSectionHighlighting('schemaRegistryURL');
};
const addIngestionInput = () => {
@ -59,13 +62,14 @@ describe('Kafka Ingestion', () => {
.type(topicName);
};
testServiceCreationAndIngestion(
'Kafka',
testServiceCreationAndIngestion({
serviceType: 'Kafka',
connectionInput,
addIngestionInput,
serviceName,
'messaging'
);
type: 'messaging',
serviceCategory: SERVICE_TYPE.Messaging,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -44,12 +45,15 @@ describe('Metabase Ingestion', () => {
cy.get('#root\\/username')
.scrollIntoView()
.type(Cypress.env('metabaseUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password')
.scrollIntoView()
.type(Cypress.env('metabasePassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/hostPort')
.scrollIntoView()
.type(Cypress.env('metabaseHostPort'));
checkServiceFieldSectionHighlighting('hostPort');
};
const addIngestionInput = () => {
@ -64,13 +68,14 @@ describe('Metabase Ingestion', () => {
.type(tableName);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName,
'dashboard'
);
type: 'dashboard',
serviceCategory: SERVICE_TYPE.Dashboard,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -51,12 +51,13 @@ describe('MySQL Ingestion', () => {
.type(Cypress.env('mysqlDatabaseSchema'));
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
mySqlConnectionInput,
connectionInput: mySqlConnectionInput,
addIngestionInput,
serviceName
);
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -51,15 +52,19 @@ describe('Postgres Ingestion', () => {
cy.get('#root\\/username')
.scrollIntoView()
.type(Cypress.env('postgresUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password')
.scrollIntoView()
.type(Cypress.env('postgresPassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/hostPort')
.scrollIntoView()
.type(Cypress.env('postgresHostPort'));
checkServiceFieldSectionHighlighting('hostPort');
cy.get('#root\\/database')
.scrollIntoView()
.type(Cypress.env('postgresDatabase'));
checkServiceFieldSectionHighlighting('database');
};
const addIngestionInput = () => {
@ -73,12 +78,13 @@ describe('Postgres Ingestion', () => {
.type(filterPattern);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName
);
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -40,15 +41,19 @@ describe('RedShift Ingestion', () => {
goToAddNewServicePage(SERVICE_TYPE.Database);
const connectionInput = () => {
cy.get('#root\\/username').type(Cypress.env('redshiftUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password')
.scrollIntoView()
.type(Cypress.env('redshiftPassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/hostPort')
.scrollIntoView()
.type(Cypress.env('redshiftHost'));
checkServiceFieldSectionHighlighting('hostPort');
cy.get('#root\\/database')
.scrollIntoView()
.type(Cypress.env('redshiftDatabase'));
checkServiceFieldSectionHighlighting('database');
};
const addIngestionInput = () => {
@ -66,14 +71,15 @@ describe('RedShift Ingestion', () => {
.click();
};
testServiceCreationAndIngestion(
REDSHIFT.serviceType,
testServiceCreationAndIngestion({
serviceType: REDSHIFT.serviceType,
connectionInput,
addIngestionInput,
REDSHIFT.serviceName,
'database',
true
);
serviceName: REDSHIFT.serviceName,
type: 'database',
testIngestionButton: true,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -12,6 +12,7 @@
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
@ -36,10 +37,15 @@ describe('Snowflake Ingestion', () => {
goToAddNewServicePage(SERVICE_TYPE.Database);
const connectionInput = () => {
cy.get('#root\\/username').type(Cypress.env('snowflakeUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password').type(Cypress.env('snowflakePassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/account').type(Cypress.env('snowflakeAccount'));
checkServiceFieldSectionHighlighting('account');
cy.get('#root\\/database').type(Cypress.env('snowflakeDatabase'));
checkServiceFieldSectionHighlighting('database');
cy.get('#root\\/warehouse').type(Cypress.env('snowflakeWarehouse'));
checkServiceFieldSectionHighlighting('warehouse');
};
const addIngestionInput = () => {
@ -53,12 +59,13 @@ describe('Snowflake Ingestion', () => {
.type(schema);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName
);
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -66,13 +66,14 @@ describe('Superset Ingestion', () => {
.type(tableName);
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName,
'dashboard'
);
type: 'dashboard',
serviceCategory: SERVICE_TYPE.Dashboard,
});
});
it('Update table description and verify description after re-run', () => {

View File

@ -33,7 +33,7 @@ import {
testServiceCreationAndIngestion,
verifyResponseStatusCode,
} from '../../common/common';
import { API_SERVICE } from '../../constants/constants';
import { API_SERVICE, SERVICE_TYPE } from '../../constants/constants';
import { MYSQL } from '../../constants/service.constants';
const service_name = MYSQL.serviceName;
@ -85,12 +85,13 @@ describe.skip('pre-requests for test case', () => {
.type(Cypress.env('mysqlDatabaseSchema'));
};
testServiceCreationAndIngestion(
MYSQL.serviceType,
mySqlConnectionInput,
testServiceCreationAndIngestion({
serviceType: MYSQL.serviceType,
connectionInput: mySqlConnectionInput,
addIngestionInput,
service_name
);
serviceName: service_name,
serviceCategory: SERVICE_TYPE.Database,
});
});
});

View File

@ -79,12 +79,13 @@ describe('Data Quality and Profiler should work properly', () => {
.type(Cypress.env('mysqlDatabaseSchema'));
};
testServiceCreationAndIngestion(
testServiceCreationAndIngestion({
serviceType,
mySqlConnectionInput,
connectionInput: mySqlConnectionInput,
addIngestionInput,
serviceName
);
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Add Profiler ingestion', () => {