Created
April 10, 2020 18:08
-
-
Save jaffamonkey/bc708da9a7064097c3d01d3154f13497 to your computer and use it in GitHub Desktop.
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
// Filename: jest-webdriver.js | |
// To setup: npm install -g jest selenium-webdriver chromedriver | |
// To run: jest jest-webdriver.js | |
var webdriver = require('selenium-webdriver'), | |
By = webdriver.By; | |
var browser = new webdriver | |
.Builder() | |
.usingServer() | |
.withCapabilities({ | |
'browserName': 'chrome', | |
'chromeOptions': { | |
args: ["headless", "disable-gpu"] | |
} | |
}).build(); | |
describe('Check the DuckDuckGo search results page', function () { | |
it('Check the page title', async function () { | |
await browser.get('https://duckduckgo.com'); | |
await browser.findElement(By.name('q')).sendKeys('TrumpKlon'); | |
await browser.findElement(By.id('search_button_homepage')).click(); | |
var title = await browser.getTitle(); | |
expect(title).toEqual('TrumpKlon at DuckDuckGo'); | |
var result = await browser.findElement(By.id('links')).getText(); | |
expect(result).toMatch(/TrumpKlon/); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment