config.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'Login.js',
'FeatureList.js',
'NewApplicationRegistration.js',
'ApplicationRegistrationManagement.js',
'RegistrationStatus.js',
],
baseUrl: 'http://localhost:3000',
multiCapabilities: [{
'browserName': 'chrome'
},
// {
// 'browserName': 'firefox'
// },
// {
// 'browserName': 'internet explorer'
// }
],
jasmineNodeOpts: {
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 3000000
},
allScriptsTimeout: 11000,
rootElement: 'html',
onPrepare: function () {
browser.ignoreSynchronization = true;
browser.driver.manage().window();
},
};
1st specification file
'use strict'
describe('Application Registration Page', function () {
beforeEach(function () {
browser.waitForAngular();
browser.get('/register');
});
// Login
it('Test for Login', function () {
expect(element(by.xpath('/html/body/admin-app-root/layout/div[1]/div/ng-component/div/form/div/table/tbody/tr[1]/th/label')));
var EC = protractor.ExpectedConditions;
var username = element(by.id('login-username'));
browser.wait(EC.visibilityOf(username), 30000);
username.sendKeys('sss');
expect(element(by.xpath('/html/body/admin-app-root/layout/div[1]/div/ng-component/div/form/div/table/tbody/tr[2]/th/label')));
var EC = protractor.ExpectedConditions;
var password = element(by.id('login-password'));
browser.wait(EC.visibilityOf(password), 30000);
password.sendKeys('sss');
browser.driver.sleep(1000);
element(by.xpath('/html/body/admin-app-root/layout/div[1]/div/ng-component/div/form/div/table/tbody/tr[3]/td/button')).click().then(function (username, password) {
if (username, password) {
browser.navigateTo('http://localhost:3000/register/core/feature-list');
} else {
expect(browser.isElementPresent(element(by.xpath('/html/body/admin-app-root/layout/div[1]/div/ng-component/div/form/div/table/tbody/tr[1]/td/b'))));
}
});
});
});
2nd specification
'use strict'
describe('Welcome to feature list', function () {
beforeEach(function () {
browser.waitForAngular();
browser.get('/register/core/feature-list');
});
describe('Header', function () {
// Application Registration text
it('Test for Application Registration text', function () {
var EC = protractor.ExpectedConditions;
var ar = element(by.xpath('/html/body/admin-app-root/layout/div[1]/c-header/nav/div/div[1]/a[2]'));
browser.wait(EC.presenceOf(ar), 2000000);
expect(ar.getAttribute('value')).toEqual('Application Registration');
});
it('Test for user name', function () {
var EC = protractor.ExpectedConditions;
var username = element(by.xpath('//*[@id="cox-navbar"]/ul/li[1]/a'));
browser.wait(EC.visibilityOf(username), 2000);
expect(username.isPresent()).toBe(true);
});
});
1st specification script is running fine but while running 2nd specification I am getting an error saying:
wait timeout after 2000000ms
Even though script timeout is very big it is getting error. It is not able to find the element from browser for the given timing.
Help me to find the solution.