Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protractor headless test fails using phantomjs 1.9.7 in Angularjs #9

Closed
michaelnico opened this issue Sep 11, 2014 · 2 comments
Closed

Comments

@michaelnico
Copy link

Protractor tests failed when I run it in headless tests using phantomjs 1.9.7.

Here are the error messages:
Selenium standalone server started at http://192.168.1.156:4444/wd/hub
Scenario 1: A user can view the login page.
should redirect to the login page - pass
Scenario 2: A user logins using valid username and password.
should accepts valid username and password - fail

Failures:

  1. Scenario 2: A user logins using valid username and password. should accepts valid username and password
    Message:
    Expected 'http://localhost:8080/app/#/login?ref=%2Fdashboard' to contain '/dashboard'.
    Stacktrace:
    Error: Failed expectation
    at null. (/home/user/workspace/whitelabel/web-app/app/js/test/LoginSpec.js:20:37)

  2. Scenario 2: A user logins using valid username and password. should accepts valid username and password
    Message:
    Error: No element found using locator: By.linkText("Settings")
    Stacktrace:
    Error: No element found using locator: By.linkText("Settings")
    ==== async task ====
    Asynchronous test function: it()
    Error
    at null. (/home/user/workspace/whitelabel/web-app/app/js/test/LoginSpec.js:15:3)
    at Object. (/home/user/workspace/whitelabel/web-app/app/js/test/LoginSpec.js:14:1)

  3. Scenario 2: A user logins using valid username and password. should accepts valid username and password
    Message:
    UnknownError: {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:29766","User-Agent":"Apache-HttpClient/4.3.2 (java 1.5)"},"httpVersion":"1.1","method":"POST","post":"{"id":":wdc:1410413286331"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/66a8b700-3974-11e4-bd36-35d30e8383e9/element/%3Awdc%3A1410413286331/click"}}
    Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
    System info: host: 'micmic.suarez', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.8.0-38-generic', java.version: '1.7.0_55'
    Driver info: driver.version: unknown

This is my test code:
describe('Scenario 1: A user can view the login page.', function() {
var loginUrl;

it('should redirect to the login page', function() {
browser.get('http://localhost:8080/app/');
loginUrl = browser.getCurrentUrl();
expect(browser.getCurrentUrl()).toEqual(loginUrl);
expect(browser.getCurrentUrl()).toContain('/login');
});
}, 100000);

describe('Scenario 2: A user logins using valid username and password.', function() {
it('should accepts valid username and password', function() {
browser.findElement(protractor.By.id('username')).sendKeys('micmic');
browser.findElement(protractor.By.id('password')).sendKeys('password');
browser.findElement(protractor.By.id('submit')).click();
browser.sleep(1000);
expect(browser.getCurrentUrl()).toContain('/dashboard');
browser.findElement(protractor.By.linkText('Settings')).click();
browser.sleep(1000);
browser.findElement(protractor.By.linkText('Branding')).click();
browser.sleep(1000);
browser.findElement(protractor.By.linkText('sss')).click();
browser.sleep(1000);
});

afterEach(function() {
browser.findElement(by.id('logout')).then(function(elem) {
elem.click();
});
browser.sleep(10000);
});
}, 10000);

This is my code in conf.js:
// conf.js
exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumServerJar: 'selenium-server-standalone-2.40.0.jar',
seleniumPort: 4444,
// seleniumArgs:''
specs: ['LoginSpec.js'],

capabilities: {
browserName: 'phantomjs',
version: '',
platform: 'ANY'
},

// ----- More information for your tests ----
// baseUrl: 'http://monopond.org:8080',
framework: 'jasmine',
onPrepare: function() {
// At this point, global 'protractor' object will be set up, and
// jasmine will be available.
},
allScriptsTimeout: 99999,
jasmineNodeOpts: {
isVerbose: true,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 30000
}
};

@juliemr
Copy link
Owner

juliemr commented Feb 19, 2015

I don't think this issue belongs in this repo.

@juliemr juliemr closed this as completed Feb 19, 2015
@michaelnico
Copy link
Author

michaelnico commented Feb 20, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants