Skip to content

Instantly share code, notes, and snippets.

@andreidbr
Created March 27, 2018 17:37
Show Gist options
  • Save andreidbr/ed323128da14c8e07d9ee2346165a250 to your computer and use it in GitHub Desktop.
Save andreidbr/ed323128da14c8e07d9ee2346165a250 to your computer and use it in GitHub Desktop.
A Selenium test using JS and Mocha
const {webdriver, Builder, By, Key, until} = require('selenium-webdriver'),
test = require('selenium-webdriver/testing'),
assert = require('assert');
let driver;
test.describe('PortfolioTests', function() {
test.before(function *() {
driver = new Builder().forBrowser('chrome').build();
});
test.it('01 Drums Access', function() {
driver.get("https://andreidbr.github.io/JS30/");
driver.findElement(By.xpath('/html/body/div[2]/div[1]')).click();
driver.getTitle().then(function(title) {
assert.equal(title, "JS30: 01 Drums");
});
});
test.after(() => driver.quit());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment