Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cypress: fixed cypress AUT failure of main #14042

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1186,13 +1186,13 @@ export const addOwner = (
isGlossaryPage,
isOwnerEmpty = false
) => {
interceptURL('GET', '/api/v1/users?limit=*&isBot=false', 'getUsers');
if (isGlossaryPage && isOwnerEmpty) {
cy.get('[data-testid="glossary-owner-name"] > [data-testid="Add"]').click();
} else {
cy.get('[data-testid="edit-owner"]').click();
}

interceptURL('GET', '/api/v1/users?limit=25&isBot=false', 'getUsers');
cy.get('.ant-tabs [id*=tab-users]').click();
verifyResponseStatusCode('@getUsers', 200);

Expand Down Expand Up @@ -1265,15 +1265,13 @@ export const deleteEntity = (
entityName,
serviceName,
entity,
entityType,
successMessageEntityName,
deletionType = 'hard'
) => {
visitEntityDetailsPage({
term: entityName,
serviceName,
entity,
entityType,
});

cy.get('[data-testid="manage-button"]').click();
Expand Down Expand Up @@ -1417,7 +1415,7 @@ export const signupAndLogin = (email, password, firstName, lastName) => {

// Login with the created user
login(email, password);
cy.goToHomePage(true);
// cy.goToHomePage(true);
cy.url().should('eq', `${BASE_URL}/my-data`);

// Verify user profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,47 @@ export const createQueryByTableName = (token, table) => {
});
});
};

/**
* Create a new user
*/
export const createUserEntity = ({ token, user }) => {
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: user,
}).then((response) => {
user.id = response.body.id;
});
};

