-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from angrykoala/dev
Dev
- Loading branch information
Showing
16 changed files
with
296 additions
and
57 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"use strict"; | ||
|
||
const assert = require('assert'); | ||
const Wendigo = require('../../lib/wendigo'); | ||
const utils = require('../utils'); | ||
const configUrls = require('../config.json').urls; | ||
|
||
describe("Assert href", function() { | ||
this.timeout(5000); | ||
let browser; | ||
|
||
before(async () => { | ||
browser = await Wendigo.createBrowser(); | ||
await browser.open(configUrls.index); | ||
}); | ||
|
||
after(async() => { | ||
await browser.close(); | ||
}); | ||
|
||
it("Href", async() => { | ||
await browser.assert.href("a", "html_simple.html"); | ||
}); | ||
it("Href From Node", async() => { | ||
const node = await browser.query("a"); | ||
await browser.assert.href(node, "html_simple.html"); | ||
}); | ||
|
||
it("Href Throws", async() => { | ||
assert(browser.assert.href); | ||
await utils.assertThrowsAssertionAsync(async() => { | ||
await browser.assert.href("a", "bad-link"); | ||
}, `Expected element "a" to have attribute "href" with value "bad-link", "html_simple.html" found.`); | ||
}); | ||
|
||
it("Href With Custom Message", async() => { | ||
assert(browser.assert.href); | ||
await utils.assertThrowsAssertionAsync(async() => { | ||
await browser.assert.href("a", "bad-link", "href fails"); | ||
}, `href fails`); | ||
}); | ||
|
||
it("Href On Css Link", async() => { | ||
await browser.assert.href("link", "styles.css"); | ||
}); | ||
|
||
it("Not Href", async() => { | ||
await browser.assert.not.href("a", "not-a-link.html"); | ||
}); | ||
it("Not Href From Node", async() => { | ||
const node = await browser.query("a"); | ||
await browser.assert.not.href(node, "not-a-link.html"); | ||
}); | ||
it("Not Href Throws", async() => { | ||
assert(browser.assert.not.href); | ||
await utils.assertThrowsAssertionAsync(async() => { | ||
await browser.assert.not.href("a", "html_simple.html"); | ||
}, `Expected element "a" not to have attribute "href" with value "html_simple.html".`); | ||
}); | ||
it("Not Href With Custom Message", async() => { | ||
assert(browser.assert.not.href); | ||
await utils.assertThrowsAssertionAsync(async() => { | ||
await browser.assert.not.href("a", "html_simple.html", "not href fails"); | ||
}, `not href fails`); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
const assert = require('assert'); | ||
const Wendigo = require('../../lib/wendigo'); | ||
const configUrls = require('../config.json').urls; | ||
|
||
describe("Url", function() { | ||
this.timeout(5000); | ||
let browser; | ||
|
||
before(async () => { | ||
browser = await Wendigo.createBrowser(); | ||
}); | ||
|
||
after(async() => { | ||
await browser.close(); | ||
}); | ||
|
||
|
||
it("Url", async() => { | ||
await browser.open(configUrls.index); | ||
assert.strictEqual(await browser.url(), "http://localhost:3456/index.html"); | ||
}); | ||
|
||
it("Changing Url", async() => { | ||
await browser.open(configUrls.index); | ||
assert.strictEqual(await browser.url(), "http://localhost:3456/index.html"); | ||
await browser.open(configUrls.click); | ||
assert.strictEqual(await browser.url(), "http://localhost:3456/click.html"); | ||
}); | ||
|
||
it("Url Before Opening", async() => { | ||
const browser2 = await Wendigo.createBrowser(); | ||
assert.strictEqual(await browser2.url(), null); | ||
browser2.close(); | ||
}); | ||
|
||
it("Dynamic Url Update", async() => { | ||
await browser.open(configUrls.url); | ||
assert.strictEqual(await browser.url(), "http://localhost:3456/url_history.html"); | ||
await browser.click(".btn"); | ||
assert.strictEqual(await browser.url(), "http://localhost:3456/new-url"); | ||
}); | ||
|
||
it("Click Link And Url Update", async() => { | ||
await browser.open(configUrls.index); | ||
await browser.click("a"); | ||
await browser.wait(); | ||
await browser.assert.url(configUrls.simple); | ||
}); | ||
}); |
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,57 @@ | ||
"use strict"; | ||
|
||
const Wendigo = require('../../lib/wendigo'); | ||
const configUrls = require('../config.json').urls; | ||
const utils = require('../utils'); | ||
|
||
describe("Wait For", function() { | ||
this.timeout(5000); | ||
let browser; | ||
|
||
before(async () => { | ||
browser = await Wendigo.createBrowser(); | ||
}); | ||
|
||
after(async() => { | ||
await browser.close(); | ||
}); | ||
|
||
it("Wait For", async () => { | ||
await browser.open(configUrls.click); | ||
await browser.assert.not.exists("#switch.off"); | ||
await browser.assert.exists("#switch.on"); | ||
await browser.click(".btn2"); | ||
await browser.waitFor("#switch.off", 600); | ||
await browser.assert.exists("#switch.off"); | ||
await browser.assert.text("#switch", "Off"); | ||
await browser.assert.not.exists("#switch.on"); | ||
}); | ||
|
||
it("Wait For Timeout", async() => { | ||
await browser.open(configUrls.click); | ||
await browser.assert.exists("#switch.on"); | ||
await browser.click(".btn2"); | ||
await utils.assertThrowsAsync(async () => { | ||
await browser.waitFor("#switch.off", 10); | ||
}, `Error: Waiting for element "#switch.off" failed, timeout of 10ms exceeded`); | ||
await browser.assert.not.exists("#switch.off"); | ||
await browser.assert.exists("#switch.on"); | ||
await browser.assert.text("#switch", "On"); | ||
}); | ||
|
||
it("Wait For With Existent Element", async () => { | ||
await browser.open(configUrls.click); | ||
await browser.assert.not.exists("#switch.off"); | ||
await browser.assert.exists("#switch.on"); | ||
await browser.waitFor("#switch.on"); | ||
await browser.assert.exists("#switch.on"); | ||
}); | ||
|
||
it("Wait For Fails With Invisible Element", async() => { | ||
await browser.open(configUrls.index); | ||
await browser.assert.exists(".hidden-text2"); | ||
await utils.assertThrowsAsync(async () => { | ||
await browser.waitFor(".hidden-text2", 10); | ||
}); | ||
}); | ||
}); |
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,42 @@ | ||
"use strict"; | ||
|
||
const Wendigo = require('../../lib/wendigo'); | ||
const configUrls = require('../config.json').urls; | ||
const utils = require('../utils'); | ||
|
||
describe("Wait Until Not Visible", function() { | ||
this.timeout(5000); | ||
let browser; | ||
|
||
before(async () => { | ||
browser = await Wendigo.createBrowser(); | ||
}); | ||
|
||
after(async() => { | ||
await browser.close(); | ||
}); | ||
|
||
it("Wait Until Not Visible", async () => { | ||
await browser.open(configUrls.click); | ||
await browser.click(".btn2"); | ||
await browser.waitUntilNotVisible("#switch.on", 600); | ||
await browser.assert.not.exists("#switch.on"); | ||
await browser.assert.exists("#switch.off"); | ||
}); | ||
|
||
it("Wait Until Not Visible With Non Existant Element", async () => { | ||
await browser.open(configUrls.click); | ||
await browser.waitUntilNotVisible(".not-exists"); | ||
await browser.assert.not.exists(".not-exists"); | ||
}); | ||
|
||
it("Wait Until Not Visible Timeout", async() => { | ||
await browser.open(configUrls.click); | ||
await browser.click(".btn2"); | ||
await utils.assertThrowsAsync(async () => { | ||
await browser.waitUntilNotVisible("#switch.on", 10); | ||
}, `Error: Waiting for element "#switch.on" not to be visible, timeout of 10ms exceeded`); | ||
await browser.assert.not.exists("#switch.off"); | ||
await browser.assert.exists("#switch.on"); | ||
}); | ||
}); |
Oops, something went wrong.