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
const webdriver = require('selenium-webdriver') | |
const {By, until} = webdriver | |
require('chromedriver') | |
describe.only('todo list', function() { | |
let driver | |
beforeAll(async () => (driver = await new webdriver.Builder().forBrowser('chrome').build())) | |
afterAll(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
const {Builder, By, Key, until} = require('selenium-webdriver'); | |
async function main() { | |
let driver = await new Builder() | |
.forBrowser('firefox') | |
.build(); | |
await driver.get('http://www.google.com/ncr') | |
const element = await driver.findElement(By.name('q')) |
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
const {Builder, By, Key, until} = require('selenium-webdriver'); | |
let driverPromise = new Builder() | |
.forBrowser('firefox') | |
.build(); | |
driverPromise.then(driver => driver.get('http://www.google.com/ncr')) | |
.then(() => driver.findElement(By.name('q'))) | |
.then(element => element.sendKeys('webdriver', Key.RETURN)) | |
.then(() => driver.wait(until.titleIs('webdriver - Google Search'), 1000)) |
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
const {Builder, By, Key, until} = require('selenium-webdriver'); | |
let driver = new Builder() | |
.forBrowser('firefox') | |
.build(); | |
driver.get('http://www.google.com/ncr'); | |
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN); | |
driver.wait(until.titleIs('webdriver - Google Search'), 1000); | |
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
async function main() { | |
const content = await readFilePromise('source.txt') | |
await writeFilePromise('target.txt', content) | |
console.log('done') | |
} | |
main() |
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
readFilePromise('source.txt') | |
.then(content => writeFilePromise('target.txt', content)) | |
.then(() => console.log('done')) |
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
fs.readFile('source.txt', (_, content) => { | |
fs.writeFile('target.txt', content, () => { | |
console.log('done!') | |
}) | |
}) |
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
byte[] content = Files.readAllBytes(Paths.get("source.txt")); | |
Files.write(Paths.get("target.txt"), content); |
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
await retry(async () => { | |
const displayElement = await driver.findElement(By.css('.display')) | |
const displayText = await displayElement.getText() | |
expect(displayText).to.equal('0') | |
}) |
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
it('should look good', async function () { | |
await driver.get('http://localhost:8080') | |
await eyes.checkWindow('Initial Page') | |
const digit4Element = await driver.findElement(By.css('.digit-4')) | |
const digit2Element = await driver.findElement(By.css('.digit-2')) | |
const operatorMultiply = await driver.findElement(By.css('.operator-multiply')) | |
const operatorEquals = await driver.findElement(By.css('.operator-equals')) |