I am currently working on a test that involves processing a string through a switch statement. However, I am facing an issue where the integer value set in the case of the switch statement is not being passed correctly. As a result, the subsequent if statement fails to work as expected.
Here is the object for the switch:
var appsNotPurchased = 0;
this.checksHomeSublevel = function(mmCode) {
browser.get('https://iplan-qa.meetingmatrix.com/Home/Index/' + mmCode);
marketingObjects.level.getText().then(function(text) {
var homeText = text;
browser.get('https://iplan-qa.meetingmatrix.com/Home/Apps/' + mmCode);
expect($('div.apps-subscription > span').getText()).toEqual('iPlan Level: ' + homeText);
switch (homeText) {
case 'Select':
console.log(homeText);
appsNotPurchased = 6;
return appsNotPurchased;
break;
case 'Content':
console.log(homeText);
appsNotPurchased = 0 || 1 || 2 || 3 || 4 || 5 || 6;
return appsNotPurchased;
break;
}
});
Below is the testSpec describe function:
describe('should upload media: ', function() {
it('should select add media', function() {
var mmCode = "ACC0572";
var appsNotPurchased = appsObjects.checksHomeSublevel(mmCode);
appsObjects.checksSubLevelSelect(mmCode, appsNotPurchased);
});
});
The object that receives the value:
this.checksSubLevelSelect = function(mmCode, appsNotPurchased) {
//checks and counts the apps
apps.count().then(function(count) {
expect(count).toEqual(7);
for (var i = 0; i < count; i++) {
if (appsPlace == appsNotPurchased) {
//perform certain actions here
} else {
//perform other actions here
}
appsPlace++;
}
});
};