Skip to content

Instantly share code, notes, and snippets.

@axemclion
Last active May 28, 2019
Embed
What would you like to do?
Protractor-Perf Example
*.log
node_modules/
var PerfRunner = require('protractor-perf');
describe('angularjs homepage todo list', function() {
var perfRunner = new PerfRunner(protractor, browser);
it('should add a todo', function() {
browser.get('http://www.angularjs.org');
perfRunner.start();
element(by.model('todoList.todoText')).sendKeys('write a protractor test');
element(by.css('[value="add"]')).click();
perfRunner.stop();
if (perfRunner.isEnabled) {
perfRunner.getStats('mean_frame_time').then(function(stats) {
console.log(stats)
});
//expect(perfRunner.getStats('meanFrameTime')).toBeLessThan(60);
};
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write a protractor test');
});
});
{
"name": "properf_test",
"version": "0.0.0",
"description": "A test for protractor_perf",
"devDependencies": {
"protractor-perf": "*",
"protractor": "^2.0.0"
},
"scripts": {
"preperftest": "npm run update-webdriver",
"perftest": "protractor-perf protractor-perf.conf.js",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"start-webdriver": "webdriver-manager start"
}
}
exports.config = {
seleniumPort: 4445,
selenium: 'http://localhost:4445/wd/hub',
specs: [
'./*.spec.js'
],
capabilities: {
browserName: 'chrome'
},
};
@vishnuDatifex

This comment has been minimized.

Copy link

@vishnuDatifex vishnuDatifex commented May 28, 2019

Hi parashuram, Am new in protractor. I have attached my project code. I have getting problem in your protractor-perf.
it('TC63634: should continue',function (callback){
console.log('TC63634: should continue...');
var perfRunner = new PerfRunner(protractor, browser);
perfRunner.start();
// browser.manage().timeouts().implicitlyWait(20000);
let con = element(by.buttonText('Continue'));
con.click();
perfRunner.stop();
if(perfRunner.isEnabled) {
console.log("perfRunner is enabled");
perfRunner.getStats('mean_frame_time').then(function(stats) {
console.log(stats)
});
expect(perfRunner.getStats('meanFrameTime')).toBeLessThan(30000);
};
callback();
});

I have used protractor-perf in this function. it’s getting this error
[20:39:58] I/launcher - 0 instance(s) of WebDriver still running
[20:39:58] I/launcher - chrome #1 failed 3 test(s)
[20:39:58] I/launcher - overall: 3 failed spec(s)

how to solve this?
my project verstions
"protractor": "~4.0.14",
"protractor-perf": "^0.2.3",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment