Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e tests for eleventh() - twentieth() element numeration functions #15

Merged
merged 10 commits into from
Feb 28, 2017
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ For example let's take a small HTML list:
<li>Eighth</li>
<li>Ninth</li>
<li>Tenth</li>
<li>Eleventh</li>
<li>Twelfth</li>
<li>Thirteenth</li>
<li>Fourteenth</li>
<li>Fifteenth</li>
<li>Sixteenth</li>
<li>Seventeenth</li>
<li>Eighteenth</li>
<li>Nineteenth</li>
<li>Twentieth</li>
</ul>
```

Expand All @@ -76,6 +86,16 @@ let listItemSeventh = element.all(by.css('.items li')).seventh();
let listItemEighth = element.all(by.css('.items li')).eighth();
let listItemNinth = element.all(by.css('.items li')).ninth();
let listItemTenth = element.all(by.css('.items li')).tenth();
let listItemEleventh = element.all(by.css('.items li')).eleventh();
let listItemTwelfth = element.all(by.css('.items li')).twelfth();
let listItemThirteenth = element.all(by.css('.items li')).thirteenth();
let listItemFourteenth = element.all(by.css('.items li')).fourteenth();
let listItemFifteenth = element.all(by.css('.items li')).fifteenth();
let listItemSixteenth = element.all(by.css('.items li')).sixteenth();
let listItemSeventeenth = element.all(by.css('.items li')).seventeenth();
let listItemEighteenth = element.all(by.css('.items li')).eighteenth();
let listItemNineteenth = element.all(by.css('.items li')).nineteenth();
let listItemTwentieth = element.all(by.css('.items li')).twentieth();

expect(listItemSecond.getText()).toBe('Second');
expect(listItemThird.getText()).toBe('Third');
Expand All @@ -86,9 +106,19 @@ expect(listItemSeventh.getText()).toBe('Seventh');
expect(listItemEighth.getText()).toBe('Eighth');
expect(listItemNinth.getText()).toBe('Ninth');
expect(listItemTenth.getText()).toBe('Tenth');
expect(listItemEleventh.getText()).toBe('Eleventh');
expect(listItemTwelfth.getText()).toBe('Twelfth');
expect(listItemThirteenth.getText()).toBe('Thirteenth');
expect(listItemFourteenth.getText()).toBe('Fourteenth');
expect(listItemFifteenth.getText()).toBe('Fifteenth');
expect(listItemSixteenth.getText()).toBe('Sixteenth');
expect(listItemSeventeenth.getText()).toBe('Seventeenth');
expect(listItemEighteenth.getText()).toBe('Eighteenth');
expect(listItemNineteenth.getText()).toBe('Nineteenth');
expect(listItemTwentieth.getText()).toBe('Twentieth');
```

## Thanks
If this script was helpful for you, please *give it a ★ Star* on
If this script was helpful for you, please give it a **★ Star** on
[Github](https://github.com/Marketionist/protractor-numerator) and
[npm](https://www.npmjs.com/package/protractor-numerator)
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { ElementFinder } from 'protractor';

/* eslint valid-jsdoc: 0, no-magic-numbers: 0, "spaced-comment": 1, eol-last: 1 */
/* eslint valid-jsdoc: 0, no-magic-numbers: 0, spaced-comment: 1, eol-last: 1, quotes: 1 */

/*
* Created by marketionist on 31.12.2016
Expand Down
70 changes: 70 additions & 0 deletions test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ nodeTestingServer.config = {
<li>Eighth</li>
<li>Ninth</li>
<li>Tenth</li>
<li>Eleventh</li>
<li>Twelfth</li>
<li>Thirteenth</li>
<li>Fourteenth</li>
<li>Fifteenth</li>
<li>Sixteenth</li>
<li>Seventeenth</li>
<li>Eighteenth</li>
<li>Nineteenth</li>
<li>Twentieth</li>
</ul>`
}
}
Expand Down Expand Up @@ -108,4 +118,64 @@ describe('protractor-numerator tests', function () {
expect(listItemTenth.getText()).toBe('Tenth');
});

it('should get the eleventh list item from the test server page', function () {
let listItemEleventh = element.all(by.css(selectorLinkCSS)).eleventh();

expect(listItemEleventh.getText()).toBe('Eleventh');
});

it('should get the twelfth list item from the test server page', function () {
let listItemTwelfth = element.all(by.css(selectorLinkCSS)).twelfth();

expect(listItemTwelfth.getText()).toBe('Twelfth');
});

it('should get the thirteenth list item from the test server page', function () {
let listItemThirteenth = element.all(by.css(selectorLinkCSS)).thirteenth();

expect(listItemThirteenth.getText()).toBe('Thirteenth');
});

it('should get the fourteenth list item from the test server page', function () {
let listItemFourteenth = element.all(by.css(selectorLinkCSS)).fourteenth();

expect(listItemFourteenth.getText()).toBe('Fourteenth');
});

it('should get the fifteenth list item from the test server page', function () {
let listItemFifteenth = element.all(by.css(selectorLinkCSS)).fifteenth();

expect(listItemFifteenth.getText()).toBe('Fifteenth');
});

it('should get the sixteenth list item from the test server page', function () {
let listItemSixteenth = element.all(by.css(selectorLinkCSS)).sixteenth();

expect(listItemSixteenth.getText()).toBe('Sixteenth');
});

it('should get the seventeenth list item from the test server page', function () {
let listItemSeventeenth = element.all(by.css(selectorLinkCSS)).seventeenth();

expect(listItemSeventeenth.getText()).toBe('Seventeenth');
});

it('should get the eighteenth list item from the test server page', function () {
let listItemEighteenth = element.all(by.css(selectorLinkCSS)).eighteenth();

expect(listItemEighteenth.getText()).toBe('Eighteenth');
});

it('should get the nineteenth list item from the test server page', function () {
let listItemNineteenth = element.all(by.css(selectorLinkCSS)).nineteenth();

expect(listItemNineteenth.getText()).toBe('Nineteenth');
});

it('should get the twentieth list item from the test server page', function () {
let listItemTwentieth = element.all(by.css(selectorLinkCSS)).twentieth();

expect(listItemTwentieth.getText()).toBe('Twentieth');
});

});
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"lib": [
"es2016"
],
Expand Down