Skip to content
Open

Matt #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added javascript/Mod1/1.05/chromedriver.exe
Binary file not shown.
Binary file added javascript/Mod1/1.05/geckodriver.exe
Binary file not shown.
8 changes: 4 additions & 4 deletions javascript/Mod1/1.05/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"author": "",
"license": "ISC",
"dependencies": {
"geckodriver": "^1.19.1",
"chromedriver": "^94.0.0",
"geckodriver": "^2.0.4",
"mocha": "^8.0.1",
"chromedriver": "83.0.0",
"selenium-webdriver": "4.0.0-alpha.7",
"mocha-parallel-tests": "2.3.0"
"mocha-parallel-tests": "2.3.0",
"selenium-webdriver": "4.0.0-alpha.7"
}
}
31 changes: 31 additions & 0 deletions javascript/Mod1/1.05/test/LocatorTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// filename: test/LocatorTest.js
// ...
const { Builder, By } = require('selenium-webdriver')
const path = require('path')

//The Test
describe('Locate', function() {
this.timeout(30000)
let driver

beforeEach(async function() {
driver = await new Builder().forBrowser('firefox').build()
})
afterEach(async function() {
await driver.quit()
})
it('check red button text' , async function() {
await driver.get('https://the-internet.herokuapp.com/challenging_dom')
await driver
.findElement( By.css('.button') )
.click()
await driver
.findElement( By.css('.button.success') )
.click()
// Return the text of the red button id=button alert contains 'foo', 'bar', 'baz', or 'qux'
var redButtonMessage = await driver
.findElement(By.css('.button.alert'))
.getText()
console.log(redButtonMessage)
})
})
38 changes: 27 additions & 11 deletions javascript/Mod1/1.05/test/LoginTest.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
const { Builder } = require('selenium-webdriver')
const path = require('path')
const assert = require('assert')

describe('Login', function() {

//describe is a method from Mocha
describe('Login', function () {
this.timeout(30000)
let driver

beforeEach(async function() {

beforeEach(async function () {
/* const vendorDirectory =
path.delimiter + path.join(__dirname, '..', 'vendor')
process.env.PATH += vendorDirectory */
driver = await new Builder().forBrowser('firefox').build();
})

afterEach(async function() {

afterEach(async function () {
await driver.quit()
})

it('with valid credentials', async function() {

it('with valid credentials', async function () {
await driver.get('http://the-internet.herokuapp.com/login')
await driver
.findElement({ id: 'username' })
.sendKeys('tomsmith')
await driver
.findElement({ id: 'password' })
.sendKeys('SuperSecretPassword!')
await driver.findElement({ css: 'button' }).click()
assert(
await driver.findElement({
css: '.flash.success'
}).isDisplayed(), 'Success message not displayed'
)
})
})
})