/**
* Delete a user by id
*/
export const deleteUserEntity = ({ token, id }) => {
cy.request({
method: 'DELETE',
url: `/api/v1/users/${id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
};

/**
* Delete any entity by id
*/
export const deleteEntityById = ({ entityType, token, entityFqn }) => {
cy.request({
method: 'GET',
url: `/api/v1/${entityType}/name/${entityFqn}`,
headers: { Authorization: `Bearer ${token}` },
}).then((response) => {
cy.request({
method: 'DELETE',
url: `/api/v1/${entityType}/${response.body.id}?hardDelete=true&recursive=true`,
headers: { Authorization: `Bearer ${token}` },
}).then((response) => {
expect(response.status).to.eq(200);
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { uuid } from './constants';
import { MYDATA_SUMMARY_OPTIONS, uuid } from './constants';
import { SERVICE_CATEGORIES } from './service.constants';

const DATABASE_SERVICE_NAME = `cy-database-service-${uuid()}`;
Expand Down Expand Up @@ -267,23 +267,44 @@ export const DASHBOARD_DETAILS = {
displayName: DASHBOARD_NAME,
service: DASHBOARD_SERVICE_DETAILS.name,
};
export const DASHBOARD_CHART_DETAILS = {
name: 'dashboard-chart',
displayName: 'dashboard-chart',
service: DASHBOARD_SERVICE_DETAILS.name,
};
export const DASHBOARD_DATA_MODEL_DETAILS = {
name: DASHBOARD_DATA_MODEL_NAME,
displayName: DASHBOARD_DATA_MODEL_NAME,
service: DASHBOARD_SERVICE_DETAILS.name,
columns: [],
columns: [
{
name: 'country_name',
dataType: 'VARCHAR',
dataLength: 256,
dataTypeDisplay: 'varchar',
description: 'Name of the country.',
},
],
dataModelType: 'SupersetDataModel',
};

export const PIPELINE_DETAILS = {
name: `cypress-pipeline-${uuid()}`,
service: PIPELINE_SERVICE_DETAILS.name,
tasks: [{ name: 'snowflake_task' }],
};

export const ML_MODEL_DETAILS = {
name: `cypress-mlmodel-${uuid()}`,
service: ML_MODEL_SERVICE_DETAILS.name,
algorithm: 'Time Series',
mlFeatures: [
{
name: 'sales',
dataType: 'numerical',
description: 'Sales amount',
},
],
};

export const CONTAINER_DETAILS = {
Expand Down Expand Up @@ -342,3 +363,63 @@ export const SINGLE_LEVEL_SERVICE = [
MLMODEL_SERVICE,
STORAGE_SERVICE,
];

// visit entity details page object
export const VISIT_ENTITIES_DATA = {
table: {
term: DATABASE_SERVICE.tables.name,
displayName: DATABASE_SERVICE.tables.name,
entity: MYDATA_SUMMARY_OPTIONS.tables,
serviceName: DATABASE_SERVICE.service.name,
schemaName: DATABASE_SERVICE.schema.name,
entityType: 'Table',
},
topic: {
term: MESSAGING_SERVICE.entity.name,
displayName: MESSAGING_SERVICE.entity.name,
entity: MYDATA_SUMMARY_OPTIONS.topics,
serviceName: MESSAGING_SERVICE.service.name,
entityType: 'Topic',
},
dashboard: {
term: DASHBOARD_SERVICE.entity.name,
displayName: DASHBOARD_SERVICE.entity.name,
entity: MYDATA_SUMMARY_OPTIONS.dashboards,
serviceName: DASHBOARD_SERVICE.service.name,
entityType: 'Dashboard',
},
pipeline: {
term: PIPELINE_SERVICE.entity.name,
displayName: PIPELINE_SERVICE.entity.name,
entity: MYDATA_SUMMARY_OPTIONS.pipelines,
serviceName: PIPELINE_SERVICE.service.name,
entityType: 'Pipeline',
},
mlmodel: {
term: MLMODEL_SERVICE.entity.name,
displayName: MLMODEL_SERVICE.entity.name,
entity: MYDATA_SUMMARY_OPTIONS.mlmodels,
serviceName: MLMODEL_SERVICE.service.name,
entityType: 'ML Model',
},
storedProcedure: {
term: STORED_PROCEDURE_DETAILS.name,
displayName: STORED_PROCEDURE_DETAILS.name,
entity: MYDATA_SUMMARY_OPTIONS.storedProcedures,
serviceName: DATABASE_SERVICE_DETAILS.name,
entityType: 'Stored Procedure',
},
dataModel: {
term: DASHBOARD_DATA_MODEL_DETAILS.name,
entity: MYDATA_SUMMARY_OPTIONS.dataModel,
serviceName: DASHBOARD_DATA_MODEL_DETAILS.service,
displayName: DASHBOARD_DATA_MODEL_DETAILS.name,
entityType: 'Data Model',
},
container: {
term: STORAGE_SERVICE.entity.name,
displayName: STORAGE_SERVICE.entity.name,
entity: 'containers',
serviceName: STORAGE_SERVICE.service.name,
},
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { generateRandomTable } from '../common/entityUtils';
import { DATABASE_SERVICE, VISIT_ENTITIES_DATA } from './entityConstant';

/*
* Copyright 2023 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,74 +14,55 @@
* limitations under the License.
*/

export const TAGS_ADD_REMOVE_TABLE = generateRandomTable();

export const TAGS_ADD_REMOVE_ENTITIES = [
{
term: 'marketing',
displayName: 'marketing',
term: TAGS_ADD_REMOVE_TABLE.name,
displayName: TAGS_ADD_REMOVE_TABLE.name,
entity: 'tables',
serviceName: 'sample_data',
fieldName: 'SKU',
serviceName: DATABASE_SERVICE.service.name,
fieldName: TAGS_ADD_REMOVE_TABLE.columns[0].name,
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'address_book',
displayName: 'address_book',
entity: 'topics',
serviceName: 'sample_kafka',
fieldName: 'AddressBook',
...VISIT_ENTITIES_DATA.topic,
fieldName: 'first_name',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'deck.gl Demo',
displayName: 'deck.gl Demo',
entity: 'dashboards',
...VISIT_ENTITIES_DATA.dashboard,
insideEntity: 'charts',
serviceName: 'sample_superset',
fieldName: 'e3cfd274-44f8-4bf3-b75d-d40cf88869ba',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'dim_address_etl',
displayName: 'dim_address etl',
entity: 'pipelines',
serviceName: 'sample_airflow',
fieldName: 'dim_address_task',
...VISIT_ENTITIES_DATA.pipeline,
fieldName: 'snowflake_task',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'eta_predictions',
displayName: 'ETA Predictions',
entity: 'mlmodels',
serviceName: 'mlflow_svc',
...VISIT_ENTITIES_DATA.mlmodel,
fieldName: 'sales',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'engineering',
displayName: 'Engineering department',
entity: 'containers',
serviceName: 's3_storage_sample',
...VISIT_ENTITIES_DATA.container,
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'update_orders_table',
displayName: 'update_orders_table',
entity: 'storedProcedures',
serviceName: 'sample_data',
...VISIT_ENTITIES_DATA.storedProcedure,
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'orders_view',
displayName: 'orders_view',
entity: 'dashboardDataModel',
serviceName: 'sample_looker',
...VISIT_ENTITIES_DATA.dataModel,
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
Expand Down

This file was deleted.

Loading
Loading