-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8612b6
commit 7877387
Showing
11 changed files
with
175 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules/* | ||
npm-debug.log | ||
selenium-debug.log | ||
tasks/node_modules/* | ||
tasks/json/* | ||
tasks/npm-debug.log | ||
|
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ plugins/ | |
.travis.yml | ||
.eslintrc.json | ||
.eslintignore | ||
abe.json | ||
abe.json | ||
selenium-debug.log |
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,90 @@ | ||
const SCREENSHOT_PATH = "./screenshots/"; | ||
const BINPATH = './node_modules/nightwatch/bin/'; | ||
|
||
module.exports = { | ||
"src_folders": [ | ||
"tests/functional" | ||
], | ||
"output_folder": "./reports", | ||
"test_runner" : "mocha", | ||
"selenium": { | ||
"start_process": true, | ||
"server_path": "./node_modules/nightwatch/bin/selenium.jar", | ||
"host": "127.0.0.1", | ||
"port": 4444, | ||
"cli_args": { | ||
"webdriver.chrome.driver" : "./node_modules/nightwatch/bin/chromedriver" | ||
} | ||
}, | ||
"test_settings": { | ||
"default": { | ||
"launch_url" : "http://localhost:3003/abe/editor", | ||
"silent": true, | ||
"screenshots": { | ||
"enabled": false, | ||
"path": '' | ||
}, | ||
"globals": { | ||
"waitForConditionTimeout": 3000 | ||
}, | ||
"desiredCapabilities" : { | ||
"browserName" : "chrome", | ||
"javascriptEnabled" : true, | ||
"acceptSslCerts" : true, | ||
"chromeOptions" : { | ||
"args" : ["start-fullscreen"] | ||
} | ||
} | ||
}, | ||
"chrome": { | ||
"desiredCapabilities": { | ||
"browserName": "chrome", | ||
"javascriptEnabled": true, | ||
"acceptSslCerts" : true, | ||
"chromeOptions" : { | ||
"args" : ["start-fullscreen"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* selenium-download does exactly what it's name suggests; | ||
* downloads (or updates) the version of Selenium (& chromedriver) | ||
* on your localhost where it will be used by Nightwatch. | ||
/the following code checks for the existence of `selenium.jar` before trying to run our tests. | ||
*/ | ||
|
||
require('fs').stat(BINPATH + 'selenium.jar', function (err, stat) { // got it? | ||
if (err || !stat || stat.size < 1) { | ||
require('selenium-download').ensure(BINPATH, function(error) { | ||
if (error) throw new Error(error); // no point continuing so exit! | ||
console.log('✔ Selenium & Chromedriver downloaded to:', BINPATH); | ||
}); | ||
} | ||
}); | ||
|
||
function padLeft (count) { | ||
return count < 10 ? '0' + count : count.toString(); | ||
} | ||
|
||
var FILECOUNT = 0; | ||
/** | ||
* The default is to save screenshots to the root of your project even though | ||
* there is a screenshots path in the config object above! ... so we need a | ||
* function that returns the correct path for storing our screenshots. | ||
* While we're at it, we are adding some meta-data to the filename, specifically | ||
* the Platform/Browser where the test was run and the test (file) name. | ||
*/ | ||
function imgpath (browser) { | ||
var a = browser.options.desiredCapabilities; | ||
var meta = [a.platform]; | ||
meta.push(a.browserName ? a.browserName : 'any'); | ||
meta.push(a.version ? a.version : 'any'); | ||
meta.push(a.name); // this is the test filename so always exists. | ||
var metadata = meta.join('~').toLowerCase().replace(/ /g, ''); | ||
return SCREENSHOT_PATH + metadata + '_' + padLeft(FILECOUNT++) + '_'; | ||
} | ||
|
||
module.exports.imgpath = imgpath; | ||
module.exports.SCREENSHOT_PATH = SCREENSHOT_PATH; |
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
Submodule demo
added at
a4f23d
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,47 @@ | ||
describe('Abe', function() { | ||
|
||
describe('operations', function() { | ||
|
||
before(function(client, done) { | ||
done(); | ||
}); | ||
|
||
after(function(client, done) { | ||
client.end(function() { | ||
done(); | ||
}); | ||
}); | ||
|
||
afterEach(function(client, done) { | ||
done(); | ||
}); | ||
|
||
beforeEach(function(client, done) { | ||
done(); | ||
}); | ||
|
||
it('Create a single article', function(client) { | ||
client | ||
.url('http://localhost:3003/abe/editor') | ||
.waitForElementVisible('body') | ||
.assert.title('Abe') | ||
.click('select[id="level-1"] option:nth-child(2)') | ||
.click('select[name="selectTemplate"] option[value="single"]') | ||
.waitForElementVisible('div[data-precontrib-templates=single]', 1000) | ||
.setValue('div[data-precontrib-templates=single] > div > input', 'ftest') | ||
.click('button[type="submit"]') | ||
.waitForElementVisible('form[id="abeForm"]', 2000) | ||
.assert.urlEquals("http://localhost:3003/abe/editor/articles/ftest.html", "Clicked URL Matches with URL of the New Window") | ||
.end(); | ||
}); | ||
|
||
it('The created single article is found in the manager', function(client) { | ||
client | ||
.useXpath() | ||
.url('http://localhost:3003/abe/editor') | ||
.waitForElementVisible('//body') | ||
.assert.containsText("//table[@id='navigation-list']/tbody/tr[1]/td[2]/a", "/articles/ftest.html") | ||
.end(); | ||
}); | ||
}); | ||
}); |
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,11 @@ | ||
define({ | ||
capabilities: { | ||
'browserstack.selenium_version': '2.45.0' | ||
}, | ||
environments: [{ browserName: 'chrome' }], | ||
maxConcurrency: 2, | ||
tunnel: 'NullTunnel', | ||
suites: [], | ||
functionalSuites: [ 'tests/functional/index' ], | ||
excludeInstrumentation: /^(?:tests|test|node_modules)\// | ||
}); |