2022-05-10 22:47:04 -07:00
|
|
|
/*
|
2022-12-27 12:37:58 +05:30
|
|
|
* Copyright 2022 Collate.
|
2022-05-10 22:47:04 -07:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// / <reference types="cypress" />
|
2022-09-23 16:05:54 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
import { DELETE_TERM, SEARCH_INDEX } from '../constants/constants';
|
2022-10-08 00:07:24 +05:30
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
export const descriptionBox =
|
2023-01-15 18:24:10 +05:30
|
|
|
'.toastui-editor-md-container > .toastui-editor > .ProseMirror';
|
2022-05-24 18:55:17 +05:30
|
|
|
export const uuid = () => Cypress._.random(0, 1e6);
|
2023-01-15 18:24:10 +05:30
|
|
|
const RETRY_TIMES = 4;
|
2022-11-28 12:40:19 +05:30
|
|
|
const BASE_WAIT_TIME = 20000;
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2022-09-27 18:42:49 +05:30
|
|
|
const ADMIN = 'admin';
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2022-09-26 19:43:34 +05:30
|
|
|
const TEAM_TYPES = ['BusinessUnit', 'Department', 'Division', 'Group'];
|
|
|
|
|
2022-05-14 15:44:02 -07:00
|
|
|
const isDatabaseService = (type) => type === 'database';
|
|
|
|
|
2022-09-26 19:43:34 +05:30
|
|
|
const checkTeamTypeOptions = () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
for (const teamType of TEAM_TYPES) {
|
|
|
|
cy.get(`.ant-select-dropdown [title="${teamType}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible');
|
|
|
|
}
|
2022-09-26 19:43:34 +05:30
|
|
|
};
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// intercepting URL with cy.intercept
|
2022-12-02 15:43:12 +05:30
|
|
|
export const interceptURL = (method, url, alias, callback) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.intercept({ method: method, url: url }, callback).as(alias);
|
2022-09-14 19:19:42 +05:30
|
|
|
};
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// waiting for response and validating the response status code
|
2022-09-14 19:19:42 +05:30
|
|
|
export const verifyResponseStatusCode = (alias, responseCode) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.wait(alias).its('response.statusCode').should('eq', responseCode);
|
2022-09-14 19:19:42 +05:30
|
|
|
};
|
|
|
|
|
2022-09-19 18:43:39 +05:30
|
|
|
export const handleIngestionRetry = (
|
2023-01-15 18:24:10 +05:30
|
|
|
type,
|
|
|
|
testIngestionButton,
|
|
|
|
count = 0,
|
|
|
|
ingestionType = 'metadata'
|
2022-09-19 18:43:39 +05:30
|
|
|
) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
let timer = BASE_WAIT_TIME;
|
|
|
|
const rowIndex = ingestionType === 'metadata' ? 1 : 2;
|
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=*',
|
|
|
|
'pipelineStatuses'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
|
|
|
|
|
|
|
|
// ingestions page
|
|
|
|
let retryCount = count;
|
|
|
|
const testIngestionsTab = () => {
|
|
|
|
cy.get('[data-testid="Ingestions"]').should('exist').and('be.visible');
|
|
|
|
cy.get('[data-testid="Ingestions"] >> [data-testid="filter-count"]').should(
|
|
|
|
'have.text',
|
|
|
|
rowIndex
|
|
|
|
);
|
|
|
|
// click on the tab only for the first time
|
|
|
|
if (retryCount === 0) {
|
|
|
|
// Wait for pipeline status to be loaded
|
|
|
|
verifyResponseStatusCode('@pipelineStatuses', 200);
|
|
|
|
cy.wait(1000); // adding manual wait for ingestion button to attach to DOM
|
|
|
|
cy.get('[data-testid="Ingestions"]').click();
|
|
|
|
}
|
|
|
|
if (isDatabaseService(type) && testIngestionButton) {
|
|
|
|
cy.get('[data-testid="add-new-ingestion-button"]').should('be.visible');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const checkSuccessState = () => {
|
|
|
|
testIngestionsTab();
|
|
|
|
retryCount++;
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('.ant-skeleton-input').length) {
|
|
|
|
cy.wait(1000);
|
|
|
|
}
|
|
|
|
});
|
2022-11-14 21:30:16 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
if (ingestionType === 'metadata') {
|
|
|
|
cy.get(`[data-row-key*="${ingestionType}"]`)
|
|
|
|
.find('[data-testid="pipeline-status"]')
|
|
|
|
.as('checkRun');
|
|
|
|
} else {
|
|
|
|
cy.get(`[data-row-key*="${ingestionType}"]`)
|
|
|
|
.find('[data-testid="pipeline-status"]')
|
|
|
|
.as('checkRun');
|
|
|
|
}
|
|
|
|
// the latest run should be success
|
|
|
|
cy.get('@checkRun').then(($ingestionStatus) => {
|
|
|
|
if (
|
|
|
|
$ingestionStatus.text() !== 'Success' &&
|
|
|
|
$ingestionStatus.text() !== 'Failed' &&
|
|
|
|
retryCount <= RETRY_TIMES
|
|
|
|
) {
|
|
|
|
// retry after waiting with log1 method [20s,40s,80s,160s,320s]
|
|
|
|
cy.wait(timer);
|
|
|
|
timer *= 2;
|
|
|
|
cy.reload();
|
|
|
|
verifyResponseStatusCode('@serviceDetails', 200);
|
|
|
|
checkSuccessState();
|
|
|
|
} else {
|
|
|
|
cy.get('@checkRun').should('have.text', 'Success');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
checkSuccessState();
|
2022-05-30 11:38:55 +05:30
|
|
|
};
|
|
|
|
|
2022-09-19 18:43:39 +05:30
|
|
|
export const scheduleIngestion = () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Schedule & Deploy
|
|
|
|
cy.contains('Schedule for Ingestion').should('be.visible');
|
2023-03-02 11:16:30 +05:30
|
|
|
cy.get('[data-testid="cron-type"]').should('be.visible').click();
|
|
|
|
cy.get('.ant-select-item-option-content').contains('Hour').click();
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="deploy-button"]').should('be.visible').click();
|
|
|
|
|
|
|
|
// check success
|
|
|
|
cy.get('[data-testid="success-line"]', { timeout: 15000 }).should(
|
|
|
|
'be.visible'
|
|
|
|
);
|
|
|
|
cy.contains('has been created and deployed successfully').should(
|
|
|
|
'be.visible'
|
|
|
|
);
|
2022-09-19 18:43:39 +05:30
|
|
|
};
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Storing the created service name and the type of service for later use
|
2022-07-25 10:54:47 +05:30
|
|
|
|
2022-05-11 23:35:13 -07:00
|
|
|
export const testServiceCreationAndIngestion = (
|
2023-01-15 18:24:10 +05:30
|
|
|
serviceType,
|
|
|
|
connectionInput,
|
|
|
|
addIngestionInput,
|
|
|
|
serviceName,
|
|
|
|
type = 'database',
|
|
|
|
testIngestionButton = true
|
2022-05-10 22:47:04 -07:00
|
|
|
) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Storing the created service name and the type of service
|
|
|
|
// Select Service in step 1
|
|
|
|
cy.get(`[data-testid="${serviceType}"]`).should('exist').click();
|
|
|
|
cy.get('[data-testid="next-button"]').should('exist').click();
|
|
|
|
|
2023-03-29 14:18:17 +05:30
|
|
|
// Should show requirements in step 2
|
|
|
|
|
|
|
|
cy.get('[data-testid="service-requirements"]').should('exist');
|
|
|
|
cy.get('[data-testid="next-button"]').should('exist').click();
|
|
|
|
|
|
|
|
// Enter service name in step 3
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="service-name"]').should('exist').type(serviceName);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'api/v1/services/ingestionPipelines/*',
|
|
|
|
'getIngestionPipelineStatus'
|
|
|
|
);
|
2023-03-03 18:50:35 +05:30
|
|
|
cy.get('[data-testid="next-button"]').should('exist').click();
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getIngestionPipelineStatus', 200);
|
2023-03-29 14:18:17 +05:30
|
|
|
|
|
|
|
// Connection Details in step 4
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="add-new-service-container"]')
|
|
|
|
.parent()
|
|
|
|
.parent()
|
|
|
|
.scrollTo('top', {
|
|
|
|
ensureScrollable: false,
|
|
|
|
});
|
|
|
|
cy.contains('Connection Details').scrollIntoView().should('be.visible');
|
|
|
|
|
|
|
|
connectionInput();
|
|
|
|
|
|
|
|
// check for the ip-address widget
|
|
|
|
cy.get('[data-testid="ip-address"]').should('exist');
|
|
|
|
|
|
|
|
// Test the connection
|
2023-03-28 06:29:13 +02:00
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2023-04-03 13:03:48 -07:00
|
|
|
'/api/v1/services/testConnectionDefinitions/name/*',
|
2023-03-28 06:29:13 +02:00
|
|
|
'testConnectionStepDefinition'
|
|
|
|
);
|
|
|
|
|
2023-04-03 13:03:48 -07:00
|
|
|
interceptURL('POST', '/api/v1/automations/workflows', 'createWorkflow');
|
2023-03-28 06:29:13 +02:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'POST',
|
2023-04-03 13:03:48 -07:00
|
|
|
'/api/v1/automations/workflows/trigger/*',
|
2023-03-28 06:29:13 +02:00
|
|
|
'triggerWorkflow'
|
2023-01-15 18:24:10 +05:30
|
|
|
);
|
2023-03-28 06:29:13 +02:00
|
|
|
|
2023-04-03 13:03:48 -07:00
|
|
|
interceptURL('GET', '/api/v1/automations/workflows/*', 'getWorkflow');
|
2023-03-28 06:29:13 +02:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="test-connection-btn"]').should('exist');
|
|
|
|
cy.get('[data-testid="test-connection-btn"]').click();
|
2023-03-28 06:29:13 +02:00
|
|
|
|
|
|
|
verifyResponseStatusCode('@testConnectionStepDefinition', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="test-connection-modal"]').should('exist');
|
|
|
|
cy.get('.ant-modal-footer > .ant-btn-primary')
|
|
|
|
.should('exist')
|
|
|
|
.contains('OK')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@createWorkflow', 201);
|
|
|
|
verifyResponseStatusCode('@triggerWorkflow', 200);
|
|
|
|
verifyResponseStatusCode('@getWorkflow', 200);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.contains('Connection test was successful').should('exist');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/services/ingestionPipelines/status',
|
|
|
|
'getIngestionPipelineStatus'
|
|
|
|
);
|
2023-03-29 14:18:17 +05:30
|
|
|
interceptURL(
|
|
|
|
'POST',
|
|
|
|
'/api/v1/services/ingestionPipelines/deploy/*',
|
|
|
|
'deployPipeline'
|
|
|
|
);
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="submit-btn"]').should('exist').click();
|
|
|
|
verifyResponseStatusCode('@getIngestionPipelineStatus', 200);
|
|
|
|
// check success
|
|
|
|
cy.get('[data-testid="success-line"]').should('be.visible');
|
|
|
|
cy.contains(`"${serviceName}"`).should('be.visible');
|
|
|
|
cy.contains('has been created successfully').should('be.visible');
|
|
|
|
|
|
|
|
cy.get('[data-testid="add-ingestion-button"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="add-ingestion-button"]').click();
|
|
|
|
|
|
|
|
// Add ingestion page
|
|
|
|
cy.get('[data-testid="add-ingestion-container"]').should('be.visible');
|
|
|
|
|
|
|
|
if (isDatabaseService(type)) {
|
|
|
|
cy.get('[data-testid="configure-ingestion-container"]').should(
|
|
|
|
'be.visible'
|
2022-05-14 15:44:02 -07:00
|
|
|
);
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Set mark-deleted slider to off to disable it.
|
|
|
|
cy.get('[data-testid="toggle-button-mark-deleted"]')
|
|
|
|
.should('exist')
|
|
|
|
.click();
|
|
|
|
}
|
2022-05-14 15:44:02 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
addIngestionInput();
|
2022-05-11 02:51:01 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="next-button"]').should('exist').click();
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
scheduleIngestion();
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2023-03-29 14:18:17 +05:30
|
|
|
verifyResponseStatusCode('@deployPipeline', 200);
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.contains(`${serviceName}_metadata`).should('be.visible');
|
|
|
|
// On the Right panel
|
|
|
|
cy.contains('Metadata Ingestion Added & Deployed Successfully').should(
|
|
|
|
'be.visible'
|
|
|
|
);
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// wait for ingestion to run
|
|
|
|
cy.clock();
|
|
|
|
cy.wait(10000);
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="view-service-button"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="view-service-button"]').click();
|
|
|
|
verifyResponseStatusCode('@getIngestionPipelineStatus', 200);
|
|
|
|
handleIngestionRetry(type, testIngestionButton);
|
2022-05-10 22:47:04 -07:00
|
|
|
};
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
export const deleteCreatedService = (
|
|
|
|
typeOfService,
|
|
|
|
service_Name,
|
|
|
|
apiService
|
|
|
|
) => {
|
|
|
|
// Click on settings page
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'api/v1/teams/name/Organization?fields=*',
|
|
|
|
'getSettingsPage'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click({ force: true });
|
|
|
|
verifyResponseStatusCode('@getSettingsPage', 200);
|
|
|
|
// Services page
|
|
|
|
interceptURL('GET', '/api/v1/services/*', 'getServices');
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.ant-menu-title-content')
|
|
|
|
.contains(typeOfService)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getServices', 200);
|
2022-07-25 10:54:47 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// click on created service
|
|
|
|
cy.get(`[data-testid="service-name-${service_Name}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-07-25 10:54:47 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="inactive-link"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.invoke('text')
|
|
|
|
.then((text) => {
|
|
|
|
expect(text).to.equal(service_Name);
|
|
|
|
});
|
2022-07-25 10:54:47 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getServices', 200);
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="service-delete"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on permanent delete radio button and checking the service name
|
|
|
|
cy.get('[data-testid="hard-delete-option"]')
|
|
|
|
.contains(service_Name)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="confirmation-text-input"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(DELETE_TERM);
|
|
|
|
interceptURL('DELETE', `/api/v1/services/${apiService}/*`, 'deleteService');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/services/*/name/*?fields=owner',
|
|
|
|
'serviceDetails'
|
|
|
|
);
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="confirm-button"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@deleteService', 200);
|
2022-11-14 21:30:16 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Closing the toast notification
|
|
|
|
toastNotification(`${typeOfService} Service deleted successfully!`);
|
2022-11-14 18:09:38 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="service-name-${service_Name}"]`).should('not.exist');
|
2022-08-06 12:38:27 +05:30
|
|
|
};
|
|
|
|
|
2022-11-03 10:10:32 +05:30
|
|
|
export const editOwnerforCreatedService = (
|
2023-01-15 18:24:10 +05:30
|
|
|
service_type,
|
|
|
|
service_Name,
|
|
|
|
api_services
|
2022-11-03 10:10:32 +05:30
|
|
|
) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
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=owner`,
|
|
|
|
'getSelectedService'
|
|
|
|
);
|
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=${service_Name}`,
|
|
|
|
'waitForIngestion'
|
|
|
|
);
|
|
|
|
|
2023-02-07 16:30:42 +01:00
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/system/config/pipeline-service-client',
|
|
|
|
'airflow'
|
|
|
|
);
|
2023-01-15 18:24:10 +05:30
|
|
|
// 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);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2023-03-28 14:39:41 +05:30
|
|
|
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=15&index=team_search_index',
|
2023-01-15 18:24:10 +05:30
|
|
|
'waitForTeams'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Click on edit owner button
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="edit-owner"]')
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.trigger('mouseover')
|
|
|
|
.click();
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@waitForTeams', 200);
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('.user-team-select-popover')
|
2023-01-15 18:24:10 +05:30
|
|
|
.contains('Users')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`api/v1/search/query?q=*${encodeURI('admin')}*&from=0&size=*&index=*`,
|
|
|
|
'searchOwner'
|
|
|
|
);
|
|
|
|
cy.get('.user-team-select-popover [data-testid="searchbar"]')
|
|
|
|
.eq(1)
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('be.visible')
|
2023-03-28 14:39:41 +05:30
|
|
|
.and('exist')
|
|
|
|
.trigger('click')
|
|
|
|
.type('admin');
|
2022-08-06 12:38:27 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
verifyResponseStatusCode('@searchOwner', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="owner-name"]')
|
2023-01-15 18:24:10 +05:30
|
|
|
.invoke('text')
|
|
|
|
.then((text) => {
|
|
|
|
expect(text).equal(ADMIN);
|
|
|
|
});
|
2022-07-25 10:54:47 +05:30
|
|
|
};
|
|
|
|
|
2022-08-11 10:57:39 +05:30
|
|
|
export const goToAddNewServicePage = (service_type) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'api/v1/teams/name/Organization?fields=*',
|
|
|
|
'getSettingsPage'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="tables"]').should('be.visible');
|
|
|
|
// Click on settings page
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@getSettingsPage', 200);
|
|
|
|
// Services page
|
|
|
|
interceptURL('GET', '/api/v1/services/*', 'getServiceList');
|
|
|
|
cy.get('[data-testid="global-setting-left-panel"]')
|
|
|
|
.contains(service_type)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-05-10 22:47:04 -07:00
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getServiceList', 200);
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="add-service-button"]').should('be.visible').click();
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Add new service page
|
|
|
|
cy.url().should('include', '/add-service');
|
|
|
|
cy.get('[data-testid="header"]').should('be.visible');
|
|
|
|
cy.contains('Add New Service').should('be.visible');
|
|
|
|
cy.get('[data-testid="service-category"]').should('be.visible');
|
2022-05-11 23:35:13 -07:00
|
|
|
};
|
2022-05-13 21:15:39 +05:30
|
|
|
|
2022-05-19 17:34:32 +05:30
|
|
|
/**
|
|
|
|
* Search for entities through the search bar
|
|
|
|
* @param {string} term Entity name
|
|
|
|
*/
|
2022-09-19 18:43:39 +05:30
|
|
|
export const searchEntity = (term, suggestionOverly = true) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="searchBox"]').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('[data-testid="searchBox"]').type(`${term}{enter}`);
|
|
|
|
if (suggestionOverly) {
|
|
|
|
cy.get('[data-testid="suggestion-overlay"]').click(1, 1);
|
|
|
|
}
|
2022-05-19 17:34:32 +05:30
|
|
|
};
|
2022-05-30 11:38:55 +05:30
|
|
|
|
2022-09-29 02:49:03 +05:30
|
|
|
export const visitEntityDetailsPage = (term, serviceName, entity) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails');
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/search/query?q=*&index=${SEARCH_INDEX[entity]}&from=*&size=**`,
|
|
|
|
'explorePageTabSearch'
|
|
|
|
);
|
|
|
|
interceptURL('GET', `/api/v1/search/suggest?q=*&index=*`, 'searchQuery');
|
|
|
|
interceptURL('GET', `/api/v1/search/*`, 'explorePageSearch');
|
|
|
|
|
|
|
|
// searching term in search box
|
|
|
|
cy.get('[data-testid="searchBox"]').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('[data-testid="searchBox"]').type(term);
|
|
|
|
cy.get('[data-testid="suggestion-overlay"]').should('exist');
|
|
|
|
verifyResponseStatusCode('@searchQuery', 200);
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
// checking if requested term is available in search suggestion
|
|
|
|
if (
|
|
|
|
$body.find(
|
|
|
|
`[data-testid="${serviceName}-${term}"] [data-testid="data-name"]`
|
|
|
|
).length
|
|
|
|
) {
|
|
|
|
// if term is available in search suggestion, redirecting to entity details page
|
|
|
|
cy.get(`[data-testid="${serviceName}-${term}"] [data-testid="data-name"]`)
|
2022-11-03 14:37:26 +05:30
|
|
|
.should('be.visible')
|
2023-01-15 18:24:10 +05:30
|
|
|
.first()
|
2022-11-03 14:37:26 +05:30
|
|
|
.click();
|
2023-01-15 18:24:10 +05:30
|
|
|
} else {
|
|
|
|
// if term is not available in search suggestion, hitting enter to search box so it will redirect to explore page
|
|
|
|
cy.get('body').click(1, 1);
|
|
|
|
cy.get('[data-testid="searchBox"]').type('{enter}');
|
|
|
|
verifyResponseStatusCode('@explorePageSearch', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible').click();
|
|
|
|
cy.get(`[data-testid="${entity}-tab"]`).should('be.visible');
|
|
|
|
verifyResponseStatusCode('@explorePageTabSearch', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="${serviceName}-${term}"]`)
|
2022-11-03 14:37:26 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2023-01-15 18:24:10 +05:30
|
|
|
}
|
|
|
|
});
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getEntityDetails', 200);
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('[data-testid="suggestion-overlay"]').length) {
|
|
|
|
cy.get('[data-testid="suggestion-overlay"]').click(1, 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
cy.get('body').click(1, 1);
|
|
|
|
cy.get('[data-testid="searchBox"]').clear();
|
2022-08-17 19:08:35 +05:30
|
|
|
};
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// add new tag to entity and its table
|
|
|
|
export const addNewTagToEntity = (entityObj, term) => {
|
|
|
|
visitEntityDetailsPage(
|
|
|
|
entityObj.term,
|
|
|
|
entityObj.serviceName,
|
|
|
|
entityObj.entity
|
|
|
|
);
|
|
|
|
cy.wait(500);
|
|
|
|
cy.get('[data-testid="tags"] > [data-testid="add-tag"]')
|
|
|
|
.eq(0)
|
|
|
|
.should('be.visible')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="tag-selector"] input').should('be.visible').type(term);
|
|
|
|
|
2023-03-06 19:21:21 +05:30
|
|
|
cy.get('.ant-select-item-option-content')
|
|
|
|
.contains(term)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2023-03-16 20:43:04 +05:30
|
|
|
cy.get('[data-testid="tag-selector"] > .ant-select-selector').contains(term);
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
|
|
|
cy.get('[data-testid="entity-tags"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(term);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="tag-container"]')
|
|
|
|
.contains('Tags')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="tag-selector"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(term);
|
|
|
|
cy.wait(500);
|
2023-03-06 19:21:21 +05:30
|
|
|
cy.get('.ant-select-item-option-content')
|
|
|
|
.contains(term)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="tag-container"]').contains(term).should('exist');
|
|
|
|
};
|
|
|
|
|
|
|
|
export const addUser = (username, email) => {
|
|
|
|
cy.get('[data-testid="email"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(email);
|
|
|
|
cy.get('[data-testid="displayName"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(username);
|
|
|
|
cy.get(descriptionBox)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type('Adding user');
|
|
|
|
interceptURL('GET', ' /api/v1/users/generateRandomPwd', 'generatePassword');
|
|
|
|
cy.get('[data-testid="password-generator"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@generatePassword', 200);
|
|
|
|
cy.wait(1000);
|
|
|
|
interceptURL('POST', ' /api/v1/users', 'add-user');
|
|
|
|
cy.get('[data-testid="save-user"]').scrollIntoView().click();
|
|
|
|
};
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-03-26 20:06:03 +05:30
|
|
|
export const softDeleteUser = (username, isAdmin) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Search the created user
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?q=**&from=0&size=*&index=*',
|
|
|
|
'searchUser'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="searchbar"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(username);
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@searchUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on delete button
|
|
|
|
cy.get(`[data-testid="delete-user-btn-${username}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// Soft deleting the user
|
|
|
|
cy.get('[data-testid="soft-delete"]').click();
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
|
|
|
|
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'/api/v1/users/*?hardDelete=false&recursive=false',
|
|
|
|
'softdeleteUser'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/users*', 'userDeleted');
|
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@softdeleteUser', 200);
|
|
|
|
verifyResponseStatusCode('@userDeleted', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
toastNotification('User deleted successfully!');
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-03-26 20:06:03 +05:30
|
|
|
if (!isAdmin) {
|
|
|
|
cy.get('[data-testid="previous"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('exist')
|
|
|
|
.should('be.disabled');
|
|
|
|
|
|
|
|
cy.get('[data-testid="page-indicator"]').contains('1/7 Page');
|
|
|
|
}
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('GET', '/api/v1/search/query*', 'searchUser');
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verifying the deleted user
|
|
|
|
cy.get('[data-testid="searchbar"]')
|
2023-03-26 20:06:03 +05:30
|
|
|
.scrollIntoView()
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.clear()
|
|
|
|
.type(username);
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@searchUser', 200);
|
|
|
|
cy.get('.ant-table-placeholder > .ant-table-cell').should(
|
|
|
|
'not.contain',
|
|
|
|
username
|
|
|
|
);
|
2022-08-17 19:08:35 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const restoreUser = (username) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Click on deleted user toggle
|
|
|
|
interceptURL('GET', '/api/v1/users*', 'deletedUser');
|
|
|
|
cy.get('.ant-switch-handle').should('exist').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@deletedUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="restore-user-btn-${username}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('.ant-modal-body > p').should(
|
|
|
|
'contain',
|
|
|
|
`Are you sure you want to restore ${username}?`
|
|
|
|
);
|
|
|
|
interceptURL('PUT', '/api/v1/users', 'restoreUser');
|
|
|
|
cy.get('.ant-modal-footer > .ant-btn-primary')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@restoreUser', 200);
|
2023-02-16 17:28:00 +05:30
|
|
|
toastNotification('User restored successfully');
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Verifying the restored user
|
|
|
|
cy.get('.ant-switch').should('exist').should('be.visible').click();
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('GET', '/api/v1/search/query*', 'searchUser');
|
|
|
|
cy.get('[data-testid="searchbar"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(username);
|
|
|
|
verifyResponseStatusCode('@searchUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.ant-table-row > :nth-child(1)').should('contain', username);
|
2022-08-17 19:08:35 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const deleteSoftDeletedUser = (username) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/users?fields=profile,teams,roles&include=*&limit=*',
|
|
|
|
'getSoftDeletedUser'
|
|
|
|
);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.ant-switch-handle').should('exist').should('be.visible').click();
|
2022-12-06 15:19:52 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@getSoftDeletedUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-testid="delete-user-btn-${username}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'api/v1/users/*?hardDelete=true&recursive=false',
|
|
|
|
'hardDeleteUser'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@hardDeleteUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
toastNotification('User deleted successfully!');
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'api/v1/search/query?q=**&from=0&size=15&index=user_search_index',
|
|
|
|
'searchUser'
|
|
|
|
);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="searchbar"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(username);
|
|
|
|
verifyResponseStatusCode('@searchUser', 200);
|
2022-08-17 19:08:35 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.ant-table-placeholder > .ant-table-cell').should(
|
|
|
|
'not.contain',
|
|
|
|
username
|
|
|
|
);
|
2022-08-17 19:08:35 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const toastNotification = (msg) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.Toastify__toast-body').should('be.visible').contains(msg);
|
|
|
|
cy.wait(200);
|
|
|
|
cy.get('.Toastify__close-button').should('be.visible').click();
|
2022-08-17 19:08:35 +05:30
|
|
|
};
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2022-09-29 15:21:33 +05:30
|
|
|
export const addCustomPropertiesForEntity = (
|
2023-01-15 18:24:10 +05:30
|
|
|
propertyName,
|
|
|
|
entityType,
|
|
|
|
customType,
|
|
|
|
value,
|
|
|
|
entityObj
|
2022-09-29 15:21:33 +05:30
|
|
|
) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Add Custom property for selected entity
|
|
|
|
cy.get('[data-testid="add-field-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="name"]').should('be.visible').type(propertyName);
|
|
|
|
cy.get('select').select(customType);
|
|
|
|
cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(entityType.description);
|
|
|
|
// Check if the property got added
|
|
|
|
cy.intercept('/api/v1/metadata/types/name/*?fields=customProperties').as(
|
|
|
|
'customProperties'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="create-custom-field"]').scrollIntoView().click();
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.wait('@customProperties');
|
|
|
|
cy.get('.ant-table-row').should('contain', propertyName);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Navigating to home page
|
|
|
|
cy.clickOnLogo();
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Checking the added property in Entity
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
visitEntityDetailsPage(
|
|
|
|
entityObj.term,
|
|
|
|
entityObj.serviceName,
|
|
|
|
entityObj.entity
|
|
|
|
);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="Custom Properties"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('tbody').should('contain', propertyName);
|
|
|
|
|
|
|
|
// Adding value for the custom property
|
|
|
|
|
|
|
|
// Navigating through the created custom property for adding value
|
|
|
|
cy.get(`[data-row-key="${propertyName}"]`)
|
|
|
|
.find('[data-testid="edit-icon"]')
|
|
|
|
.as('editbutton');
|
|
|
|
cy.wait(1000);
|
|
|
|
|
|
|
|
cy.get('@editbutton').should('exist').should('be.visible').click();
|
|
|
|
|
|
|
|
// Checking for value text box or markdown box
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('[data-testid="value-input"]').length > 0) {
|
|
|
|
cy.get('[data-testid="value-input"]').should('be.visible').type(value);
|
|
|
|
cy.get('[data-testid="save-value"]').click();
|
|
|
|
} else if (
|
|
|
|
$body.find(
|
|
|
|
'.toastui-editor-md-container > .toastui-editor > .ProseMirror'
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror')
|
2022-08-23 19:21:06 +05:30
|
|
|
.should('be.visible')
|
2023-01-15 18:24:10 +05:30
|
|
|
.type(value);
|
|
|
|
cy.get('[data-testid="save"]').click();
|
|
|
|
}
|
|
|
|
});
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`[data-row-key="${propertyName}"]`).should('contain', value);
|
2022-08-23 19:21:06 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const editCreatedProperty = (propertyName) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Fetching for edit button
|
|
|
|
cy.get(`[data-row-key="${propertyName}"]`)
|
|
|
|
.find('[data-testid="edit-button"]')
|
|
|
|
.as('editbutton');
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('@editbutton').click();
|
2022-11-03 14:37:26 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(descriptionBox)
|
|
|
|
.should('be.visible')
|
|
|
|
.clear()
|
|
|
|
.type('This is new description');
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/metadata/types/*', 'checkPatchForDescription');
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="save"]').should('be.visible').click();
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@checkPatchForDescription', 200);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('.ant-modal-wrap').should('not.exist');
|
2022-09-27 18:42:49 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Fetching for updated descriptions for the created custom property
|
|
|
|
cy.get(`[data-row-key="${propertyName}"]`)
|
|
|
|
.find('[data-testid="viewer-container"]')
|
|
|
|
.should('contain', 'This is new description');
|
2022-08-23 19:21:06 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const deleteCreatedProperty = (propertyName) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// Fetching for delete button
|
|
|
|
cy.get(`[data-row-key="${propertyName}"]`)
|
|
|
|
.find('[data-testid="delete-button"]')
|
|
|
|
.as('deletebutton');
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('@deletebutton').click();
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Checking property name is present on the delete pop-up
|
|
|
|
cy.get('[data-testid="body-text"]').should('contain', propertyName);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="save-button"]').should('be.visible').click();
|
2022-08-23 19:21:06 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Checking if property got deleted successfully
|
|
|
|
cy.get('[data-testid="add-field-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
2022-08-23 19:21:06 +05:30
|
|
|
};
|
2022-09-07 18:50:29 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
export const updateOwner = () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="avatar"]').should('be.visible').click();
|
|
|
|
cy.get('[data-testid="user-name"]')
|
|
|
|
.should('exist')
|
|
|
|
.invoke('text')
|
|
|
|
.then((text) => {
|
|
|
|
cy.get('[data-testid="hiden-layer"]').should('exist').click();
|
2023-03-28 14:39:41 +05:30
|
|
|
interceptURL('GET', '/api/v1/users?limit=15', 'getUsers');
|
2023-01-15 18:24:10 +05:30
|
|
|
// Clicking on edit owner button
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="add-user"]').should('be.visible').click();
|
2023-01-15 18:24:10 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
verifyResponseStatusCode('@getUsers', 200);
|
2023-01-15 18:24:10 +05:30
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="selectable-list"]')
|
|
|
|
.find(`[title="${text.trim()}"]`)
|
2023-01-15 18:24:10 +05:30
|
|
|
.click();
|
|
|
|
|
|
|
|
// Asserting the added name
|
|
|
|
cy.get('[data-testid="owner-link"]').should('contain', text.trim());
|
|
|
|
});
|
2022-09-14 19:19:42 +05:30
|
|
|
};
|
2022-09-21 22:25:33 +05:30
|
|
|
|
|
|
|
export const mySqlConnectionInput = () => {
|
2023-03-29 14:18:17 +05:30
|
|
|
cy.get('#root\\/username').type(Cypress.env('mysqlUsername'));
|
|
|
|
cy.get('#root\\/password').type(Cypress.env('mysqlPassword'));
|
|
|
|
cy.get('#root\\/hostPort').type(Cypress.env('mysqlHostPort'));
|
|
|
|
cy.get('#root\\/databaseSchema').type(Cypress.env('mysqlDatabaseSchema'));
|
2022-09-21 22:25:33 +05:30
|
|
|
};
|
2022-09-23 16:05:54 +05:30
|
|
|
|
|
|
|
export const login = (username, password) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.visit('/');
|
|
|
|
cy.get('[id="email"]').should('be.visible').clear().type(username);
|
|
|
|
cy.get('[id="password"]').should('be.visible').clear().type(password);
|
|
|
|
cy.get('.ant-btn').contains('Login').should('be.visible').click();
|
2022-09-23 16:05:54 +05:30
|
|
|
};
|
2022-09-26 19:43:34 +05:30
|
|
|
|
|
|
|
export const addTeam = (TEAM_DETAILS) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('GET', '/api/v1/teams*', 'addTeam');
|
|
|
|
// Fetching the add button and clicking on it
|
|
|
|
cy.get('[data-testid="add-team"]').should('be.visible').click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@addTeam', 200);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Entering team details
|
|
|
|
cy.get('[data-testid="name"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(TEAM_DETAILS.name);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="display-name"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(TEAM_DETAILS.name);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="team-selector"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
checkTeamTypeOptions();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(`.ant-select-dropdown [title="${TEAM_DETAILS.teamType}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get(descriptionBox)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(TEAM_DETAILS.description);
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('POST', '/api/v1/teams', 'saveTeam');
|
|
|
|
interceptURL('GET', '/api/v1/team*', 'createTeam');
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Saving the created team
|
|
|
|
cy.get('[form="add-team-form"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-26 19:43:34 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
verifyResponseStatusCode('@saveTeam', 201);
|
|
|
|
verifyResponseStatusCode('@createTeam', 200);
|
2022-09-26 19:43:34 +05:30
|
|
|
};
|
2022-09-27 18:55:58 +05:30
|
|
|
|
|
|
|
export const retryIngestionRun = () => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails');
|
|
|
|
let timer = BASE_WAIT_TIME;
|
|
|
|
let retryCount = 0;
|
|
|
|
const testIngestionsTab = () => {
|
|
|
|
cy.get('[data-testid="Ingestions"]').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('[data-testid="Ingestions"] >> [data-testid="filter-count"]').should(
|
|
|
|
'have.text',
|
|
|
|
'1'
|
|
|
|
);
|
|
|
|
if (retryCount === 0) {
|
|
|
|
cy.wait(1000);
|
|
|
|
cy.get('[data-testid="Ingestions"]').should('be.visible');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const checkSuccessState = () => {
|
|
|
|
testIngestionsTab();
|
|
|
|
retryCount++;
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('.ant-skeleton-input').length) {
|
|
|
|
cy.wait(1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// the latest run should be success
|
|
|
|
cy.get('[data-testid="pipeline-status"]').then(($ingestionStatus) => {
|
|
|
|
if ($ingestionStatus.text() !== 'Success' && retryCount <= RETRY_TIMES) {
|
|
|
|
// retry after waiting with log1 method [20s,40s,80s,160s,320s]
|
|
|
|
cy.wait(timer);
|
|
|
|
timer *= 2;
|
|
|
|
cy.reload();
|
|
|
|
verifyResponseStatusCode('@serviceDetails', 200);
|
|
|
|
checkSuccessState();
|
|
|
|
} else {
|
|
|
|
cy.get('[data-testid="pipeline-status"]').should(
|
|
|
|
'have.text',
|
|
|
|
'Success'
|
2022-11-03 14:37:26 +05:30
|
|
|
);
|
2023-01-15 18:24:10 +05:30
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
checkSuccessState();
|
2022-09-27 18:55:58 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const updateDescriptionForIngestedTables = (
|
2023-01-15 18:24:10 +05:30
|
|
|
serviceName,
|
|
|
|
tableName,
|
|
|
|
description,
|
|
|
|
type,
|
|
|
|
entity
|
2022-09-27 18:55:58 +05:30
|
|
|
) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=*',
|
|
|
|
'pipelineStatuses'
|
|
|
|
);
|
|
|
|
// Navigate to ingested table
|
|
|
|
visitEntityDetailsPage(tableName, serviceName, entity);
|
|
|
|
|
|
|
|
// update description
|
|
|
|
cy.get('[data-testid="edit-description"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click({ force: true });
|
|
|
|
cy.get(descriptionBox).should('be.visible').click().clear().type(description);
|
|
|
|
interceptURL('PATCH', '/api/v1/*/*', 'updateEntity');
|
|
|
|
cy.get('[data-testid="save"]').click();
|
|
|
|
verifyResponseStatusCode('@updateEntity', 200);
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// re-run ingestion flow
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Services page
|
|
|
|
cy.get('.ant-menu-title-content').contains(type).should('be.visible').click();
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/services/ingestionPipelines?fields=owner,pipelineStatuses&service=${serviceName}`,
|
|
|
|
'getSelectedService'
|
|
|
|
);
|
2023-02-07 16:30:42 +01:00
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/system/config/pipeline-service-client',
|
|
|
|
'airflow'
|
|
|
|
);
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// click on created service
|
|
|
|
cy.get(`[data-testid="service-name-${serviceName}"]`)
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
verifyResponseStatusCode('@getSelectedService', 200);
|
|
|
|
verifyResponseStatusCode('@pipelineStatuses', 200);
|
|
|
|
verifyResponseStatusCode('@airflow', 200);
|
|
|
|
cy.get('[data-testid="Ingestions"]').should('be.visible').click();
|
|
|
|
interceptURL(
|
|
|
|
'POST',
|
|
|
|
'/api/v1/services/ingestionPipelines/trigger/*',
|
|
|
|
'checkRun'
|
|
|
|
);
|
|
|
|
cy.get(`[data-row-key*="${serviceName}_metadata"] [data-testid="run"]`)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@checkRun', 200);
|
2022-09-28 21:58:20 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Close the toast message
|
|
|
|
cy.get('.Toastify__close-button').should('be.visible').click();
|
2022-09-28 21:58:20 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Wait for success
|
|
|
|
retryIngestionRun();
|
2022-09-27 18:55:58 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Navigate to table name
|
|
|
|
visitEntityDetailsPage(tableName, serviceName, entity);
|
|
|
|
cy.get('[data-testid="markdown-parser"]')
|
|
|
|
.first()
|
|
|
|
.invoke('text')
|
|
|
|
.should('contain', description);
|
2022-12-02 20:54:25 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
export const followAndOwnTheEntity = (termObj) => {
|
2023-01-15 18:24:10 +05:30
|
|
|
// search for the term and redirect to the respective entity tab
|
|
|
|
|
|
|
|
visitEntityDetailsPage(termObj.term, termObj.serviceName, termObj.entity);
|
|
|
|
// go to manage tab and search for logged in user and set the owner
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2023-03-28 14:39:41 +05:30
|
|
|
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=15&index=team_search_index',
|
2023-01-15 18:24:10 +05:30
|
|
|
'getTeams'
|
|
|
|
);
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="edit-owner"]').should('be.visible').click();
|
2023-01-15 18:24:10 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getTeams', 200);
|
|
|
|
// Clicking on users tab
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('.user-team-select-popover')
|
2023-01-15 18:24:10 +05:30
|
|
|
.contains('Users')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="selectable-list"]')
|
|
|
|
.eq(1)
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
2023-03-28 14:39:41 +05:30
|
|
|
.find('[title="admin"]')
|
|
|
|
.should('be.visible')
|
2023-01-15 18:24:10 +05:30
|
|
|
.click();
|
|
|
|
|
2023-03-28 14:39:41 +05:30
|
|
|
cy.get('[data-testid="owner-link"]')
|
2023-01-15 18:24:10 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.invoke('text')
|
|
|
|
.then((text) => {
|
|
|
|
expect(text).equal('admin');
|
|
|
|
});
|
|
|
|
|
|
|
|
interceptURL('PUT', '/api/v1/*/*/followers', 'waitAfterFollow');
|
|
|
|
cy.get('[data-testid="follow-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
verifyResponseStatusCode('@waitAfterFollow', 200);
|
|
|
|
|
|
|
|
cy.clickOnLogo();
|
2023-01-04 14:28:50 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.get('[data-testid="message-container"]')
|
|
|
|
.first()
|
|
|
|
.contains(`Followed ${termObj.entity.slice(0, -1)}`)
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// checks newly generated feed for follow and setting owner
|
|
|
|
cy.get('[data-testid="message-container"]')
|
|
|
|
.eq(1)
|
|
|
|
.scrollIntoView()
|
|
|
|
.contains('Added owner: admin')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// Check followed entity on mydata page
|
|
|
|
cy.get('[data-testid="following-data-container"]')
|
2022-12-02 20:54:25 +05:30
|
|
|
.find(`[data-testid="Following data-${termObj.displayName}"]`)
|
|
|
|
.should('be.visible');
|
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
// Check owned entity
|
|
|
|
cy.get('[data-testid="my-data-container"]')
|
2022-12-02 20:54:25 +05:30
|
|
|
.find(`[data-testid="My data-${termObj.displayName}"]`)
|
2023-01-15 18:24:10 +05:30
|
|
|
.should('be.visible');
|
2022-12-02 20:54:25 +05:30
|
|
|
|
2023-01-15 18:24:10 +05:30
|
|
|
cy.clickOnLogo();
|
|
|
|
};
|