angular

AngularJS End to End (E2E) Testing | Protractor

conf.js:

  • Javascript
exports.config = {

	// Capabilities to be passed to the
	// webdriver instance.
	// Here we are specifying the browser
	// to be chrome
	capabilities: {
		'browserName': 'chrome'
	},

	// Framework to use. Jasmine is
	// being used here.
	framework: 'jasmine',

	// The test file which are relative
	// to the current working directory
	// when protractor is called.
	specs: ['test.js'],

	// Options to be passed to Jasmine.
	jasmineNodeOpts: {
		defaultTimeoutInterval: 30000
	}
};

The spec file named test.js:

  • Javascript
describe('Protractor Demo App', function () {
	it('should have a title', function () {

		// Open the AngularJS webpage
		browser.get(
	'http://juliemr.github.io/protractor-demo/');

		// Check if the title is 'Super
		// Calculator' or not.
		expect(browser.getTitle())
			.toEqual('Super Calculator');
	});
});

The spec file named test.js:

  • Javascript
describe('Protractor Demo App', function () {
	it('should have a title', function () {

		// Open the AngularJS webpage
		browser.get(
	'http://juliemr.github.io/protractor-demo/');

		// Check if the title is 'Super
		// Calculator' or not.
		expect(browser.getTitle())
			.toEqual('Super Calculator');
	});
});
  • Finally, we are ready to run our file using the command given below:

protractor conf.js

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *