2022-08-23 19:21:06 +05:30
|
|
|
/*
|
|
|
|
* Copyright 2021 Collate
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-11-01 09:46:01 +05:30
|
|
|
import {
|
|
|
|
addCustomPropertiesForEntity,
|
|
|
|
deleteCreatedProperty,
|
|
|
|
editCreatedProperty,
|
|
|
|
interceptURL,
|
|
|
|
login,
|
|
|
|
verifyResponseStatusCode
|
|
|
|
} from '../../common/common';
|
2022-09-23 16:05:54 +05:30
|
|
|
import { ENTITIES, LOGIN } from '../../constants/constants';
|
2022-08-23 19:21:06 +05:30
|
|
|
|
|
|
|
describe('Custom Properties should work properly', () => {
|
2022-09-29 15:21:33 +05:30
|
|
|
before(() => {
|
|
|
|
cy.clearLocalStorageSnapshot();
|
2022-09-23 16:05:54 +05:30
|
|
|
login(LOGIN.username, LOGIN.password);
|
2022-08-23 19:21:06 +05:30
|
|
|
cy.goToHomePage();
|
2022-09-29 15:21:33 +05:30
|
|
|
cy.saveLocalStorage('localstorage');
|
|
|
|
});
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.log('Restoring local storage snapshot');
|
|
|
|
cy.restoreLocalStorage('localstorage');
|
|
|
|
cy.clickOnLogo();
|
|
|
|
interceptURL('GET', '/api/v1/users*', 'settingsPage');
|
2022-08-23 19:21:06 +05:30
|
|
|
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
|
2022-09-29 15:21:33 +05:30
|
|
|
verifyResponseStatusCode('@settingsPage', 200);
|
|
|
|
cy.get('[data-testid="settings-left-panel"]').should('be.visible');
|
2022-08-23 19:21:06 +05:30
|
|
|
});
|
|
|
|
|
2022-09-29 15:21:33 +05:30
|
|
|
Object.values(ENTITIES).forEach((entity) => {
|
|
|
|
it(`Add Integer custom property for ${entity.name} Entities`, () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/metadata/types/name/${entity.name}*`,
|
|
|
|
'getEntity'
|
|
|
|
);
|
2022-10-03 18:49:51 +05:30
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
//Selecting the entity
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-25 16:23:25 +05:30
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
//Getting the property
|
|
|
|
const propertyName = addCustomPropertiesForEntity(
|
|
|
|
entity,
|
|
|
|
'integer',
|
2022-09-29 15:21:33 +05:30
|
|
|
entity.integerValue,
|
2022-11-01 09:46:01 +05:30
|
|
|
entity.entityObj
|
2022-08-23 19:21:06 +05:30
|
|
|
);
|
|
|
|
//Navigating back to custom properties page
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
|
|
|
editCreatedProperty(propertyName);
|
|
|
|
|
|
|
|
deleteCreatedProperty(propertyName);
|
|
|
|
});
|
2022-10-03 18:49:51 +05:30
|
|
|
});
|
2022-11-01 09:46:01 +05:30
|
|
|
|
2022-09-29 15:21:33 +05:30
|
|
|
Object.values(ENTITIES).forEach((entity) => {
|
|
|
|
it(`Add String custom property for ${entity.name} Entities`, () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/metadata/types/name/${entity.name}*`,
|
|
|
|
'getEntity'
|
|
|
|
);
|
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
//Selecting the entity
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
const propertyName = addCustomPropertiesForEntity(
|
|
|
|
entity,
|
|
|
|
'string',
|
2022-09-29 15:21:33 +05:30
|
|
|
entity.stringValue,
|
|
|
|
entity.entityObj
|
2022-08-23 19:21:06 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
//Navigating back to custom properties page
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
//Selecting the entity
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
|
|
|
editCreatedProperty(propertyName);
|
|
|
|
|
|
|
|
deleteCreatedProperty(propertyName);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-09-29 15:21:33 +05:30
|
|
|
Object.values(ENTITIES).forEach((entity) => {
|
|
|
|
it(`Add Markdown custom property for ${entity.name} Entities`, () => {
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
`/api/v1/metadata/types/name/${entity.name}*`,
|
|
|
|
'getEntity'
|
|
|
|
);
|
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
//Selecting the entity
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
|
|
|
|
2022-08-23 19:21:06 +05:30
|
|
|
const propertyName = addCustomPropertiesForEntity(
|
|
|
|
entity,
|
|
|
|
'markdown',
|
2022-09-29 15:21:33 +05:30
|
|
|
entity.markdownValue,
|
|
|
|
entity.entityObj
|
2022-08-23 19:21:06 +05:30
|
|
|
);
|
|
|
|
//Navigating back to custom properties page
|
|
|
|
cy.get('[data-testid="appbar-item-settings"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@getEntity', 200);
|
2022-08-23 19:21:06 +05:30
|
|
|
|
|
|
|
editCreatedProperty(propertyName);
|
|
|
|
|
|
|
|
deleteCreatedProperty(propertyName);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|