I am trying to run a protractor test in an Amazon EC2 environment using the PhantomJS browser. I know that it is not recommended to the PhantomJS user using Protractor, but this is the only choice that I have now. Tests always run in a Win7 environment.
When a test looks like this, it always works great
describe('Portal Login End 2 End test', function() { it('should automatically redirect to login /form', function() { browser.get(''); expect(browser.getLocationAbsUrl()).toMatch("/login"); }); it('should automatically redirect to dashboard page after successful login', function() { element(by.model('user.username')).sendKeys('admin'); element(by.model('user.password')).sendKeys('admin'); element(by.buttonText('Sign in')).click(); expect(browser.getLocationAbsUrl()).toMatch("dashboard/home"); }); });
but when a GET request is executed in a beforeEach function like this
describe('Portal Login End 2 End test', function() { beforeEach(function() { browser.get(''); } it('should automatically redirect to login', function() { expect(browser.getLocationAbsUrl()).toMatch("/login"); }); it('should automatically redirect to dashboard page after successful login', function() { element(by.model('user.username')).sendKeys('admin'); element(by.model('user.password')).sendKeys('admin'); element(by.buttonText('Sign in')).click(); expect(browser.getLocationAbsUrl()).toMatch("dashboard/home"); }); });
tests are not executed most of the time, but not always, with the following error
UnknownError: communication error with remote browser. He may have died. Assembly Information: version: '2.43.1', version: '5163bce', time: '2014-09-10 16:27:33' System information: host: 'ip-10-249-98-182', ip : '10 .249.98.182 ', os.name:' Linux ', os.arch:' amd64 ', os.version:' 2.6.32- 504.el6.x86_64 ', java.version:' 1.6.0_45 'Information about driver: driver.version: EventFiringWebDriver
Therefore, when two GET requests are executed in the same test, it most often fails, but when only one request is executed, it always works. And, as I wrote above, two GET requests work fine in Win7, but not in Linux.
I saw several posts with this error, but not how to fix it. Anyone out there with a solution?