If you need to exchange dynamic data between files, you can also do the following. Here is a working example. I needed to make parts of the URL and use them in 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 just assigned the values ββthat I need to use in other files to 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; });
source share