If you need to share dynamic data between files you can also do the following.
Here's a working example. What I needed to do was take parts of the URL and use them across different files.
it('should click on one of the clickable profiles', function(){
//Get entity type and entity id before clicking the link
tableEls.get(1).all( by.xpath('./td') ).get(0).element( by.xpath('./a') ).getAttribute('href').then(function(text){
var hrefTokens = text.split('/');
var entityID = hrefTokens[ hrefTokens.length - 1 ];
var entityType = hrefTokens[ hrefTokens.length - 2 ];
browser.params.entityID = entityID;
browser.params.entityType = entityType;
});
tableEls.get(1).all( by.xpath('./td') ).get(0).element( by.xpath('./a') ).click();
browser.sleep(2000);
});
I simply assigned the values that I needed to use in other files to the browser.params
. So in my other files I can access them like this
it('Retrieving JSON Data ...', function(){
var entityID = browser.params.entityID;
var entityType = browser.params.entityType;
});