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

Commit 249e657

Browse files
IgorSasovetsqiyigg
authored andcommitted
feat(example): add examples of usage protractor framework with angular-material components; (#4891)
1 parent 4534e20 commit 249e657

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

example/angular_material/conf.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// An example configuration file.
2+
exports.config = {
3+
directConnect: true,
4+
5+
// Capabilities to be passed to the webdriver instance.
6+
capabilities: {
7+
'browserName': 'chrome'
8+
},
9+
10+
// Framework to use. Jasmine is recommended.
11+
framework: 'jasmine',
12+
13+
// Spec patterns are relative to the current working directory when
14+
// protractor is called.
15+
specs: [
16+
'input_spec.js',
17+
'mat_paginator_spec.js'
18+
],
19+
20+
// Disable promise manager because we are going to use async/await
21+
SELENIUM_PROMISE_MANAGER: false,
22+
23+
// Options to be passed to Jasmine.
24+
jasmineNodeOpts: {
25+
defaultTimeoutInterval: 30000
26+
}
27+
};
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
describe('angular-material input component page', function() {
2+
const EC = protractor.ExpectedConditions;
3+
4+
it('Should change input component value', async() => {
5+
await browser.get('https://material.angular.io/components/input/examples');
6+
7+
await browser.wait(EC.elementToBeClickable($('.mat-button-wrapper>.mat-icon')), 5000);
8+
9+
const emailInputField = $$('.mat-form-field-infix>input').get(1);
10+
11+
await emailInputField.sendKeys('invalid');
12+
13+
expect($('mat-error').isPresent()).toBe(true);
14+
});
15+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
describe('angular-material paginator component page', () => {
2+
const EC = protractor.ExpectedConditions;
3+
4+
beforeAll(async() => {
5+
await browser.get('https://material.angular.io/components/paginator/examples');
6+
7+
await browser.wait(EC.elementToBeClickable($('.mat-button-wrapper>.mat-icon')), 5000);
8+
});
9+
10+
it('Should navigate to next page', async() => {
11+
await $('button[aria-label=\'Next page\']').click();
12+
13+
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('11 - 20 of 100');
14+
});
15+
16+
it('Should navigate to previous page', async() => {
17+
await $('button[aria-label=\'Previous page\']').click();
18+
19+
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 - 10 of 100');
20+
});
21+
22+
it('Should change list length to 5 items per page', async() => {
23+
await $('mat-select>div').click();
24+
25+
const fiveItemsOption = $$('mat-option>.mat-option-text').first();
26+
27+
await fiveItemsOption.click();
28+
29+
await expect($('.mat-paginator-range-label').getAttribute('innerText')).toEqual('1 - 5 of 100');
30+
});
31+
});

0 commit comments

Comments
 (0)