I am running protractor and jasmine to run unit tests.
I need to know the build version of my web app in order to execute different tests.
I have declared a variable to store this version value.
var version ='';
I am getting the version number by using the following code.
menuObject.modaltext.getText().then(function(text) {
version = text.slice(79,86);
console.log(version);
browser.driver.sleep(7000);
});
The version number is acquired correctly and is consoled properly.
But when i use this version outside of this .then function, its value becomes undefined and I am unable to check for any conditions using that variable.
How can i access the version number so that I use it to control the flow of the tests.
![version variable is highlighted, I am unable to access the version inside the if cases]