-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add js test to run with mocha [deploy site]
- Loading branch information
Showing
6 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
examples/javascript/test/getting_started/runningTests.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const {By, Builder} = require('selenium-webdriver'); | ||
const assert = require("assert"); | ||
|
||
describe('First script', function () { | ||
let driver; | ||
|
||
before(async function () { | ||
driver = await new Builder().forBrowser('chrome').build(); | ||
}); | ||
|
||
it('First Selenium script with mocha', async function () { | ||
await driver.get('https://www.selenium.dev/selenium/web/web-form.html'); | ||
|
||
let title = await driver.getTitle(); | ||
assert.equal("Web form", title); | ||
|
||
await driver.manage().setTimeouts({implicit: 500}); | ||
|
||
let textBox = await driver.findElement(By.name('my-text')); | ||
let submitButton = await driver.findElement(By.css('button')); | ||
|
||
await textBox.sendKeys('Selenium'); | ||
await submitButton.click(); | ||
|
||
let message = await driver.findElement(By.id('message')); | ||
let value = await message.getText(); | ||
assert.equal("Received!", value); | ||
}); | ||
|
||
after(async () => await driver.quit()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters