cypress: work on advance search skip test (#14074)

This commit is contained in:
Shailesh Parmar 2023-11-24 09:45:07 +05:30 committed by GitHub
parent 1bb687d557
commit 50e00ea670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 506 additions and 409 deletions

View File

@ -10,13 +10,81 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SEARCH_ENTITY_TABLE } from '../constants/constants';
import { MYSQL } from '../constants/service.constants';
import {
DATABASE_DETAILS,
DATABASE_SERVICE_DETAILS,
SCHEMA_DETAILS,
TABLE_DETAILS,
} from '../constants/entityConstant';
import { USER_CREDENTIALS } from '../constants/SearchIndexDetails.constants';
import {
interceptURL,
uuid,
verifyResponseStatusCode,
visitEntityDetailsPage,
} from './common';
import { createEntityTable } from './entityUtils';
export const ADVANCE_SEARCH_TABLES = {
table1: TABLE_DETAILS,
table2: {
name: `cy-table2-${uuid()}`,
description: 'description',
columns: [
{
name: 'cypress_first_name',
dataType: 'VARCHAR',
dataLength: 100,
dataTypeDisplay: 'varchar',
description: 'First name of the staff member.',
},
{
name: 'cypress_last_name',
dataType: 'VARCHAR',
dataLength: 100,
dataTypeDisplay: 'varchar',
},
{
name: 'cypress_email',
dataType: 'VARCHAR',
dataLength: 100,
dataTypeDisplay: 'varchar',
description: 'Email address of the staff member.',
},
],
databaseSchema: `${DATABASE_SERVICE_DETAILS.name}.${DATABASE_DETAILS.name}.${SCHEMA_DETAILS.name}`,
},
table3: {
name: `cy-table3-${uuid()}`,
description: 'description',
columns: [
{
name: 'cypress_user_id',
dataType: 'NUMERIC',
dataTypeDisplay: 'numeric',
description:
'Unique identifier for the user of your Shopify POS or your Shopify admin.',
},
{
name: 'cypress_shop_id',
dataType: 'NUMERIC',
dataTypeDisplay: 'numeric',
description:
'The ID of the store. This column is a foreign key reference to the shop_id column in the dim.shop table.',
},
],
databaseSchema: `${DATABASE_SERVICE_DETAILS.name}.${DATABASE_DETAILS.name}.${SCHEMA_DETAILS.name}`,
},
};
export const ADVANCE_SEARCH_DATABASE_SERVICE = {
service: DATABASE_SERVICE_DETAILS,
database: DATABASE_DETAILS,
schema: SCHEMA_DETAILS,
tables: Object.values(ADVANCE_SEARCH_TABLES),
};
export const CONDITIONS_MUST = {
equalTo: {
@ -47,14 +115,15 @@ export const CONDITIONS_MUST_NOT = {
filter: 'must_not',
},
};
const ownerFullName = `${USER_CREDENTIALS.firstName}${USER_CREDENTIALS.lastName}`;
export const FIELDS = {
Owner: {
name: 'Owner',
testid: '[title="Owner"]',
searchTerm1: 'Aaron Johnson',
searchCriteriaFirstGroup: 'Aaron Johnson',
responseValueFirstGroup: `"displayName":"Aaron Johnson"`,
searchTerm1: ownerFullName,
searchCriteriaFirstGroup: ownerFullName,
responseValueFirstGroup: `"displayName":"${ownerFullName}"`,
searchCriteriaSecondGroup: 'Aaron Singh',
owner: true,
responseValueSecondGroup: 'Aaron Singh',
@ -81,32 +150,32 @@ export const FIELDS = {
testid: '[title="Service"]',
searchCriteriaFirstGroup: 'sample_data',
responseValueFirstGroup: `"name":"sample_data"`,
searchCriteriaSecondGroup: MYSQL.serviceName,
responseValueSecondGroup: `"name":"${MYSQL.serviceName}"`,
searchCriteriaSecondGroup: DATABASE_SERVICE_DETAILS.name,
responseValueSecondGroup: `"name":"${DATABASE_SERVICE_DETAILS.name}"`,
},
Database: {
name: 'Database',
testid: '[title="Database"]',
searchCriteriaFirstGroup: 'default',
responseValueFirstGroup: `"name":"default"`,
searchCriteriaSecondGroup: 'ecommerce_db',
responseValueSecondGroup: `"name":"ecommerce_db"`,
searchCriteriaFirstGroup: 'ecommerce_db',
responseValueFirstGroup: `"name":"ecommerce_db"`,
searchCriteriaSecondGroup: DATABASE_DETAILS.name,
responseValueSecondGroup: `"name":"${DATABASE_DETAILS.name}"`,
},
Database_Schema: {
name: 'Database Schema',
testid: '[title="Database Schema"]',
searchCriteriaFirstGroup: 'shopify',
responseValueFirstGroup: `"name":"shopify"`,
searchCriteriaSecondGroup: 'cypress_integrations_test_db',
responseValueSecondGroup: `"name":"cypress_integrations_test_db"`,
searchCriteriaSecondGroup: SCHEMA_DETAILS.name,
responseValueSecondGroup: `"name":"${SCHEMA_DETAILS.name}"`,
},
Column: {
name: 'Column',
testid: '[title="Column"]',
searchCriteriaFirstGroup: 'SKU',
responseValueFirstGroup: '"name":"SKU"',
searchCriteriaSecondGroup: 'api_client_id',
responseValueSecondGroup: '"name":"api_client_id"',
searchCriteriaFirstGroup: 'cypress_first_name',
responseValueFirstGroup: '"name":"cypress_first_name"',
searchCriteriaSecondGroup: 'cypress_user_id',
responseValueSecondGroup: '"name":"cypress_user_id"',
},
};
@ -122,42 +191,34 @@ export const OPERATOR = {
};
export const searchForField = (condition, fieldid, searchCriteria, index) => {
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('GET', '/api/v1/search/aggregate?*', 'suggestApi');
// Click on field dropdown
cy.get('.rule--field > .ant-select > .ant-select-selector')
.eq(index)
.should('be.visible')
.click();
cy.get('.rule--field > .ant-select > .ant-select-selector').eq(index).click();
// Select owner fields
cy.get(`${fieldid}`).eq(index).should('be.visible').click();
cy.get(`${fieldid}`).eq(index).click();
// Select the condition
cy.get('.rule--operator > .ant-select > .ant-select-selector')
.eq(index)
.should('be.visible')
.click();
cy.get(`[title="${condition}"]`).eq(index).should('be.visible').click();
cy.get(`[title="${condition}"]`).eq(index).click();
// Verify the condition
cy.get('.rule--operator .ant-select-selection-item')
.should('be.visible')
.should('contain', `${condition}`);
cy.get('.rule--operator .ant-select-selection-item').should(
'contain',
`${condition}`
);
// Verify the search criteria for the condition
cy.get('body').then(($body) => {
if ($body.find('.ant-col > .ant-input').length) {
cy.get('.ant-col > .ant-input')
.eq(index)
.should('be.visible')
.type(searchCriteria);
cy.get('.ant-col > .ant-input').eq(index).type(searchCriteria);
} else {
cy.get('.widget--widget > .ant-select > .ant-select-selector')
.eq(index)
.should('be.visible')
.type(searchCriteria);
// select value from dropdown
verifyResponseStatusCode('@suggestApi', 200);
cy.get(`.ant-select-dropdown [title = '${searchCriteria}']`)
.should('be.visible')
.trigger('mouseover')
.trigger('click');
}
@ -165,34 +226,10 @@ export const searchForField = (condition, fieldid, searchCriteria, index) => {
};
export const goToAdvanceSearch = () => {
interceptURL(
'GET',
'/api/v1/search/query?q=&index=*&from=0&size=10&deleted=false&query_filter=*&sort_field=_score&sort_order=desc',
'explorePage'
);
// Navigate to explore page
cy.get('[data-testid="app-bar-item-explore"]')
.should('exist')
.and('be.visible')
.click();
cy.get('[data-testid="tables-tab"]')
.scrollIntoView()
.should('exist')
.and('be.visible');
cy.wait('@explorePage').then(() => {
// Click on advance search button
cy.get('[data-testid="advance-search-button"]')
.should('be.visible')
.click();
cy.get('.ant-btn')
.contains('Reset')
.scrollIntoView()
.should('be.visible')
.click();
});
cy.get('[data-testid="app-bar-item-explore"]').click();
cy.get('[data-testid="advance-search-button"]').click();
cy.get('[data-testid="reset-btn"]').click();
};
export const checkmustPaths = (
@ -211,10 +248,11 @@ export const checkmustPaths = (
'GET',
`/api/v1/search/query?q=&index=*&from=0&size=10&deleted=false&query_filter=*must*${encodeURI(
searchCriteria
)}*&sort_field=_score&sort_order=desc`,
)}*`,
'search'
);
// //Click on apply filter
// Click on apply filter
cy.get('.ant-btn-primary').contains('Apply').click();
cy.wait('@search').should(({ request, response }) => {
@ -240,7 +278,7 @@ export const checkmust_notPaths = (
'GET',
`/api/v1/search/query?q=&index=*&from=0&size=10&deleted=false&query_filter=*must_not*${encodeURI(
searchCriteria
)}*&sort_field=_score&sort_order=desc`,
)}*`,
'search_must_not'
);
// Click on apply filter
@ -271,11 +309,11 @@ export const removeOwner = () => {
cy.get('[data-testid="owner-link"]').should('contain', 'No Owner');
};
export const addOwner = (ownerName) => {
export const addOwner = ({ ownerName, term, serviceName, entity }) => {
visitEntityDetailsPage({
term: SEARCH_ENTITY_TABLE.table_1.term,
serviceName: SEARCH_ENTITY_TABLE.table_1.serviceName,
entity: SEARCH_ENTITY_TABLE.table_1.entity,
term,
serviceName,
entity,
});
interceptURL(
@ -321,11 +359,11 @@ export const addOwner = (ownerName) => {
});
};
export const addTier = () => {
export const addTier = ({ term, serviceName, entity }) => {
visitEntityDetailsPage({
term: SEARCH_ENTITY_TABLE.table_2.term,
serviceName: SEARCH_ENTITY_TABLE.table_2.serviceName,
entity: SEARCH_ENTITY_TABLE.table_2.entity,
term,
serviceName,
entity,
});
cy.get('[data-testid="edit-tier"]')
@ -343,11 +381,11 @@ export const addTier = () => {
cy.get('[data-testid="tier-dropdown"]').should('contain', 'Tier1');
};
export const addTag = (tag) => {
export const addTag = ({ tag, term, serviceName, entity }) => {
visitEntityDetailsPage({
term: SEARCH_ENTITY_TABLE.table_3.term,
serviceName: SEARCH_ENTITY_TABLE.table_3.serviceName,
entity: SEARCH_ENTITY_TABLE.table_3.entity,
term,
serviceName,
entity,
});
cy.get('[data-testid="entity-right-panel"] [data-testid="entity-tags"]')
@ -415,7 +453,7 @@ export const checkAddGroupWithOperator = (
.should('be.visible')
.type(searchCriteria_1);
} else {
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('GET', '/api/v1/search/aggregate?*', 'suggestApi');
cy.get('.widget--widget > .ant-select > .ant-select-selector')
.eq(index_1)
.should('be.visible')
@ -468,7 +506,7 @@ export const checkAddGroupWithOperator = (
.should('be.visible')
.type(searchCriteria_2);
} else {
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('GET', '/api/v1/search/aggregate?*', 'suggestApi');
cy.get('.widget--widget > .ant-select > .ant-select-selector')
.eq(index_2)
.should('be.visible')
@ -488,14 +526,14 @@ export const checkAddGroupWithOperator = (
'GET',
`/api/v1/search/query?q=&index=*&from=0&size=10&deleted=false&query_filter=*${encodeURI(
searchCriteria_1
)}*&sort_field=_score&sort_order=desc`,
'search'
)}*`,
`search${searchCriteria_1}`
);
// Click on apply filter
cy.get('.ant-btn-primary').contains('Apply').click();
cy.wait('@search').should(({ request, response }) => {
cy.wait(`@search${searchCriteria_1}`).should(({ request, response }) => {
const resBody = JSON.stringify(response.body);
expect(request.url).to.contain(encodeURI(searchCriteria_1));
@ -539,7 +577,7 @@ export const checkAddRuleWithOperator = (
.should('be.visible')
.type(searchCriteria_1);
} else {
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('GET', '/api/v1/search/aggregate?*', 'suggestApi');
cy.get('.widget--widget > .ant-select > .ant-select-selector')
.eq(index_1)
@ -588,7 +626,7 @@ export const checkAddRuleWithOperator = (
.should('be.visible')
.type(searchCriteria_2);
} else {
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('GET', '/api/v1/search/aggregate?*', 'suggestApi');
cy.get('.widget--widget > .ant-select > .ant-select-selector')
.eq(index_2)
.should('be.visible')
@ -609,17 +647,141 @@ export const checkAddRuleWithOperator = (
'GET',
`/api/v1/search/query?q=&index=*&from=0&size=10&deleted=false&query_filter=*${filter_1}*${encodeURI(
searchCriteria_1
)}*${filter_2}*${encodeURI(response_2)}*&sort_field=_score&sort_order=desc`,
'search'
)}*${filter_2}*${encodeURI(response_2)}*`,
`search${searchCriteria_1}`
);
// Click on apply filter
cy.get('.ant-btn-primary').contains('Apply').click();
cy.wait('@search').should(({ request, response }) => {
cy.wait(`@search${searchCriteria_1}`).should(({ request, response }) => {
const resBody = JSON.stringify(response.body);
expect(request.url).to.contain(encodeURI(searchCriteria_1));
expect(resBody).to.not.include(response_2);
});
};
export const advanceSearchPreRequests = (token) => {
// Create Table hierarchy
createEntityTable({
token,
...ADVANCE_SEARCH_DATABASE_SERVICE,
});
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: USER_CREDENTIALS,
}).then((response) => {
USER_CREDENTIALS.id = response.body.id;
});
// Add owner to table 1
cy.request({
method: 'GET',
url: `/api/v1/tables/name/${ADVANCE_SEARCH_TABLES.table1.databaseSchema}.${ADVANCE_SEARCH_TABLES.table1.name}`,
headers: { Authorization: `Bearer ${token}` },
}).then((response) => {
cy.request({
method: 'PATCH',
url: `/api/v1/tables/${response.body.id}`,
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json-patch+json',
},
body: [
{
op: 'add',
path: '/owner',
value: {
id: USER_CREDENTIALS.id,
type: 'user',
},
},
],
});
});
// Add Tier to table 2
cy.request({
method: 'GET',
url: `/api/v1/tables/name/${ADVANCE_SEARCH_TABLES.table2.databaseSchema}.${ADVANCE_SEARCH_TABLES.table2.name}`,
headers: { Authorization: `Bearer ${token}` },
}).then((response) => {
cy.request({
method: 'PATCH',
url: `/api/v1/tables/${response.body.id}`,
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json-patch+json',
},
body: [
{
op: 'add',
path: '/tags/0',
value: {
name: 'Tier1',
tagFQN: 'Tier.Tier1',
labelType: 'Manual',
state: 'Confirmed',
},
},
{
op: 'add',
path: '/tags/1',
value: {
name: 'SpecialCategory',
tagFQN: 'PersonalData.SpecialCategory',
labelType: 'Manual',
state: 'Confirmed',
},
},
],
});
});
// Add Tag to table 3
cy.request({
method: 'GET',
url: `/api/v1/tables/name/${ADVANCE_SEARCH_TABLES.table3.databaseSchema}.${ADVANCE_SEARCH_TABLES.table3.name}`,
headers: { Authorization: `Bearer ${token}` },
}).then((response) => {
cy.request({
method: 'PATCH',
url: `/api/v1/tables/${response.body.id}`,
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json-patch+json',
},
body: [
{
op: 'add',
path: '/tags/0',
value: {
tagFQN: 'PersonalData.Personal',
source: 'Classification',
name: 'Personal',
description:
'Data that can be used to directly or indirectly identify a person.',
labelType: 'Manual',
state: 'Confirmed',
},
},
{
op: 'add',
path: '/tags/1',
value: {
name: 'Tier2',
tagFQN: 'Tier.Tier2',
labelType: 'Manual',
state: 'Confirmed',
},
},
],
});
});
};

View File

@ -908,20 +908,17 @@ export const editCreatedProperty = (propertyName) => {
// Fetching for edit button
cy.get(`[data-row-key="${propertyName}"]`)
.find('[data-testid="edit-button"]')
.as('editbutton');
.as('editButton');
cy.get('@editbutton').click();
cy.get('@editButton').click();
cy.get(descriptionBox)
.should('be.visible')
.clear()
.type('This is new description');
cy.get(descriptionBox).clear().type('This is new description');
interceptURL('PATCH', '/api/v1/metadata/types/*', 'checkPatchForDescription');
cy.get('[data-testid="save"]').should('be.visible').click();
cy.get('[data-testid="save"]').click();
verifyResponseStatusCode('@checkPatchForDescription', 200);
cy.wait('@checkPatchForDescription', { timeout: 10000 });
cy.get('.ant-modal-wrap').should('not.exist');
@ -934,10 +931,9 @@ export const editCreatedProperty = (propertyName) => {
export const deleteCreatedProperty = (propertyName) => {
// Fetching for delete button
cy.get(`[data-row-key="${propertyName}"]`)
.scrollIntoView()
.find('[data-testid="delete-button"]')
.as('deletebutton');
cy.get('@deletebutton').click();
.click();
// Checking property name is present on the delete pop-up
cy.get('[data-testid="body-text"]').should('contain', propertyName);
@ -1189,7 +1185,7 @@ export const addOwner = (
isGlossaryPage,
isOwnerEmpty = false
) => {
interceptURL('GET', '/api/v1/users?limit=*&isBot=false', 'getUsers');
interceptURL('GET', '/api/v1/users?limit=*&isBot=false*', 'getUsers');
if (isGlossaryPage && isOwnerEmpty) {
cy.get('[data-testid="glossary-owner-name"] > [data-testid="Add"]').click();
} else {
@ -1221,10 +1217,11 @@ export const addOwner = (
};
export const removeOwner = (entity, isGlossaryPage) => {
interceptURL('GET', '/api/v1/users?limit=*&isBot=false*', 'getUsers');
interceptURL('PATCH', `/api/v1/${entity}/*`, 'patchOwner');
cy.get('[data-testid="edit-owner"]').click();
verifyResponseStatusCode('@getUsers', 200);
cy.get('[data-testid="remove-owner"]').click();
verifyResponseStatusCode('@patchOwner', 200);
if (isGlossaryPage) {

View File

@ -11,22 +11,24 @@
* limitations under the License.
*/
import { addOwner, FIELDS, removeOwner } from '../../common/advancedSearch';
import { addOwner, removeOwner } from '../../common/advancedSearch';
import { searchAndClickOnOption } from '../../common/advancedSearchQuickFilters';
import { interceptURL, verifyResponseStatusCode } from '../../common/common';
import { QUICK_FILTERS_BY_ASSETS } from '../../constants/advancedSearchQuickFilters.constants';
describe('Initial Setup for Advanced Search Quick Filters', () => {
beforeEach(() => {
cy.login();
});
it('Pre-requisite for advance search', () => {
addOwner(FIELDS.Owner.searchCriteriaFirstGroup);
});
});
import { SEARCH_ENTITY_TABLE } from '../../constants/constants';
const ownerName = 'Aaron Johnson';
describe(`Advanced search quick filters should work properly for assets`, () => {
before(() => {
cy.login();
addOwner({ ownerName, ...SEARCH_ENTITY_TABLE.table_1 });
});
after(() => {
cy.login();
removeOwner();
});
beforeEach(() => {
cy.login();
});
@ -76,13 +78,3 @@ describe(`Advanced search quick filters should work properly for assets`, () =>
});
});
});
describe('Cleanup for Advanced Search Quick Filters', () => {
beforeEach(() => {
cy.login();
});
it('Cleanup of owners', () => {
removeOwner(FIELDS.Owner.searchCriteriaFirstGroup);
});
});

View File

@ -14,9 +14,8 @@
// The spec is related to advance search feature
import {
addOwner,
addTag,
addTier,
advanceSearchPreRequests,
ADVANCE_SEARCH_DATABASE_SERVICE,
checkAddGroupWithOperator,
checkAddRuleWithOperator,
checkmustPaths,
@ -26,271 +25,229 @@ import {
FIELDS,
OPERATOR,
} from '../../common/advancedSearch';
import {
deleteCreatedService,
interceptURL,
mySqlConnectionInput,
testServiceCreationAndIngestion,
verifyResponseStatusCode,
} from '../../common/common';
import { API_SERVICE, SERVICE_TYPE } from '../../constants/constants';
import { MYSQL } from '../../constants/service.constants';
import { hardDeleteService } from '../../common/entityUtils';
import { USER_CREDENTIALS } from '../../constants/SearchIndexDetails.constants';
import { SERVICE_CATEGORIES } from '../../constants/service.constants';
const service_name = MYSQL.serviceName;
describe.skip('pre-requests for test case', () => {
beforeEach(() => {
describe('Advance search', () => {
before(() => {
cy.login();
});
it('Pre-requisite for advance search', () => {
addOwner(FIELDS.Owner.searchCriteriaFirstGroup);
addTier(FIELDS.Tiers.searchCriteriaFirstGroup);
addTag(FIELDS.Tags.createTagName);
});
it('Mysql ingestion', () => {
interceptURL(
'GET',
'api/v1/teams/name/Organization?fields=*',
'getSettingsPage'
);
cy.get('[data-testid="app-bar-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(MYSQL.database)
.should('be.visible')
.click();
verifyResponseStatusCode('@getServiceList', 200);
cy.get('[data-testid="add-service-button"]').should('be.visible').click();
// 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');
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(Cypress.env('mysqlDatabaseSchema'));
};
testServiceCreationAndIngestion({
serviceType: MYSQL.serviceType,
connectionInput: mySqlConnectionInput,
addIngestionInput,
serviceName: service_name,
serviceCategory: SERVICE_TYPE.Database,
});
});
});
describe.skip('Single filed search', () => {
beforeEach(() => {
cy.login();
});
Object.values(FIELDS).forEach((field) => {
it(`Verify advance search results for ${field.name} field and all condition`, () => {
Object.values(CONDITIONS_MUST).forEach((condition) => {
checkmustPaths(
condition.name,
field.testid,
field.searchCriteriaFirstGroup,
0,
field.responseValueFirstGroup
);
});
Object.values(CONDITIONS_MUST_NOT).forEach((condition) => {
checkmust_notPaths(
condition.name,
field.testid,
field.searchCriteriaFirstGroup,
0,
field.responseValueFirstGroup
);
});
cy.getAllLocalStorage().then((data) => {
const token = Object.values(data)[0].oidcIdToken;
advanceSearchPreRequests(token);
});
});
after(() => {
Cypress.session.clearAllSavedSessions();
});
});
describe.skip('Group search', () => {
beforeEach(() => {
cy.login();
});
cy.getAllLocalStorage().then((data) => {
const token = Object.values(data)[0].oidcIdToken;
Object.values(OPERATOR).forEach((operator) => {
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.equalTo.name} and ${CONDITIONS_MUST_NOT.notEqualTo.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddGroupWithOperator(
CONDITIONS_MUST.equalTo.name,
CONDITIONS_MUST_NOT.notEqualTo.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.equalTo.filter,
CONDITIONS_MUST_NOT.notEqualTo.filter,
field.responseValueFirstGroup,
val
);
hardDeleteService({
token,
serviceFqn: ADVANCE_SEARCH_DATABASE_SERVICE.service.name,
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
});
});
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.anyIn.name} and ${CONDITIONS_MUST_NOT.notIn.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddGroupWithOperator(
CONDITIONS_MUST.anyIn.name,
CONDITIONS_MUST_NOT.notIn.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.anyIn.filter,
CONDITIONS_MUST_NOT.notIn.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.contains.name} and ${CONDITIONS_MUST_NOT.notContains.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
checkAddGroupWithOperator(
CONDITIONS_MUST.contains.name,
CONDITIONS_MUST_NOT.notContains.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.contains.filter,
CONDITIONS_MUST_NOT.notContains.filter,
field.responseValueFirstGroup,
val
);
// Delete created user
cy.request({
method: 'DELETE',
url: `/api/v1/users/${USER_CREDENTIALS.id}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
after(() => {
Cypress.session.clearAllSavedSessions();
});
});
describe.skip('Search with additional rule', () => {
beforeEach(() => {
cy.login();
});
Object.values(OPERATOR).forEach((operator) => {
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.equalTo.name} and ${CONDITIONS_MUST_NOT.notEqualTo.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddRuleWithOperator(
CONDITIONS_MUST.equalTo.name,
CONDITIONS_MUST_NOT.notEqualTo.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.equalTo.filter,
CONDITIONS_MUST_NOT.notEqualTo.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.anyIn.name} and ${CONDITIONS_MUST_NOT.notIn.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddRuleWithOperator(
CONDITIONS_MUST.anyIn.name,
CONDITIONS_MUST_NOT.notIn.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.anyIn.filter,
CONDITIONS_MUST_NOT.notIn.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.contains.name} and ${CONDITIONS_MUST_NOT.notContains.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
checkAddRuleWithOperator(
CONDITIONS_MUST.contains.name,
CONDITIONS_MUST_NOT.notContains.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.contains.filter,
CONDITIONS_MUST_NOT.notContains.filter,
field.responseValueFirstGroup,
val
);
});
});
});
it('Delete Created Service', () => {
deleteCreatedService(
MYSQL.database,
service_name,
API_SERVICE.databaseServices
);
});
after(() => {
Cypress.session.clearAllSavedSessions();
describe('Single filed search', () => {
beforeEach(() => {
cy.login();
});
Object.values(FIELDS).forEach((field) => {
it(`Verify advance search results for ${field.name} field and all condition`, () => {
Object.values(CONDITIONS_MUST).forEach((condition) => {
checkmustPaths(
condition.name,
field.testid,
field.searchCriteriaFirstGroup,
0,
field.responseValueFirstGroup
);
});
Object.values(CONDITIONS_MUST_NOT).forEach((condition) => {
checkmust_notPaths(
condition.name,
field.testid,
field.searchCriteriaFirstGroup,
0,
field.responseValueFirstGroup
);
});
});
});
after(() => {
cy.logout();
Cypress.session.clearAllSavedSessions();
});
});
describe('Group search', () => {
beforeEach(() => {
cy.login();
});
Object.values(OPERATOR).forEach((operator) => {
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.equalTo.name} and ${CONDITIONS_MUST_NOT.notEqualTo.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddGroupWithOperator(
CONDITIONS_MUST.equalTo.name,
CONDITIONS_MUST_NOT.notEqualTo.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.equalTo.filter,
CONDITIONS_MUST_NOT.notEqualTo.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.anyIn.name} and ${CONDITIONS_MUST_NOT.notIn.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddGroupWithOperator(
CONDITIONS_MUST.anyIn.name,
CONDITIONS_MUST_NOT.notIn.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.anyIn.filter,
CONDITIONS_MUST_NOT.notIn.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add group functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.contains.name} and ${CONDITIONS_MUST_NOT.notContains.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
checkAddGroupWithOperator(
CONDITIONS_MUST.contains.name,
CONDITIONS_MUST_NOT.notContains.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.contains.filter,
CONDITIONS_MUST_NOT.notContains.filter,
field.responseValueFirstGroup,
val
);
});
});
});
after(() => {
cy.logout();
Cypress.session.clearAllSavedSessions();
});
});
describe('Search with additional rule', () => {
beforeEach(() => {
cy.login();
});
Object.values(OPERATOR).forEach((operator) => {
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.equalTo.name} and ${CONDITIONS_MUST_NOT.notEqualTo.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddRuleWithOperator(
CONDITIONS_MUST.equalTo.name,
CONDITIONS_MUST_NOT.notEqualTo.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.equalTo.filter,
CONDITIONS_MUST_NOT.notEqualTo.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.anyIn.name} and ${CONDITIONS_MUST_NOT.notIn.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
if (field.owner) {
val = field.responseValueSecondGroup;
}
checkAddRuleWithOperator(
CONDITIONS_MUST.anyIn.name,
CONDITIONS_MUST_NOT.notIn.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.anyIn.filter,
CONDITIONS_MUST_NOT.notIn.filter,
field.responseValueFirstGroup,
val
);
});
});
it(`Verify Add Rule functionality for All with ${operator.name} operator & condition ${CONDITIONS_MUST.contains.name} and ${CONDITIONS_MUST_NOT.notContains.name} `, () => {
Object.values(FIELDS).forEach((field) => {
let val = field.searchCriteriaSecondGroup;
checkAddRuleWithOperator(
CONDITIONS_MUST.contains.name,
CONDITIONS_MUST_NOT.notContains.name,
field.testid,
field.searchCriteriaFirstGroup,
field.searchCriteriaSecondGroup,
0,
1,
operator.index,
CONDITIONS_MUST.contains.filter,
CONDITIONS_MUST_NOT.notContains.filter,
field.responseValueFirstGroup,
val
);
});
});
});
after(() => {
cy.logout();
Cypress.session.clearAllSavedSessions();
});
});
});

View File

@ -210,18 +210,14 @@ describe('SearchIndexDetails page should work properly for data consumer role',
});
// Edit domain option should not be available
cy.get(`[data-testid="entity-page-header"]`).then(($body) => {
const editDomain = $body.find(`[data-testid="add-domain"]`);
expect(editDomain.length).to.equal(0);
});
cy.get(
`[data-testid="entity-page-header"] [data-testid="add-domain"]`
).should('not.exist');
// Manage button should not be visible on service page
cy.get('[data-testid="asset-header-btn-group"]').then(($body) => {
const manageButton = $body.find(`[data-testid="manage-button"]`);
expect(manageButton.length).to.equal(0);
});
cy.get(
'[data-testid="asset-header-btn-group"] [data-testid="manage-button"]'
).should('not.exist');
performCommonOperations();
});
@ -376,31 +372,17 @@ describe('SearchIndexDetails page should work properly for admin role', () => {
cy.get('[data-testid="deleted-badge"]').should('be.visible');
// Edit options for domain owner and tier should not be visible
cy.get(`[data-testid="entity-page-header"]`).then(($body) => {
const editDomain = $body.find(`[data-testid="add-domain"]`);
const editOwner = $body.find(`[data-testid="edit-owner"]`);
const editTier = $body.find(`[data-testid="edit-tier"]`);
expect(editDomain.length).to.equal(0);
expect(editOwner.length).to.equal(0);
expect(editTier.length).to.equal(0);
});
cy.get('[data-testid="add-domain"]').should('not.exist');
cy.get('[data-testid="edit-owner"]').should('not.exist');
cy.get('[data-testid="edit-tier"]').should('not.exist');
// Edit description button should not be visible
cy.get(`[data-testid="asset-description-container"]`).then(($body) => {
const editDescription = $body.find(`[data-testid="edit-description"]`);
expect(editDescription.length).to.equal(0);
});
cy.get('[data-testid="edit-description"]').should('not.exist');
// Edit tags button should not be visible
cy.get(
`[data-testid="entity-right-panel"] [data-testid="tags-container"]`
).then(($body) => {
const addTag = $body.find(`[data-testid="add-tag"]`);
expect(addTag.length).to.equal(0);
});
`[data-testid="entity-right-panel"] [data-testid="tags-container"] [data-testid="add-tag"]`
).should('not.exist');
// Edit description and tags button for fields should not be visible
cy.get(

View File

@ -91,14 +91,21 @@ export const AdvancedSearchModal: FunctionComponent<Props> = ({
destroyOnClose
className="advanced-search-modal"
closeIcon={null}
data-testid="advanced-search-modal"
footer={
<Space className="justify-between w-full">
<Button className="float-right" size="small" onClick={onReset}>
<Button
className="float-right"
data-testid="reset-btn"
size="small"
onClick={onReset}>
{t('label.reset')}
</Button>
<div>
<Button onClick={onCancel}>{t('label.cancel')}</Button>
<Button type="primary" onClick={onSubmit}>
<Button data-testid="cancel-btn" onClick={onCancel}>
{t('label.cancel')}
</Button>
<Button data-testid="apply-btn" type="primary" onClick={onSubmit}>
{t('label.apply')}
</Button>
</div>