Skip to content

Commit 94f6bcc

Browse files
committed
refactoring things
1 parent a44287c commit 94f6bcc

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

bkp.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

pages/HomePage.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export class HomePage extends Page {
2727
await this.browser.waitUntilIsVisible(() => this.IdeaTitle);
2828
}
2929

30-
public async submitNewIdea(): Promise<void> {
30+
public async submitNewIdea(title: string, description: string): Promise<void> {
31+
await this.IdeaTitle.sendKeys(title);
32+
await this.IdeaDescription.sendKeys(description);
3133
await this.SubmitIdea.click();
3234
await this.browser.waitForPage(ShowIdeaPage);
3335
}

pages/ShowIdeaPage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class ShowIdeaPage extends Page {
88
@findBy('.idea-header .header')
99
public Title: WebElementPromise;
1010

11-
@findBy('div > span')
11+
@findBy('div.description')
1212
public Description: WebElementPromise;
1313

1414
@findBy('.support-counter .value')

specs/spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ specification('Users can submit ideas', () => {
3737

3838
when('new idea is submitted', async () => {
3939
action(async () => {
40-
await pages.home.IdeaTitle.sendKeys('Add support to TypeScript');
41-
await pages.home.IdeaDescription.sendKeys('Because the language and community is awesome! :)');
42-
await pages.home.submitNewIdea();
40+
await pages.home.submitNewIdea('Add support to TypeScript', 'Because the language and community is awesome! :)');
4341
});
4442

4543
then('it should have 1 supporter', async () => {

tests/test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Browser, ensure } from '../lib';
2+
import { Builder, ThenableWebDriver, WebElement, By, WebElementPromise, until } from 'selenium-webdriver';
23
import { AllPages } from '../pages';
34

45
describe('Submit ideas', () => {
@@ -31,9 +32,7 @@ describe('Submit ideas', () => {
3132
await ensure(pages.home.UserMenu).textIs('Darth Vader');
3233

3334
// Action
34-
await pages.home.IdeaTitle.sendKeys('Add support to TypeScript');
35-
await pages.home.IdeaDescription.sendKeys('Because the language and community is awesome! :)');
36-
await pages.home.submitNewIdea();
35+
await pages.home.submitNewIdea('Add support to TypeScript', 'Because the language and community is awesome! :)');
3736

3837
// Assert
3938
await Promise.all([

tslint.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"no-console": [
2828
false
2929
],
30-
"object-literal-shorthand": false
30+
"object-literal-shorthand": false,
31+
"max-line-length": [
32+
false
33+
]
3134
},
3235
"rulesDirectory": []
3336
}

0 commit comments

Comments
 (0)