Skip to content

Commit

Permalink
Firebolt 2.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eswar2103 committed Feb 11, 2025
1 parent a24ed8b commit b149296
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
5 changes: 2 additions & 3 deletions cypress/support/appObjectConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class eventObject {
this.context = context;
this.eventListenerResponse = response.eventListenerResponse;
this.eventListenerSchemaResponse = response.eventListenerSchemaResult;
this.eventObjectId = response.eventListenerId;
this.expectedResult = expectedResult;
this.eventResponse = null;
this.eventSchemaResult = null;
Expand All @@ -51,10 +50,10 @@ class eventObject {
// Function to update the event response in event object.
setEventResponseData(response, isNullCase) {
if (
(response && response.eventResponse && response.eventResponse[this.eventObjectId] != null) ||
(response && response.eventResponse && response.eventResponse[this.eventName] != null) ||
(response &&
response.eventResponse != null &&
!response.eventResponse.hasOwnProperty(this.eventObjectId)) ||
!response.eventResponse.hasOwnProperty(this.eventName)) ||
isNullCase === true
) {
this.eventResponse = response.eventResponse;
Expand Down
3 changes: 1 addition & 2 deletions cypress/support/cypress-commands/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,6 @@ Cypress.Commands.add('sendMessageToPlatformOrApp', (target, requestData, task) =
if (task == CONSTANTS.TASK.REGISTEREVENT) {
if (response && response.result && response.result.hasOwnProperty(CONSTANTS.LISTENING)) {
const eventResponse = {
eventListenerId: response.result.event + '-' + response.id,
eventListenerResponse: response.result,
};
response.result = eventResponse;
Expand Down Expand Up @@ -1407,7 +1406,7 @@ Cypress.Commands.add('methodOrEventResponseValidation', (validationType, request
} else {
cy.then(() => {
if (validationType == CONSTANTS.EVENT) {
const eventName = methodOrEventObject.eventObjectId;
const eventName = methodOrEventObject.eventName;
let eventResponse;
if (appId === UTILS.getEnvVariable(CONSTANTS.FIRST_PARTY_APPID)) {
const requestMap = {
Expand Down
38 changes: 38 additions & 0 deletions cypress/support/cypress-support/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ export default function (module) {
const flattedOpenRpc = UTILS.getEnvVariable(CONSTANTS.DEREFERENCE_OPENRPC);
const unflattedOpenRpc = flatted.parse(flattedOpenRpc);
Cypress.env(CONSTANTS.DEREFERENCE_OPENRPC, unflattedOpenRpc);

// Check if the incoming SDK version is 2.0.0 or above and replace the widget in device with 2.0 changes.
// const pattern = /(2|\d{2,})\.\d+\.\d+/;
// if (
// UTILS.getEnvVariable(CONSTANTS.SDK_VERSION, false) &&
// pattern.test(UTILS.getEnvVariable(CONSTANTS.SDK_VERSION))
// ) {
// const requestMap = {
// method: 'fcs.<function>',
// params: null,
// };
// cy.sendMessagetoPlatforms(requestMap).then((response) => {
// console.log('response------------------', response);
// });
// }
});

// beforeEach
Expand Down Expand Up @@ -208,6 +223,29 @@ export default function (module) {
});
});

afterEach(() => {
// Make a clear all event listeners call and clear the deregister the events
// UTILS.fireLog.info("Call to first party app to clear all event listeners");
// Need to see what method name can be passed here, instead of device.name.
const requestMap = { method: 'call.clearEvent', params: null, task: 'clearAllListeners' };
cy.sendMessagetoPlatforms(requestMap)
.then((response) => {
fireLog.info(`Response from firstParty app: ${JSON.stringify(response)}`);
})
.then(() => {
const appId = UTILS.getEnvVariable(CONSTANTS.THIRD_PARTY_APP_ID);
const requestTopic = UTILS.getTopic(appId);
const responseTopic = UTILS.getTopic(appId, CONSTANTS.SUBSCRIBE);
const intent = UTILS.createIntentMessage('clearAllListeners', {});
cy.sendMessagetoApp(requestTopic, responseTopic, intent).then((response) => {
fireLog.info(
`Response from ${Cypress.env(CONSTANTS.THIRD_PARTY_APP_ID)}: ${JSON.stringify(response)}`
);
});
});
Cypress.env(CONSTANTS.GLOBAL_EVENT_OBJECT_LIST, []);
});

// after All
after(() => {
(async () => {
Expand Down

0 comments on commit b149296

Please sign in to comment.