244 lines
7.5 KiB
JavaScript
Raw Normal View History

/*
* Copyright 2022 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
handleIngestionRetry,
interceptURL,
scheduleIngestion,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
uuid,
verifyResponseStatusCode,
visitEntityDetailsPage,
} from '../../common/common';
import { API_SERVICE, SERVICE_TYPE } from '../../constants/constants';
const serviceType = 'Postgres';
const serviceName = `${serviceType}-ct-test-${uuid()}`;
const tableName = 'order_items';
const description = `This is ${serviceName} description`;
const filterPattern = 'sales';
const clearQuery = 'select pg_stat_statements_reset()';
const selectQuery =
'SELECT * FROM sales.order_items oi INNER JOIN sales.orders o ON oi.order_id=o.order_id';
describe('Postgres Ingestion', () => {
beforeEach(() => {
cy.login();
});
it('Trigger select query', () => {
cy.postgreSQL(clearQuery);
cy.postgreSQL(selectQuery);
});
it('add and ingest data', () => {
goToAddNewServicePage(SERVICE_TYPE.Database);
const connectionInput = () => {
chore(ui): add support for service documentation (part-1) (#10668) * chore(ui): add support for service documentation md file * sync local * chore: add method for fetching markdown file * chore(ui): add support for service documentation * chore: move fields to connections * chore: update logic to fetch requirements * chore: right panel component for service * fix: key prop is not present in the skeleton component * chore: only fetch md files when required fields are present * chore: use hook for fetching airflow status * chore: refactor add service component * chore: remove id prefix and id separator prop from form builder * fix: fieldName issue on right panel * fix: active Field name issue * fix:unit test * test: add unit test * chore: handle edit service form * chore: add fallback logic * fix: cy test * chore: update service doc md files/folder structure, * chore: push image example * Athena docs * Add glue docs * Add hive related changes * chore: take last field for fetching field doc * add datalake * Added connection information for oracle and redshift (english + french) * fix: fallback logic * Bigquery & Snowflake Requirements * mysql and amundsen requirements (#10752) * Revert removal of descriptions * Add Doc For Mssql and Postgres * Added powerbi conn md files * Align requirements files * Add Kafka and Redpanda * refined powerbi docs * Add Tableu requirements, move Athena and Glue fields, change footer some connectors * Add missing connectors fields descriptions default * re: datalake * Add Tableau field descriptions * fix: markdown styling * chore: improve button styling * chore: rename right panel to service right panel and move it to common * fix: doc for select and list field , cy test. * fix: unit test * fix: test connection service type issue * Added powerbi docs link in req * Add info on hive * Remove unused markdowns * Add req for datalake * add hive requirements header * Snowflake & Biguqery * Update Mssql and Postgres * mysql and amundsen requirements updated * Update Mssql and Postgres * added username * chore: fix cy expression issue * chore: reset active field state on step change. * fix: affix target container issue * fix: unit test * fix: cypress for postgres and glue --------- Co-authored-by: Milan Bariya <52292922+MilanBariya@users.noreply.github.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Teddy Crepineau <teddy.crepineau@gmail.com> Co-authored-by: ulixius9 <mayursingal9@gmail.com> Co-authored-by: NiharDoshi99 <51595473+NiharDoshi99@users.noreply.github.com> Co-authored-by: Milan Bariya <milanbariya12@gmail.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Nahuel Verdugo Revigliono <nahuel@getcollate.io> Co-authored-by: Nihar Doshi <nihardoshi16@gmail.com>
2023-03-29 14:18:17 +05:30
cy.get('#root\\/username')
.scrollIntoView()
.type(Cypress.env('postgresUsername'));
checkServiceFieldSectionHighlighting('username');
chore(ui): add support for service documentation (part-1) (#10668) * chore(ui): add support for service documentation md file * sync local * chore: add method for fetching markdown file * chore(ui): add support for service documentation * chore: move fields to connections * chore: update logic to fetch requirements * chore: right panel component for service * fix: key prop is not present in the skeleton component * chore: only fetch md files when required fields are present * chore: use hook for fetching airflow status * chore: refactor add service component * chore: remove id prefix and id separator prop from form builder * fix: fieldName issue on right panel * fix: active Field name issue * fix:unit test * test: add unit test * chore: handle edit service form * chore: add fallback logic * fix: cy test * chore: update service doc md files/folder structure, * chore: push image example * Athena docs * Add glue docs * Add hive related changes * chore: take last field for fetching field doc * add datalake * Added connection information for oracle and redshift (english + french) * fix: fallback logic * Bigquery & Snowflake Requirements * mysql and amundsen requirements (#10752) * Revert removal of descriptions * Add Doc For Mssql and Postgres * Added powerbi conn md files * Align requirements files * Add Kafka and Redpanda * refined powerbi docs * Add Tableu requirements, move Athena and Glue fields, change footer some connectors * Add missing connectors fields descriptions default * re: datalake * Add Tableau field descriptions * fix: markdown styling * chore: improve button styling * chore: rename right panel to service right panel and move it to common * fix: doc for select and list field , cy test. * fix: unit test * fix: test connection service type issue * Added powerbi docs link in req * Add info on hive * Remove unused markdowns * Add req for datalake * add hive requirements header * Snowflake & Biguqery * Update Mssql and Postgres * mysql and amundsen requirements updated * Update Mssql and Postgres * added username * chore: fix cy expression issue * chore: reset active field state on step change. * fix: affix target container issue * fix: unit test * fix: cypress for postgres and glue --------- Co-authored-by: Milan Bariya <52292922+MilanBariya@users.noreply.github.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Teddy Crepineau <teddy.crepineau@gmail.com> Co-authored-by: ulixius9 <mayursingal9@gmail.com> Co-authored-by: NiharDoshi99 <51595473+NiharDoshi99@users.noreply.github.com> Co-authored-by: Milan Bariya <milanbariya12@gmail.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Nahuel Verdugo Revigliono <nahuel@getcollate.io> Co-authored-by: Nihar Doshi <nihardoshi16@gmail.com>
2023-03-29 14:18:17 +05:30
cy.get('#root\\/password')
.scrollIntoView()
.type(Cypress.env('postgresPassword'));
checkServiceFieldSectionHighlighting('password');
chore(ui): add support for service documentation (part-1) (#10668) * chore(ui): add support for service documentation md file * sync local * chore: add method for fetching markdown file * chore(ui): add support for service documentation * chore: move fields to connections * chore: update logic to fetch requirements * chore: right panel component for service * fix: key prop is not present in the skeleton component * chore: only fetch md files when required fields are present * chore: use hook for fetching airflow status * chore: refactor add service component * chore: remove id prefix and id separator prop from form builder * fix: fieldName issue on right panel * fix: active Field name issue * fix:unit test * test: add unit test * chore: handle edit service form * chore: add fallback logic * fix: cy test * chore: update service doc md files/folder structure, * chore: push image example * Athena docs * Add glue docs * Add hive related changes * chore: take last field for fetching field doc * add datalake * Added connection information for oracle and redshift (english + french) * fix: fallback logic * Bigquery & Snowflake Requirements * mysql and amundsen requirements (#10752) * Revert removal of descriptions * Add Doc For Mssql and Postgres * Added powerbi conn md files * Align requirements files * Add Kafka and Redpanda * refined powerbi docs * Add Tableu requirements, move Athena and Glue fields, change footer some connectors * Add missing connectors fields descriptions default * re: datalake * Add Tableau field descriptions * fix: markdown styling * chore: improve button styling * chore: rename right panel to service right panel and move it to common * fix: doc for select and list field , cy test. * fix: unit test * fix: test connection service type issue * Added powerbi docs link in req * Add info on hive * Remove unused markdowns * Add req for datalake * add hive requirements header * Snowflake & Biguqery * Update Mssql and Postgres * mysql and amundsen requirements updated * Update Mssql and Postgres * added username * chore: fix cy expression issue * chore: reset active field state on step change. * fix: affix target container issue * fix: unit test * fix: cypress for postgres and glue --------- Co-authored-by: Milan Bariya <52292922+MilanBariya@users.noreply.github.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Teddy Crepineau <teddy.crepineau@gmail.com> Co-authored-by: ulixius9 <mayursingal9@gmail.com> Co-authored-by: NiharDoshi99 <51595473+NiharDoshi99@users.noreply.github.com> Co-authored-by: Milan Bariya <milanbariya12@gmail.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Nahuel Verdugo Revigliono <nahuel@getcollate.io> Co-authored-by: Nihar Doshi <nihardoshi16@gmail.com>
2023-03-29 14:18:17 +05:30
cy.get('#root\\/hostPort')
.scrollIntoView()
.type(Cypress.env('postgresHostPort'));
checkServiceFieldSectionHighlighting('hostPort');
chore(ui): add support for service documentation (part-1) (#10668) * chore(ui): add support for service documentation md file * sync local * chore: add method for fetching markdown file * chore(ui): add support for service documentation * chore: move fields to connections * chore: update logic to fetch requirements * chore: right panel component for service * fix: key prop is not present in the skeleton component * chore: only fetch md files when required fields are present * chore: use hook for fetching airflow status * chore: refactor add service component * chore: remove id prefix and id separator prop from form builder * fix: fieldName issue on right panel * fix: active Field name issue * fix:unit test * test: add unit test * chore: handle edit service form * chore: add fallback logic * fix: cy test * chore: update service doc md files/folder structure, * chore: push image example * Athena docs * Add glue docs * Add hive related changes * chore: take last field for fetching field doc * add datalake * Added connection information for oracle and redshift (english + french) * fix: fallback logic * Bigquery & Snowflake Requirements * mysql and amundsen requirements (#10752) * Revert removal of descriptions * Add Doc For Mssql and Postgres * Added powerbi conn md files * Align requirements files * Add Kafka and Redpanda * refined powerbi docs * Add Tableu requirements, move Athena and Glue fields, change footer some connectors * Add missing connectors fields descriptions default * re: datalake * Add Tableau field descriptions * fix: markdown styling * chore: improve button styling * chore: rename right panel to service right panel and move it to common * fix: doc for select and list field , cy test. * fix: unit test * fix: test connection service type issue * Added powerbi docs link in req * Add info on hive * Remove unused markdowns * Add req for datalake * add hive requirements header * Snowflake & Biguqery * Update Mssql and Postgres * mysql and amundsen requirements updated * Update Mssql and Postgres * added username * chore: fix cy expression issue * chore: reset active field state on step change. * fix: affix target container issue * fix: unit test * fix: cypress for postgres and glue --------- Co-authored-by: Milan Bariya <52292922+MilanBariya@users.noreply.github.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Teddy Crepineau <teddy.crepineau@gmail.com> Co-authored-by: ulixius9 <mayursingal9@gmail.com> Co-authored-by: NiharDoshi99 <51595473+NiharDoshi99@users.noreply.github.com> Co-authored-by: Milan Bariya <milanbariya12@gmail.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Nahuel Verdugo Revigliono <nahuel@getcollate.io> Co-authored-by: Nihar Doshi <nihardoshi16@gmail.com>
2023-03-29 14:18:17 +05:30
cy.get('#root\\/database')
.scrollIntoView()
.type(Cypress.env('postgresDatabase'));
checkServiceFieldSectionHighlighting('database');
};
const addIngestionInput = () => {
cy.get('[data-testid="schema-filter-pattern-checkbox"]')
.invoke('show')
.trigger('mouseover')
.check();
cy.get('[data-testid="filter-pattern-includes-schema"]')
.scrollIntoView()
.should('be.visible')
.type(filterPattern);
};
testServiceCreationAndIngestion({
serviceType,
connectionInput,
addIngestionInput,
serviceName,
serviceCategory: SERVICE_TYPE.Database,
});
});
it('Update table description and verify description after re-run', () => {
updateDescriptionForIngestedTables(
serviceName,
tableName,
description,
SERVICE_TYPE.Database,
'tables'
);
});
it('Add Usage ingestion', () => {
interceptURL(
'GET',
'api/v1/teams/name/Organization?fields=*',
'getSettingsPage'
);
interceptURL(
'POST',
'/api/v1/services/ingestionPipelines/deploy/*',
'deployIngestion'
);
cy.get('[data-testid="appbar-item-settings"]')
.should('be.visible')
.click({ force: true });
verifyResponseStatusCode('@getSettingsPage', 200);
// Services page
interceptURL('GET', '/api/v1/services/*', 'getServices');
cy.get('[data-testid="settings-left-panel"]')
.contains(SERVICE_TYPE.Database)
.should('be.visible')
.click();
verifyResponseStatusCode('@getServices', 200);
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines?*',
'ingestionData'
);
interceptURL(
'GET',
'/api/v1/system/config/pipeline-service-client',
'airflow'
);
interceptURL(
'GET',
'/api/v1/permissions/ingestionPipeline/name/*',
'ingestionPermissions'
);
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
interceptURL('GET', `/api/v1/*`, 'database');
cy.get(`[data-testid="service-name-${serviceName}"]`)
.should('exist')
.click();
verifyResponseStatusCode('@ingestionData', 200, {
responseTimeout: 50000,
});
verifyResponseStatusCode('@serviceDetails', 200);
verifyResponseStatusCode('@airflow', 200);
verifyResponseStatusCode('@database', 200);
cy.get('[data-testid="tabs"]').should('exist');
cy.get('[data-testid="Ingestions"]')
.scrollIntoView()
.should('be.visible')
.click();
verifyResponseStatusCode('@ingestionPermissions', 200);
cy.get('[data-testid="ingestion-details-container"]').should('exist');
cy.get('[data-testid="add-new-ingestion-button"]')
.should('be.visible')
.click();
feat#10614: consolidate 'OpenMetadata' service settings under one section. (#10768) * Added 'Data Insight' and 'Search' pipeline deployment functionalities in separate pages from the settings * Changes for localization for other languages * fixed cypress test constant for changes made * Removed 'OpenMetadata' service connection displaying in metadata category in settings. Also removed service details page and edit connection page for the same. * modularized the ingestion component for flexible usability in 'Data Insights' settings page * Fixed styling issues caused by long ingestion pipeline name inside the pipeline tables * fixed failing cypress test * fixed code smells * fixed edit ingestion page breadcrumb * Fixed long pipeline name overflow issue on success page * Added Icon for data insight menu item * Worked on comments * localization changes for other languages * fixed errors occurring due to wrong imports of OPENMETADATA constant * fixed OPENMETADATA constant import error * Fixed failing unit test * Fixed typescript error * Changes made to pass the pipelineType filter while fetching the ingestion pipelines for a service * Added tabs in the elastic search re index settings page * updated localization files for other languages * Updated the no data placeholder for settings page ingestion pipelines tab * added email configuration settings page * localization changes for other languages * fixed TriggerReIndexing component errors * made changes to reflect the selected tabs in the URL for elasticSearch reIndex page * fixed redirection issue from ingestion success screen to search settings page * Added loader while loading email configurations * changed the name of the button for adding elasticsearch reIndex pipeline * added localization changes for other languages * added 'Live' tab in the ElasticSearchReIndex Page * localization changes for other languages * added content in the locales folder for the description of the email configuration form fields. * removed edit-config modal and moved the form to separate page with field descriptions in the right panel * changed no data placeholder message for data insights and elastic search index pipeline * localization changes of other languages * changed the edit icon to use the newly added icon * Replaced deprecated DropdownList component with antd Dropdown * Replaced custom separator with antd Divider * replaced logic to create query params string with qs * removed unnecessary state to store active tab * Removed extra div element between pageContainer and pageLayout * Replaced manual mapping to get options with map function * changed logic to show 'stopReIndexing' and 'reIndexAll' buttons * Changed icon for stopped status for re-indexing * Fixed menu item selector causing cypress failure * fixed postgres spec --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
2023-04-12 18:25:47 +05:30
cy.get('[data-menu-id*="usage"')
.scrollIntoView()
.contains('Usage Ingestion')
.click();
cy.get('[data-testid="next-button"]')
.scrollIntoView()
.should('be.visible')
.click();
scheduleIngestion();
cy.wait('@deployIngestion').then(() => {
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines?*',
'ingestionPipelines'
);
interceptURL(
'GET',
'/api/v1/permissions/*/name/*',
'serviceDetailsPermission'
);
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines/status',
'getIngestionPipelineStatus'
);
cy.get('[data-testid="view-service-button"]')
.scrollIntoView()
.should('be.visible')
.click();
verifyResponseStatusCode('@getIngestionPipelineStatus', 200);
verifyResponseStatusCode('@serviceDetailsPermission', 200);
verifyResponseStatusCode('@serviceDetails', 200);
verifyResponseStatusCode('@ingestionPipelines', 200);
handleIngestionRetry('database', true, 0, 'usage');
});
});
it('Verify if usage is ingested properly', () => {
interceptURL(
'GET',
`/api/v1/tables/name/${serviceName}.*.*${tableName}?fields=*&include=all`,
'entityDetailsPage'
);
visitEntityDetailsPage(tableName, serviceName, 'tables');
verifyResponseStatusCode('@entityDetailsPage', 200);
interceptURL('GET', '/api/v1/queries?*', 'queriesTab');
cy.get('[data-testid="Queries"]').should('be.visible').trigger('click');
verifyResponseStatusCode('@queriesTab', 200);
// Validate that the triggered query is visible in the queries container
cy.get('[data-testid="queries-container"]')
.should('be.visible')
.should('contain', selectQuery);
// Validate queries count is greater than 1
cy.get('[data-testid="entity-summary-details"]')
.invoke('text')
.should('not.contain', '0 Queries');
// Validate schema contains frequently joined tables and columns
cy.get('[data-testid="Schema"]').should('be.visible').click();
cy.get('[data-testid="related-tables-data"]').should('be.visible');
cy.get('[data-testid="frequently-joined-columns"]').should('be.visible');
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
});