Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

feat(example): add examples of usage protractor framework with angular-material components; #4891

Merged
merged 3 commits into from
Jul 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions example/angular_material/conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// An example configuration file.
exports.config = {
directConnect: true,

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},

// Framework to use. Jasmine is recommended.
framework: 'jasmine',

// Spec patterns are relative to the current working directory when
// protractor is called.
specs: [
'input_spec.js',
'mat_paginator_spec.js'
],

// Disable promise manager because we are going to use async/await
SELENIUM_PROMISE_MANAGER: false,

// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
15 changes: 15 additions & 0 deletions example/angular_material/input_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('angular-material input component page', function() {
const EC = protractor.ExpectedConditions;

it('Should change input component value', async() => {
await browser.get('https://material.angular.io/components/input/examples');

await browser.wait(EC.elementToBeClickable($('.mat-button-wrapper>.mat-icon')), 5000);

const emailInputField = $$('.mat-form-field-infix>input').get(1);

await emailInputField.sendKeys('invalid');

expect($('mat-error').isPresent()).toBe(true);
});
});
31 changes: 31 additions & 0 deletions example/angular_material/mat_paginator_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe('angular-material paginator component page', () => {
const EC = protractor.ExpectedConditions;

beforeAll(async() => {
await browser.get('https://material.angular.io/components/paginator/examples');

await browser.wait(EC.elementToBeClickable($('.mat-button-wrapper>.mat-icon')), 5000);
});

it('Should navigate to next page', async() => {
await $('button[aria-label=\'Next page\']').click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('11 - 20 of 100');
});

it('Should navigate to previous page', async() => {
await $('button[aria-label=\'Previous page\']').click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 - 10 of 100');
});

it('Should change list length to 5 items per page', async() => {
await $('mat-select>div').click();

const fiveItemsOption = $$('mat-option>.mat-option-text').first();

await fiveItemsOption.click();

await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 - 5 of 100');
});
});