Skip to content

Commit

Permalink
feat: Modify all test cases to use static v2 objects with v1 glue code (
Browse files Browse the repository at this point in the history
#208)

Co-authored-by: anjalimukundan <[email protected]>
  • Loading branch information
PreethiMaai and anjalimukundan authored Sep 20, 2024
1 parent 0419a81 commit b1aa5b4
Show file tree
Hide file tree
Showing 20 changed files with 2,938 additions and 395 deletions.
18 changes: 9 additions & 9 deletions cypress/TestCases/FireboltCertification/Account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Feature: Account
And 3rd party 'certification' app is launched

@sdk @transport
Scenario Outline: Account.<method> - Positive Scenario: <Scenario>
When '3rd party app' invokes the 'Firebolt' API to '<API_Key>'
Then 'Firebolt' platform responds with '<Validation_key>'

Scenario Outline: Account.<Method> - Positive Scenario: <Scenario>
Given we test the 'ACCOUNT_ID_UID' getters and setters '<Method>'
When '3rd party app' invokes the 'Firebolt' get API
Then 'Firebolt' platform responds with '<Validation_key>'
Examples:
| Scenario | API_Key | Validation_key | method |
| Validate account ID | fetch account ID | account id | id |
| Validate account UID | fetch account UID | account uid | uid |
| Scenario | Method | Validation_key |
| Validate account ID | id | account id |
| Validate account UID | uid | account uid |

@sdk @transport @notSupported @requiresPlatformImplementation
Scenario Outline: Account.<method> - Negative Scenario: <Scenario>
Expand All @@ -24,5 +24,5 @@ Feature: Account
| Scenario | API_Key | Validation_key | method |
| Account ID Device not provisioned | fetch account ID when device is not provisioned | invalid parameter error for account id | id |
| Account UID Device not provisioned | fetch account UID when device is not provisioned | invalid parameter error for account uid | uid |
| Account ID Account retrieval attempt | fetch account ID when account is not provisioned | invalid parameter error for account id | id |
| Account UID Account retrieval attempt | fetch account UID when account is not provisioned | invalid parameter error for account uid | uid |
| Account ID Account retrieval attempt | fetch account ID when device is not provisioned | invalid parameter error for account id | id |
| Account UID Account retrieval attempt | fetch account UID when device is not provisioned | invalid parameter error for account uid | uid |
30 changes: 18 additions & 12 deletions cypress/TestCases/FireboltCertification/Device.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ Feature: Device

@sdk @transport
Scenario Outline:Device.<Method> - Positive Scenario: <Scenario>
When '3rd party app' invokes the 'Firebolt' API to '<API_Key>'
Given we test the 'DEVICE' getters and setters '<Method>'
When '3rd party app' invokes the 'Firebolt' get API
Then 'Firebolt' platform responds with '<Validation_Key>'

Examples:
| Scenario | API_Key | Validation_Key | Method |
| Validate Device id | fetch device id | expected device id | id |
| Validate Device distributor | fetch device distributor | expected device distributor | distributor |
| Validate Device platform | fetch device platform | expected device platform | platform |
| Validate Device uid | fetch device uid | expected device uid | uid |
| Validate Device type | fetch device type | expected device type | type |
| Validate Device model | fetch device model | expected device model | model |
| Validate Device sku | fetch device sku | expected device sku | sku |
| Validate Device make | fetch device make | expected device make | make |
| Scenario | Method | Validation_Key |
| Validate Device id | id | expected device id |
| Validate Device distributor | distributor | expected device distributor |
| Validate Device uid | uid | expected device uid |
| Validate Device type | type | expected device type |
| Validate Device model | model | expected device model |
| Validate Device sku | sku | expected device sku |
| Validate Device make | make | expected device make |

@sdk @transport
Scenario: Device.platform - Positive Scenario: Validate device platform
When '3rd party app' invokes the 'Firebolt' API to 'fetch device platform'
Then 'Firebolt' platform responds with 'expected device platform'

@sdk @transport
Scenario: Device.name - Positive Scenario: Validate device name change
Expand All @@ -32,7 +38,8 @@ Feature: Device

@regression @sdk @transport
Scenario Outline: Device.<Method> - Positive Scenario: <Scenario>
When '3rd party app' invokes the 'Firebolt' API to '<API_Key>'
Given we test the 'DEVICE' getters and setters '<Method>' to '{}'
When '3rd party app' invokes the 'Firebolt' get API
Then 'Firebolt' platform responds with '<validation_key>'

Examples:
Expand Down Expand Up @@ -68,4 +75,3 @@ Feature: Device
| Validate network_Ethernet_disconnected | device network as ethernet disconnected | onNetworkChanged with ethernet disconnected | onNetworkChanged events with ethernet disconnected |
| Validate network_Hybrid_connected | device network as hybrid connected | onNetworkChanged with hybrid connected | onNetworkChanged events with hybrid connected |
| Validate network_Hybrid_disconnected | device network as hybrid disconnected | onNetworkChanged with hybrid disconnected | onNetworkChanged events with hybrid disconnected |

4 changes: 2 additions & 2 deletions cypress/TestCases/FireboltCertification/Localization.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ Feature: Localization

Examples:
| Scenario | API_Key | Validation_Key |
| with key and value as string | set localization removeAdditionalInfo with string | empty key/value for localization additionalInfo |
| with key and value as string | set localization removeAdditionalInfo with string | empty key value for localization additionalInfo |
| with key and value as empty string | set localization removeAdditionalInfo with empty string | empty response for localization additionalInfo |

@sdk @transport
Scenario: Localization.latlon - Positive Scenario: Get latlon
When '3rd party app' invokes the 'Firebolt' API to 'get localization latlon'
Then 'Firebolt' platform responds with 'expected localization latlon'

@sdk @transport
Scenario Outline: Positive Scenario: Validate interlinked methods - <Methods>
Given '3rd party app' registers for the '<First_Event_Registration_Key>' event using the 'Firebolt' API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Feature: Device_Manage
When 1st party app invokes the 'Firebolt' API to '<Key>'
Then 'Firebolt' platform responds to '1st party app' with '<MethodContent>'

Examples:
Examples:
| Scenario | Key | MethodContent |
| set device provision with default params | provision device with default values | default values for device provision |
| set device provision with default params | provision device with default values | default value for device provision |
| set device provision with distributor id | provision device with distributor id | distributor id for device provision |

@sdk @transport
Expand Down
138 changes: 138 additions & 0 deletions cypress/fixtures/fireboltCalls/account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/**
* Copyright 2024 Comcast Cable Communications Management, LLC
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
const errorContent = require('../objects/errorContentObjects.js');
exports.ACCOUNT_VARIABLES = {
ACCOUNT: {
id: {
data: [
{
type: 'fixture',
validations: [
{
mode: 'deviceContentValidation',
type: extractEnvValue('ACCOUNTID'),
description: 'Validation of the Account Id',
},
],
},
],
},
uid: {
data: [
{
type: 'regEx',
validations: [
{
mode: 'regex',
type: '/^(?:.*d)(?:.*[a-zA-Z]).{2,}$/',
description: 'Validation of the Account uid',
},
],
},
],
},
},
};

exports.ACCOUNT_ID_UID = {
method: resolveAtRuntime('account.{{attribute}}'),
params: null,
};

exports.ACCOUNT_ID = {
method: 'account.id',
validationJsonPath: 'result',
content: this.ACCOUNT_VARIABLES.ACCOUNT.id,
};

exports.ACCOUNT_UID = {
method: 'account.uid',
validationJsonPath: 'result',
content: this.ACCOUNT_VARIABLES.ACCOUNT.uid,
};

exports.FETCH_ACCOUNT_ID_WHEN_DEVICE_IS_NOT_PROVISIONED = {
method: 'account.id',
params: {},
expected: 'error',
};

exports.FETCH_ACCOUNT_UID_WHEN_DEVICE_IS_NOT_PROVISIONED = {
method: 'account.uid',
params: {},
expected: 'error',
};

exports.INVALID_PARAMETER_ERROR_FOR_ACCOUNT_ID = {
method: 'account.id',
validationJsonPath: 'result',
content: errorContent.INVALID_TYPE_PARAMS,
expectingError: true,
};

exports.INVALID_PARAMETER_ERROR_FOR_ACCOUNT_UID = {
method: 'account.uid',
validationJsonPath: 'result',
content: errorContent.INVALID_TYPE_PARAMS,
expectingError: true,
};

// Dummy session token data
exports.PUSH_SESSION_TOKEN = {
method: 'manage_account.session',
params: { token: 'SW52Y==', expiresIn: 84000 },
};

exports.GET_ADVERTISINGID_WITH_CUSTOM_ERROR = {
method: 'advertising.advertisingId',
params: { value: true },
expected: 'error',
};

exports.SET_ACCOUNT_SESSION_WITH_INVALID_TOKEN = {
method: 'manage_account.session',
params: { token: 12345, expiresIn: 84000 },
expected: 'error',
};

// Dummy session token data
exports.SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN = {
method: 'manage_account.session',
params: { token: 'SW52Y==', expiresIn: 'BJGHhjbdcJKSW' },
expected: 'error',
};

// Dummy session token data
exports.SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN_VALUE = {
method: 'manage_account.session',
params: { token: 'SW52Y==', expiresIn: 0 },
expected: 'error',
};

exports.SET_ACCOUNT_SESSION_WITHOUT_PARAMETERS = {
method: 'manage_account.session',
params: {},
expected: 'error',
};

exports.INVALID_PARAMETERS_FOR_ACCOUNT_SESSION = {
method: 'manage_account.session',
validationJsonPath: 'result',
content: errorContent.INVALID_TYPE_PARAMS,
expectingError: true,
};
86 changes: 43 additions & 43 deletions cypress/fixtures/fireboltCalls/account.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
{
"FETCH_ACCOUNT_ID":{
"FETCH_ACCOUNT_ID": {
"method": "account.id"
},
"FETCH_ACCOUNT_UID":{
"FETCH_ACCOUNT_UID": {
"method": "account.uid"
},
"GET_ACCOUNT_ID":{
"GET_ACCOUNT_ID": {
"method": "account.id",
"expected": "error"
},
"ACCOUNT_ID": {
"method": "account.id",
"validationJsonPath": "result",
"content": "ACCOUNT_ID"
},
"method": "account.id",
"validationJsonPath": "result",
"content": "ACCOUNT_ID"
},
"ACCOUNT_UID": {
"method": "account.uid",
"validationJsonPath": "result",
"content": "ACCOUNT_UID"
},
"method": "account.uid",
"validationJsonPath": "result",
"content": "ACCOUNT_UID"
},
"INVALID_PARAMETER_ERROR_FOR_ACCOUNT_ID": {
"method": "account.id",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS"
},
"method": "account.id",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS"
},
"INVALID_PARAMETER_ERROR_FOR_ACCOUNT_UID": {
"method": "account.uid",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS"
},
"method": "account.uid",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS"
},
"INVALID_REQUEST_ERROR_FOR_ACCOUNT_UID": {
"method": "account.uid",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS",
"method": "account.uid",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS",
"expectingError": true
},
"PUSH_SESSION_TOKEN":{
},
"PUSH_SESSION_TOKEN": {
"method": "manage_account.session",
"params": "ACCOUNT_SESSION"
"params": "ACCOUNT_SESSION"
},
"GET_ADVERTISINGID_WITH_CUSTOM_ERROR":{
"GET_ADVERTISINGID_WITH_CUSTOM_ERROR": {
"method": "advertising.advertisingId",
"params": "TRUE",
"expected": "error"
"params": "TRUE",
"expected": "error"
},
"SET_ACCOUNT_SESSION_WITH_INVALID_TOKEN":{
"SET_ACCOUNT_SESSION_WITH_INVALID_TOKEN": {
"method": "manage_account.session",
"params": "ACCOUNT_SESSION_INVALID_TOKEN",
"expected": "error"
"params": "ACCOUNT_SESSION_INVALID_TOKEN",
"expected": "error"
},
"INVALID_PARAMETERS_FOR_ACCOUNT_SESSION": {
"method": "account.session",
"validationJsonPath": "result",
"INVALID_PARAMETERS_FOR_ACCOUNT_SESSION": {
"method": "account.session",
"validationJsonPath": "result",
"content": "INVALID_TYPE_PARAMS",
"expectingError": true
},
"SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN":{
},
"SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN": {
"method": "manage_account.session",
"params": "ACCOUNT_SESSION_INVALID_EXPIRESIN",
"expected": "error"
"params": "ACCOUNT_SESSION_INVALID_EXPIRESIN",
"expected": "error"
},
"SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN_VALUE":{
"SET_ACCOUNT_SESSION_WITH_INVALID_EXPIRESIN_VALUE": {
"method": "manage_account.session",
"params": "ACCOUNT_EXPIRESIN_INVALID_VALUE",
"expected": "error"
"params": "ACCOUNT_EXPIRESIN_INVALID_VALUE",
"expected": "error"
},
"SET_ACCOUNT_SESSION_WITHOUT_PARAMETERS":{
"SET_ACCOUNT_SESSION_WITHOUT_PARAMETERS": {
"method": "manage_account.session",
"expected": "error"
"expected": "error"
},
"FETCH_ACCOUNT_ID_WHEN_DEVICE_IS_NOT_PROVISIONED": {
"method": "account.id",
Expand Down
Loading

0 comments on commit b1aa5b4

Please sign in to comment.