cypress: worked on upgrade test cypress part 1 (#12476)

This commit is contained in:
Shailesh Parmar 2023-07-18 18:08:02 +05:30 committed by GitHub
parent b6d5a438ec
commit ca16cd4087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 56 additions and 265 deletions

View File

@ -437,90 +437,6 @@ export const deleteCreatedService = (
cy.get(`[data-testid="service-name-${service_Name}"]`).should('not.exist');
};
export const editOwnerforCreatedService = (
service_type,
service_Name,
api_services
) => {
interceptURL(
'GET',
'api/v1/teams/name/Organization?fields=*',
'getSettingsPage'
);
// Click on settings page
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
verifyResponseStatusCode('@getSettingsPage', 200);
// Services page
cy.get('.ant-menu-title-content')
.contains(service_type)
.should('be.visible')
.click();
interceptURL(
'GET',
`/api/v1/services/${api_services}/name/${service_Name}?fields=*`,
'getSelectedService'
);
interceptURL(
'GET',
`/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=${service_Name}`,
'waitForIngestion'
);
interceptURL(
'GET',
'/api/v1/system/config/pipeline-service-client',
'airflow'
);
interceptURL(
'GET',
`/api/v1/*?service=${service_Name}&fields=*`,
'assetsDetail'
);
// click on created service
cy.get(`[data-testid="service-name-${service_Name}"]`)
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@getSelectedService', 200);
verifyResponseStatusCode('@waitForIngestion', 200);
verifyResponseStatusCode('@airflow', 200);
verifyResponseStatusCode('@assetsDetail', 200);
interceptURL('GET', '/api/v1/users?&isBot=false&limit=15', 'waitForUsers');
// Click on edit owner button
cy.get('[data-testid="edit-owner"]')
.should('exist')
.should('be.visible')
.click();
verifyResponseStatusCode('@waitForUsers', 200);
interceptURL(
'GET',
`api/v1/search/query?q=*${encodeURI('admin')}*&from=0&size=*&index=*`,
'searchOwner'
);
cy.get('.user-team-select-popover [data-testid="searchbar"]')
.should('be.visible')
.and('exist')
.trigger('click')
.type('admin');
verifyResponseStatusCode('@searchOwner', 200);
cy.get('[data-testid="owner-link"]')
.invoke('text')
.then((text) => {
expect(text).equal(ADMIN);
});
};
export const goToAddNewServicePage = (service_type) => {
interceptURL(
'GET',

View File

@ -14,7 +14,6 @@
import {
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -66,14 +65,6 @@ describe('Airflow Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Pipeline,
serviceName,
API_SERVICE.pipelineServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Pipeline,

View File

@ -13,7 +13,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -64,14 +63,6 @@ describe('ML Flow Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.MLModels,
serviceName,
API_SERVICE.mlmodelServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.MLModels,

View File

@ -13,7 +13,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -74,14 +73,6 @@ describe('S3Storage Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Storage,
serviceName,
API_SERVICE.storageServices
);
});
// Todo: unskip below test once issue is fixed https://github.com/open-metadata/OpenMetadata/issues/11700
it.skip('delete created service', () => {
deleteCreatedService(

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -109,14 +108,6 @@ describe('BigQuery Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -85,14 +84,6 @@ describe('Glue Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -82,14 +81,6 @@ describe('Kafka Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Messaging,
serviceName,
API_SERVICE.messagingServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Messaging,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -88,14 +87,6 @@ describe('Metabase Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Dashboard,
serviceName,
API_SERVICE.dashboardServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Dashboard,

View File

@ -13,7 +13,6 @@
import {
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
mySqlConnectionInput,
testServiceCreationAndIngestion,
@ -69,14 +68,6 @@ describe('MySQL Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
handleIngestionRetry,
interceptURL,
@ -221,14 +220,6 @@ describe('Postgres Ingestion', () => {
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,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
handleIngestionRetry,
interceptURL,
@ -283,14 +282,6 @@ describe('RedShift Ingestion', () => {
.should('contain', DBT.dataQualityTest2);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
REDSHIFT.serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,

View File

@ -14,7 +14,6 @@
import {
checkServiceFieldSectionHighlighting,
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -78,14 +77,6 @@ describe('Snowflake Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Database,
serviceName,
API_SERVICE.databaseServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Database,

View File

@ -13,7 +13,6 @@
import {
deleteCreatedService,
editOwnerforCreatedService,
goToAddNewServicePage,
testServiceCreationAndIngestion,
updateDescriptionForIngestedTables,
@ -86,14 +85,6 @@ describe('Superset Ingestion', () => {
);
});
it('Edit and validate owner', () => {
editOwnerforCreatedService(
SERVICE_TYPE.Dashboard,
serviceName,
API_SERVICE.dashboardServices
);
});
it('delete created service', () => {
deleteCreatedService(
SERVICE_TYPE.Dashboard,

View File

@ -11,6 +11,9 @@
* limitations under the License.
*/
// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />
import {
descriptionBox,
interceptURL,
@ -38,7 +41,19 @@ const deleteAlertSteps = (name) => {
verifyResponseStatusCode('@deleteAlert', 200);
toastNotification('Subscription deleted successfully!');
cy.get('[data-testid="add-placeholder-button"]').should('be.visible');
};
const visitAddAlertPage = () => {
cy.wait('@alertsPage').then(({ response }) => {
const data = response.body.data?.find((alert) => alert.provider === 'user');
if (Cypress._.isUndefined(data)) {
// Click on create placeholder button for alerts
cy.get('[data-testid="add-placeholder-button"]').click();
} else {
cy.get('[data-testid="create-alert"]').click();
}
});
};
describe('Alerts page should work properly', () => {
@ -54,37 +69,26 @@ describe('Alerts page should work properly', () => {
cy.get('[data-testid="global-setting-left-panel"]')
.contains('Alerts')
.scrollIntoView()
.should('be.visible')
.and('exist')
.click();
verifyResponseStatusCode('@alertsPage', 200);
});
it('Create new alert for all data assets', () => {
// Click on create placeholder button for alerts
cy.get('[data-testid="add-placeholder-button"]')
.should('be.visible')
.click();
visitAddAlertPage();
// Enter alert name
cy.get('#name').should('be.visible').type(alertForAllAssets);
// Enter description
cy.get(descriptionBox)
.should('be.visible')
.click()
.clear()
.type(description);
cy.get(descriptionBox).clear().type(description);
// Click on all data assets
cy.get('[data-testid="triggerConfig-type"]')
.contains('All')
.should('be.visible');
// Select filters
cy.get('[data-testid="add-filters"]').should('exist').click();
cy.get('[data-testid="add-filters"]').click();
cy.get('#filteringRules_rules_0_name').invoke('show').click();
// Select owner
cy.get('[title="Owner"]').should('be.visible').click();
cy.get('[title="Owner"]').click();
cy.get('[data-testid="matchAnyOwnerName-select"]')
.should('be.visible')
.click()
.type(teamSearchTerm);
verifyResponseStatusCode('@getSearchResult', 200);
@ -131,12 +135,7 @@ describe('Alerts page should work properly', () => {
});
it('Create new alert for all data assets and multiple filters', () => {
interceptURL('GET', '/api/v1/events/subscriptions/*', 'createAlert');
// Click on create placeholder button for alerts
cy.get('[data-testid="add-placeholder-button"]')
.should('be.visible')
.click();
verifyResponseStatusCode('@createAlert', 200);
visitAddAlertPage();
// Enter alert name
cy.get('#name').should('be.visible').type(alertForAllAssets);
// Enter description
@ -193,12 +192,8 @@ describe('Alerts page should work properly', () => {
});
it('Create new alert for Test case data asset', () => {
interceptURL('GET', '/api/v1/events/subscriptions/*', 'createAlert');
// Click on create placeholder button for alerts
cy.get('[data-testid="add-placeholder-button"]')
.should('be.visible')
.click();
verifyResponseStatusCode('@createAlert', 200);
visitAddAlertPage();
// Enter alert name
cy.get('#name').should('be.visible').type(TEST_CASE.testCaseAlert);
// Enter description
@ -271,10 +266,7 @@ describe('Alerts page should work properly', () => {
Object.values(DESTINATION).forEach((destination) => {
it(`Create alert for ${destination.locator}`, () => {
// Click on create placeholder button for alerts
cy.get('[data-testid="add-placeholder-button"]')
.should('be.visible')
.click();
visitAddAlertPage();
// Enter alert name
cy.get('#name').should('be.visible').type(destination.name);
// Enter description

View File

@ -10,6 +10,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />
import { interceptURL, verifyResponseStatusCode } from '../../common/common';
const config = {
@ -23,10 +26,7 @@ describe('Custom Logo Config', () => {
beforeEach(() => {
cy.login();
cy.get('[data-testid="appbar-item-settings"]')
.should('exist')
.and('be.visible')
.click();
cy.get('[data-testid="appbar-item-settings"]').click();
interceptURL(
'GET',
@ -37,35 +37,16 @@ describe('Custom Logo Config', () => {
cy.get('[data-testid="global-setting-left-panel"]')
.contains('Custom Logo')
.scrollIntoView()
.should('be.visible')
.and('exist')
.click();
verifyResponseStatusCode('@customLogoConfiguration', 200);
});
it('Should have default config', () => {
cy.get('[data-testid="sub-heading"]')
.should('be.visible')
.contains('Configure The Application Logo and Monogram.');
cy.get('[data-testid="logo-url"]').should('be.visible').contains('--');
cy.get('[data-testid="monogram-url"]').should('be.visible').contains('--');
cy.get('[data-testid="edit-button"]').should('be.visible');
});
it('Should update the config', () => {
interceptURL(
'GET',
'api/v1/system/settings/customLogoConfiguration',
'customLogoConfiguration'
);
cy.get('[data-testid="edit-button"]').should('be.visible').click();
verifyResponseStatusCode('@customLogoConfiguration', 200);
cy.get('[data-testid="customLogoUrlPath"]')
.scrollIntoView()
.should('be.visible')
.click()
.clear()
.type('incorrect url');
@ -74,15 +55,11 @@ describe('Custom Logo Config', () => {
cy.get('[data-testid="customLogoUrlPath"]')
.scrollIntoView()
.should('be.visible')
.click()
.clear()
.type(config.logo);
cy.get('[data-testid="customMonogramUrlPath"]')
.scrollIntoView()
.should('be.visible')
.click()
.clear()
.type('incorrect url');
@ -91,8 +68,6 @@ describe('Custom Logo Config', () => {
cy.get('[data-testid="customMonogramUrlPath"]')
.scrollIntoView()
.should('be.visible')
.click()
.clear()
.type(config.monogram);
@ -109,11 +84,19 @@ describe('Custom Logo Config', () => {
verifyResponseStatusCode('@updatedConfig', 200);
verifyResponseStatusCode('@updatedCustomLogoConfiguration', 200);
cy.get('[data-testid="logo-url"]')
.should('be.visible')
.contains(config.logo);
cy.get('[data-testid="monogram-url"]')
.should('be.visible')
.contains(config.monogram);
cy.get('[data-testid="logo-url"]').should('contain', config.logo);
cy.get('[data-testid="monogram-url"]').should('contain', config.monogram);
});
it('Reset to default', () => {
cy.get('[data-testid="edit-button"]').should('be.visible').click();
cy.get('[data-testid="customLogoUrlPath"]').scrollIntoView().clear();
cy.get('[data-testid="customMonogramUrlPath"]').scrollIntoView().clear();
interceptURL('PUT', 'api/v1/system/settings', 'updatedConfig');
cy.get('[data-testid="save-button"]').click();
verifyResponseStatusCode('@updatedConfig', 200);
verifyResponseStatusCode('@customLogoConfiguration', 200);
});
});

View File

@ -244,7 +244,7 @@ describe('Roles page should work properly', () => {
.should('contain', policies.organizationPolicy)
.should('have.class', 'selected');
cy.get('[type="button"]').contains('Submit').should('be.visible').click();
cy.get('[type="button"]').contains('Submit').scrollIntoView().click();
cy.get('[data-testid="entity-name"]')
.should('contain', policies.organizationPolicy)
@ -321,7 +321,7 @@ describe('Roles page should work properly', () => {
.should('be.visible')
.type('DELETE');
cy.get('[data-testid="confirm-button"]').should('be.visible').click();
cy.get('[data-testid="confirm-button"]').scrollIntoView().click();
// Validate deleted role
cy.get('[data-testid="role-name"]').should('not.contain', roleName);

View File

@ -85,10 +85,10 @@ describe('Services page should work properly', () => {
.click();
verifyResponseStatusCode('@editOwner', 200);
cy.get('.select-owner-tabs')
cy.get(
'.ant-popover-inner-content > .ant-tabs > .ant-tabs-nav > .ant-tabs-nav-wrap'
)
.contains('Users')
.should('exist')
.should('be.visible')
.click();
interceptURL(
@ -96,11 +96,19 @@ describe('Services page should work properly', () => {
'/api/v1/services/databaseServices/*',
'updateService'
);
interceptURL(
'GET',
'/api/v1/search/query?q=*%20AND%20isBot:false*&index=user_search_index',
'searchApi'
);
cy.get(
'[id*="panel-users"] [data-testid="selectable-list"] [data-testid="search-bar-container"] [data-testid="searchbar"]'
).type(service.Owner);
verifyResponseStatusCode('@searchApi', 200);
cy.get('[data-testid="selectable-list"]')
.contains(service.Owner)
.scrollIntoView()
.should('be.visible')
.click();
verifyResponseStatusCode('@updateService', 200);