mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +00:00
test: add updateJWTTokenExpiryTime util (#16606)
This commit is contained in:
parent
95e5177939
commit
8c173bed6a
@ -11,6 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { interceptURL } from '../common';
|
import { interceptURL } from '../common';
|
||||||
|
import { getToken } from './LocalStorage';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try Performing login with the given username and password.
|
* Try Performing login with the given username and password.
|
||||||
@ -46,3 +47,25 @@ export const performLogin = (username, password) => {
|
|||||||
cy.get('.ant-btn').contains('Login').should('be.visible').click();
|
cy.get('.ant-btn').contains('Login').should('be.visible').click();
|
||||||
cy.wait('@loginUser');
|
cy.wait('@loginUser');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const updateJWTTokenExpiryTime = (expiryTime: number) => {
|
||||||
|
cy.getAllLocalStorage().then((data) => {
|
||||||
|
const token = getToken(data);
|
||||||
|
|
||||||
|
cy.request({
|
||||||
|
method: 'PUT',
|
||||||
|
url: `/api/v1/system/settings`,
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
body: {
|
||||||
|
config_type: 'loginConfiguration',
|
||||||
|
config_value: {
|
||||||
|
maxLoginFailAttempts: 3,
|
||||||
|
accessBlockTime: 600,
|
||||||
|
jwtTokenExpiryTime: expiryTime,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).then((response) => {
|
||||||
|
expect(response.status).to.eq(200);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
@ -831,3 +831,8 @@ export const ID: Record<
|
|||||||
api: '/api/v1/services/storageServices?*',
|
api: '/api/v1/services/storageServices?*',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const JWT_EXPIRY_TIME_MAP = {
|
||||||
|
'1 hour': 3600,
|
||||||
|
'2 hours': 7200,
|
||||||
|
};
|
||||||
|
@ -37,7 +37,8 @@ import {
|
|||||||
visitEntityDetailsPage,
|
visitEntityDetailsPage,
|
||||||
} from '../../common/Utils/Entity';
|
} from '../../common/Utils/Entity';
|
||||||
import { getToken } from '../../common/Utils/LocalStorage';
|
import { getToken } from '../../common/Utils/LocalStorage';
|
||||||
import { ENTITIES, uuid } from '../../constants/constants';
|
import { updateJWTTokenExpiryTime } from '../../common/Utils/Login';
|
||||||
|
import { ENTITIES, JWT_EXPIRY_TIME_MAP, uuid } from '../../constants/constants';
|
||||||
import { EntityType, SidebarItem } from '../../constants/Entity.interface';
|
import { EntityType, SidebarItem } from '../../constants/Entity.interface';
|
||||||
import { DATABASE_SERVICE } from '../../constants/EntityConstant';
|
import { DATABASE_SERVICE } from '../../constants/EntityConstant';
|
||||||
import { GLOSSARY_1 } from '../../constants/glossary.constant';
|
import { GLOSSARY_1 } from '../../constants/glossary.constant';
|
||||||
@ -75,6 +76,15 @@ const customPropertyValue = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
describe('Custom Properties should work properly', { tags: 'Settings' }, () => {
|
describe('Custom Properties should work properly', { tags: 'Settings' }, () => {
|
||||||
|
before(() => {
|
||||||
|
cy.login();
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['2 hours']);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['1 hour']);
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
});
|
});
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
import EntityClass from '../../common/Entities/EntityClass';
|
import EntityClass from '../../common/Entities/EntityClass';
|
||||||
import { CustomPropertyTypeByName } from '../../common/Utils/CustomProperty';
|
import { CustomPropertyTypeByName } from '../../common/Utils/CustomProperty';
|
||||||
|
import { updateJWTTokenExpiryTime } from '../../common/Utils/Login';
|
||||||
|
import { JWT_EXPIRY_TIME_MAP } from '../../constants/constants';
|
||||||
import DatabaseClass from './../../common/Entities/DatabaseClass';
|
import DatabaseClass from './../../common/Entities/DatabaseClass';
|
||||||
import DatabaseSchemaClass from './../../common/Entities/DatabaseSchemaClass';
|
import DatabaseSchemaClass from './../../common/Entities/DatabaseSchemaClass';
|
||||||
import StoreProcedureClass from './../../common/Entities/StoredProcedureClass';
|
import StoreProcedureClass from './../../common/Entities/StoredProcedureClass';
|
||||||
@ -35,12 +37,14 @@ describe('Database hierarchy details page', { tags: 'DataAssets' }, () => {
|
|||||||
before(() => {
|
before(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['2 hours']);
|
||||||
EntityClass.preRequisitesForTests();
|
EntityClass.preRequisitesForTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['1 hour']);
|
||||||
EntityClass.postRequisitesForTests();
|
EntityClass.postRequisitesForTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ import MlModelClass from '../../common/Entities/MlModelClass';
|
|||||||
import PipelineClass from '../../common/Entities/PipelineClass';
|
import PipelineClass from '../../common/Entities/PipelineClass';
|
||||||
import SearchIndexClass from '../../common/Entities/SearchIndexClass';
|
import SearchIndexClass from '../../common/Entities/SearchIndexClass';
|
||||||
import TopicClass from '../../common/Entities/TopicClass';
|
import TopicClass from '../../common/Entities/TopicClass';
|
||||||
|
import { updateJWTTokenExpiryTime } from '../../common/Utils/Login';
|
||||||
|
import { JWT_EXPIRY_TIME_MAP } from '../../constants/constants';
|
||||||
import { CustomPropertySupportedEntityList } from '../../constants/CustomProperty.constant';
|
import { CustomPropertySupportedEntityList } from '../../constants/CustomProperty.constant';
|
||||||
import DashboardClass from './../../common/Entities/DashboardClass';
|
import DashboardClass from './../../common/Entities/DashboardClass';
|
||||||
import { CustomPropertyTypeByName } from './../../common/Utils/CustomProperty';
|
import { CustomPropertyTypeByName } from './../../common/Utils/CustomProperty';
|
||||||
@ -44,12 +46,14 @@ describe('Entity detail page', { tags: 'DataAssets' }, () => {
|
|||||||
before(() => {
|
before(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['2 hours']);
|
||||||
EntityClass.preRequisitesForTests();
|
EntityClass.preRequisitesForTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
|
|
||||||
|
updateJWTTokenExpiryTime(JWT_EXPIRY_TIME_MAP['1 hour']);
|
||||||
EntityClass.postRequisitesForTests();
|
EntityClass.postRequisitesForTests();
|
||||||
});
|
});
|
||||||
entities.forEach((entity) => {
|
entities.forEach((entity) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user