Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ee98180

Browse files
author
Keerthi Shankar Subramanian
committed
Update locators, fixes
1 parent 682428a commit ee98180

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "Selenium using Javascript",
55
"scripts": {
6-
"test": "mocha --timeout 25000"
6+
"test": "mocha"
77
},
88
"devDependencies": {
99
"chai": "^4.2.0",

‎test/pages/HomePage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const seleniumActions = require('../selenium/SeleniumActions');
44

55
class HomePage {
66

7-
locatorSourceTextToTranslate = By.id('source');
8-
locatorTranslatedText = By.css('.translation span');
7+
locatorSourceTextToTranslate = By.css('textarea');
8+
locatorTranslatedText = By.css('div[data-language="en"] span');
99

1010
constructor(driver) {
1111
this.seleniumactions = new seleniumActions(driver);

‎test/selenium/SeleniumActions.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ class SeleniumActions {
1010
}
1111

1212
async enterTextAndPressEnterKey(locator, text) {
13-
await this.driver.findElement(locator).sendKeys(text, Key.RETURN).catch(error => { throw(error) });
13+
await this.driver.wait(until.elementLocated(locator), 8000)
14+
.sendKeys(text)
15+
.catch(error => { throw(error) });
1416
}
1517

1618
async waitUntilPageTitleIsDisplayed(webPageTitle) {
17-
await this.driver.wait(until.titleIs(webPageTitle), 2000).catch(error => { throw(error) });
19+
await this.driver.wait(until.titleIs(webPageTitle), 4000).catch(error => { throw(error) });
1820
}
1921

2022
async getInnerText(locator) {
21-
return await this.driver.wait(until.elementLocated(locator), 2000).getText()
23+
return await this.driver.wait(until.elementLocated(locator), 4000).getText()
2224
.catch(error => { throw(error) });
2325
}
2426
}

‎test/translateTest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const expect = require('chai').expect;
33
const BrowserFactory = require('./selenium/BrowserFactory');
44
const HomePage = require('./pages/HomePage');
55

6-
describe('Google Translate', () => {
6+
describe('Google Translate', function() {
7+
this.timeout(25000);
78
it('should translate Swedish to English', async () => {
89
let driver = await new BrowserFactory().startBrowser();
910
let homepage = new HomePage(driver);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /