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'; const isDatabaseService = (type) => type === 'database';
export const checkServiceFieldSectionHighlighting = (field) => {
cy.get(`[data-id="${field}"]`).should(
'have.attr',
'data-highlighted',
'true'
);
};
const checkTeamTypeOptions = () => { const checkTeamTypeOptions = () => {
for (const teamType of TEAM_TYPES) { for (const teamType of TEAM_TYPES) {
cy.get(`.ant-select-dropdown [title="${teamType}"]`) 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 // waiting for response and validating the response status code
export const verifyResponseStatusCode = (alias, responseCode, option) => { export const verifyResponseStatusCode = (
cy.wait(alias, option).its('response.statusCode').should('eq', responseCode); 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 // 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 // Storing the created service name and the type of service for later use
export const testServiceCreationAndIngestion = ( export const testServiceCreationAndIngestion = ({
serviceType, serviceType,
connectionInput, connectionInput,
addIngestionInput, addIngestionInput,
serviceName, serviceName,
type = 'database', type = 'database',
testIngestionButton = true testIngestionButton = true,
) => { serviceCategory,
}) => {
// Storing the created service name and the type of service // Storing the created service name and the type of service
// Select Service in step 1 // Select Service in step 1
cy.get(`[data-testid="${serviceType}"]`).should('exist').click(); cy.get(`[data-testid="${serviceType}"]`).should('exist').click();
@ -201,6 +223,12 @@ export const testServiceCreationAndIngestion = (
'api/v1/services/ingestionPipelines/*', 'api/v1/services/ingestionPipelines/*',
'ingestionPipelineStatus' '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(); cy.get('[data-testid="next-button"]').should('exist').click();
verifyResponseStatusCode('@ingestionPipelineStatus', 200); verifyResponseStatusCode('@ingestionPipelineStatus', 200);
verifyResponseStatusCode('@ipApi', 204); verifyResponseStatusCode('@ipApi', 204);
@ -214,6 +242,10 @@ export const testServiceCreationAndIngestion = (
}); });
cy.contains('Connection Details').scrollIntoView().should('be.visible'); 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(); connectionInput();
// Test the connection // Test the connection
@ -909,9 +941,13 @@ export const updateOwner = () => {
export const mySqlConnectionInput = () => { export const mySqlConnectionInput = () => {
cy.get('#root\\/username').type(Cypress.env('mysqlUsername')); cy.get('#root\\/username').type(Cypress.env('mysqlUsername'));
checkServiceFieldSectionHighlighting('username');
cy.get('#root\\/password').type(Cypress.env('mysqlPassword')); cy.get('#root\\/password').type(Cypress.env('mysqlPassword'));
checkServiceFieldSectionHighlighting('password');
cy.get('#root\\/hostPort').type(Cypress.env('mysqlHostPort')); cy.get('#root\\/hostPort').type(Cypress.env('mysqlHostPort'));
checkServiceFieldSectionHighlighting('hostPort');
cy.get('#root\\/databaseSchema').type(Cypress.env('mysqlDatabaseSchema')); cy.get('#root\\/databaseSchema').type(Cypress.env('mysqlDatabaseSchema'));
checkServiceFieldSectionHighlighting('databaseSchema');
}; };
export const login = (username, password) => { export const login = (username, password) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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