Currently, I am actively developing an AngularJS protractor test suite. The configuration file for this project is structured in the following way:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: 'http://127.0.0.1:17315/',
capabilities: {
browserName: 'chrome',
'chromeOptions': {
args: ['--test-type']
}
},
suites: {
login: ['LoginPage/login.js'],
homePage: ['Homepage/homepage.js',
'Homepage/city_page.js',
'Homepage/admin_page.js'],
adminPage: ['AdminPage/exam.js',
'AdminPage/location.js'
..
Within these .js files, I have implemented various functions that should be shared across all of my files. For instance:
describe('xxx', function () {
it('xxx', function () {
commonFunction(123);
});
I aim to organize these common functions into their own separate file. However, I am uncertain about how to achieve this while ensuring accessibility from other JavaScript files. It appears that what I require is something akin to an "import" mechanism, which as far as I know currently does not exist. Therefore, I would greatly appreciate any guidance on how and where to store these common functions so they can be easily accessed from each of the *.js files present in the test suites.