Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support in env setup glue for fetching device details dynamically #188

Merged
merged 27 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91083ee
added support in env setup glue for fetching device details dynamically
anjalimukundan Aug 6, 2024
e4e2ae7
addressed review comments for error handling msg
anjalimukundan Aug 7, 2024
03660a0
added support in fcs to fetch device details dynamically
anjalimukundan Aug 9, 2024
00a8bd7
addressed review comments
anjalimukundan Aug 12, 2024
70ae3a5
updated deviceContentValidation
anjalimukundan Aug 12, 2024
ddb6a7f
added documentation for deviceContentValidation
anjalimukundan Aug 12, 2024
765a8f8
updated constant file
anjalimukundan Aug 13, 2024
034e7d5
updated constants file
anjalimukundan Aug 13, 2024
a574958
updated validations.js
anjalimukundan Aug 13, 2024
25bc6c9
resolved conflicts
anjalimukundan Aug 13, 2024
9aa65a2
removed deviceContentValidation check
anjalimukundan Aug 13, 2024
3dac48b
updated validations.js
anjalimukundan Aug 13, 2024
61fdbc3
removed fetch_device_details env
anjalimukundan Aug 14, 2024
1325275
updated validations.md file with eg:
anjalimukundan Aug 14, 2024
4d17a6d
Merge branch 'dev' into fetch_device_details
anjalimukundan Aug 19, 2024
64c28ea
updated the dynamic device details fetch flow for deviceContentValida…
anjalimukundan Aug 19, 2024
05aac2e
added comments for each if condition in validations.js
anjalimukundan Aug 19, 2024
6ee0c9b
resolved conflicts
anjalimukundan Aug 20, 2024
e8d42e7
addressed review comments for dynamic_details_fetch
anjalimukundan Aug 20, 2024
4db89d6
updated readme.doc
anjalimukundan Aug 21, 2024
cd359a1
Merge branch 'dev' into fetch_device_details
anjalimukundan Aug 21, 2024
4bff988
updated validations.md file with dynamic details fetch doc
anjalimukundan Aug 21, 2024
bf5710f
updated validations.md file
anjalimukundan Aug 21, 2024
c5585fb
updated readme file with fetchDeviceDetails override function
anjalimukundan Aug 21, 2024
6ccbf02
addressed review comments for documentation
anjalimukundan Aug 22, 2024
c9a7083
Merge branch 'dev' into fetch_device_details
anjalimukundan Aug 26, 2024
c0be880
added dynamicContentValidations.md
anjalimukundan Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cypress/support/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module.exports = {
DEVICE_FIRMWARE: 'Device Firmware',
DEVICE_HDCP: 'device.hdcp',
DEVICE_HDR: 'device.hdr',
DEVICE_ID: 'device.id',
DEVICE_IP: 'deviceIp',
DEVICE_MAC: 'deviceMac',
DEVICE_MAC_UNAVAILABLE: 'Device MAC unavailable',
Expand All @@ -99,6 +100,7 @@ module.exports = {
DEVICE_PLATFORM: 'device.platform',
DEVICE_VIDEORESOLUTION: 'device.videoResolution',
DISCOVERY_LAUNCH: 'discovery.launch',
DYNAMIC_DEVICE_DETAILS_MODULES: ['Device'],
EMAIL: 'email',
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
ENV_PLATFORM_SDK_VERSION: 'platformSdkVersion',
ENV_PLATFORM: 'platform',
Expand Down
17 changes: 17 additions & 0 deletions cypress/support/step_definitions/testSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ Given('the environment has been set up for {string} tests', (test) => {
if (Cypress.env(CONSTANTS.TEST_TYPE).includes('rpc-Only')) {
Cypress.env(CONSTANTS.IS_RPC_ONLY, true);
}
// fetch device details dynamically
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
if (Cypress.env(CONSTANTS.FETCH_DEVICE_DETAILS_DYNAMICALLY_FLAG)) {
if (CONSTANTS.DYNAMIC_DEVICE_DETAILS_MODULES.includes(Cypress.env(CONSTANTS.TEST_TYPE))) {
cy.getDeviceData(CONSTANTS.DEVICE_ID, {}, CONSTANTS.ACTION_CORE.toLowerCase()).then(
(response) => {
if (response) {
const method = CONSTANTS.REQUEST_OVERRIDE_CALLS.FETCHDEVICEDETAILS;
const requestMap = {
method: method,
params: response,
};
cy.sendMessagetoPlatforms(requestMap);
}
}
);
}
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
}
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
}
});

Expand Down
11 changes: 11 additions & 0 deletions cypress/support/step_definitions/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ Given(
const expectingError = item.expectingError;
const isNullCase = item.isNullCase || false;

neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
for (let i = 0; i < contentObject.data.length; i++) {
if (contentObject.data[i].validations[0].mode == CONSTANTS.DEVICE_CONTENT_VALIDATION) {
const type = contentObject.data[i].validations[0].type;
if (Cypress.env(CONSTANTS.DEVICE_DATA).hasOwnProperty(type)) {
contentObject.data[i].validations[0].type = Cypress.env(CONSTANTS.DEVICE_DATA)[
type
];
}
}
}
anjalimukundan marked this conversation as resolved.
Show resolved Hide resolved

// If the app ID is not passed from the feature, the default app ID will be retrieved.
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
appId = !appId
? UTILS.getEnvVariable(CONSTANTS.THIRD_PARTY_APP_ID)
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/step_definitions/validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,7 @@ While validating, if a key is present in both fcs-validation jsons (eg: cypress/
}
]
}

# Device Content Validation

For deviceContentValidation, the source of truth is fetched from an external API, which is dependent on the configuration module or platform on which we are testing. For the validation part, an override module called "fetchDeviceDetails" is expected to be in configModule to fetch the device details with the corresponding APIs mentioned for each config. DeviceId is passed from fcs to this override module as the only parameter, which is later used for fetching device details in the "configHelper" module.