'use strict';

exports.loadAngularMocks = function () {
    browser.clearMockModules();
    browser.addMockModule('swiftBrowserE2E', function () {
        var ngMocks = document.createElement('script');
        ngMocks.src = 'bower_components/angular-mocks/angular-mocks.js';
        document.body.appendChild(ngMocks);

        var swiftSim = document.createElement('script');
        swiftSim.src = 'js/test/swift-simulator.js';
        document.body.appendChild(swiftSim);
    });
    browser.addMockModule('swiftBrowserE2E', function() {
        angular.module('swiftBrowserE2E').run(function(swiftSim) {
            swiftSim.reset();
        });
    });
};

exports.addContainer = function(name) {
    browser.addMockModule('swiftBrowserE2E', function(name) {
        angular.module('swiftBrowserE2E').run(function(swiftSim) {
            swiftSim.addContainer(name);
        });
    }, name);
};

exports.setObjects = function(container, objects) {
    browser.addMockModule('swiftBrowserE2E', function(container, jsonObjects) {
        angular.module('swiftBrowserE2E').run(function(swiftSim) {
            swiftSim.setObjects(container, JSON.parse(jsonObjects));
        });
    }, container, JSON.stringify(objects));
};

@@ -156,170 +156,174 @@
 var 
-ngMocks = document.createElement('script');%0A        ngMocks.src = 'bower_components/angular-mocks/angular-mocks.js';%0A        document.body.appendChild(ngMocks);%0A%0A
+srcs = %5B%0A            'bower_components/angular-mocks/angular-mocks.js',%0A            'js/test/swift-simulator.js'%0A        %5D;%0A        srcs.forEach(function (src) %7B%0A    
     
@@ -331,23 +331,21 @@
    var s
-wiftSim
+cript
  = docum
@@ -385,53 +385,34 @@
     
-swiftSim.src = 'js/test/swift-simulator.js';%0A
+    script.src = src;%0A    
     
@@ -442,23 +442,33 @@
 dChild(s
-wiftSim
+cript);%0A        %7D
 );%0A    %7D

refactor script loading