Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

amaze-tdd

Package Overview
Dependencies
80
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.8 to 0.2.9

plugins/crx/5.1.1_0.crx

88

lib/amaze.js

@@ -5,5 +5,13 @@ #!/usr/bin/env node

* Amaze testing suite
* v.0.2.8
* https://npmjs.org/package/amaze-tdd
*
* https://npmjs.org/package/amaze-tdd
* Repo: https://bitbucket.org/dmusser/amaze-tdd
* Issues/Bugs: https://bitbucket.org/dmusser/amaze-tdd/issues
* Wiki/Docs: https://bitbucket.org/dmusser/amaze-tdd/wiki
*
* Author:
* Chris Rodriguez
*
* Contributors:
* Tony Kornmeier
*/

@@ -21,17 +29,31 @@

const driverDir = path.join(__dirname, '../');
const v = JSON.parse(fs.readFileSync(driverDir + '/package.json', 'utf8')).version;
const color = require('cli-color');
const maps = {
log: color.greenBright,
warn: color.yellowBright,
error: color.redBright
};
var flags = process.argv;
var chrome;
var client;
var options;
var capabilities;
var mocha;
var Amaze;
if (flags.indexOf('phantomjs') > -1) {
client = new webdriver.Builder().forBrowser('phantomjs');
if (flags.indexOf('headless') > -1) {
capabilities = {
'browserName': 'phantomjs',
'phantomjs.cli.args': [
'--webdriver-loglevel=ERROR'
]
}
client = new webdriver.Builder().withCapabilities(capabilities);
} else {
chrome = require('../node_modules/selenium-webdriver/chrome');
options = new chrome.Options();
options.addExtensions(driverDir + '/selenium/crx/5.1.1_0.crx');
client = new webdriver.Builder().forBrowser('chrome').setChromeOptions(options);
capabilities = new chrome.Options();
capabilities.addExtensions(driverDir + '/plugins/crx/5.1.1_0.crx');
client = new webdriver.Builder().forBrowser('chrome').setChromeOptions(capabilities);
}

@@ -54,5 +76,28 @@

Assert: require('chai').assert,
$: require('selenium-query')
jQuery: require('selenium-query')
};
function packageFile(file) {
let parts = file.split('/');
let f = parts[parts.length - 1];
if (fs.existsSync('./specs')) {
if (fs.existsSync('./specs/' + f)) {
return true;
} else {
fs.createReadStream(file).pipe(fs.createWriteStream('./specs/' + f));
}
} else {
let mkdir = require('mkdirp');
mkdir('./specs', function(err) {
if (err) {
console.log(err);
} else {
fs.createReadStream(file).pipe(fs.createWriteStream('./specs/' + f));
}
});
}
}
function isDemo(file) {

@@ -76,4 +121,5 @@ let parts = file.split('/');

glob('./**/*-spec.js', function(err, files) {
if (err) return console.log(err);
glob('./**/*-spec.js', { ignore: './specs/*-spec.js'}, function(err, files) {
if (err) return console.log(maps.error(err));
console.log(color.bold('\n>> AMAZE-TDD ' + v));

@@ -83,12 +129,22 @@ if (flags.indexOf('sanity-check') > -1) {

for (let i = 0; i < only.length; i++) {
packageFile(only[i]);
Amaze.Mocha.addFile(only[i]);
}
console.log(maps.log('OK Skipping configuration file check.'));
} else {
let only = files.filter(isNotDemo);
for (let i = 0; i < only.length; i++) {
packageFile(only[i]);
Amaze.Mocha.addFile(only[i]);
}
if (fs.statSync(process.cwd() + '/.amazerc')) {
if (fs.existsSync(process.cwd() + '/.amazerc')) {
Amaze.Configs = require(process.cwd() + '/.amazerc');
fs.createReadStream(process.cwd() + '/.amazerc')
.pipe(fs.createWriteStream('./specs/.amazerc'));
console.log(maps.log('OK Configuration file found!'));
} else {
console.log(maps.warn('OK No configuration file found, moving on.'));
}

@@ -98,10 +154,6 @@ }

if (Amaze.Mocha.files.length > 0) {
console.log(maps.log('OK Running tests!'));
Amaze.Mocha.run();
} else {
try {
throw new Error('No tests to run.\n');
return false;
} catch (e) {
return console.log(e.name + ': ' + e.message);
}
console.log(maps.error('ER No tests to run!\n'));
}

@@ -108,0 +160,0 @@ });

{
"name": "amaze-tdd",
"version": "0.2.8",
"version": "0.2.9",
"author": {

@@ -13,3 +13,5 @@ "name": "Chris Rodriguez",

"chromedriver": "2.24.1",
"cli-color": "^1.1.0",
"glob": "7.1.1",
"mkdirp": "^0.5.1",
"mocha": "3.1.2",

@@ -16,0 +18,0 @@ "selenium-query": "0.50.35",

@@ -7,2 +7,3 @@ # Amaze test-driven development

* Chai
* jQuery
* selenium-webdriver

@@ -21,3 +22,3 @@ * Chrome and PhantomJS

Ensure the testing suite is required at the top of the test. We use ES2015. Instantiate a global variable for Browser.
Ensure the testing suite is required at the top of the test. We use ES2016. Instantiate a global variable for Browser.

@@ -27,2 +28,3 @@ ```

var Browser;
var $;
```

@@ -36,2 +38,22 @@

Optionally, you may instantiate a `$` variable for a more familiar jQuery interface.
```
$ = Amaze.jQuery;
```
If you do this, you can then target web objects like you would a jQuery object, like...
```
$(Object).find('something')...
```
...instead of...
```
Amaze.jQuery(Object).find('something')...
```
It's not much, but it's something :-)
Tests should be written asynchronously due to Selenium's asynchronous nature. We should return something or use an expectation/assertion which returns a promise. An example test has been included for reference. We have also created [further documentation on writing tests](docs/index.md) to help you write good tests.

@@ -49,5 +71,5 @@

Additionally, you may use PhantomJS to headlessly test the interfaces. No browser plugin is required and no browsers will spawn, which may speed up tests. Add the `phantomjs` option:
Additionally, you may use PhantomJS to headlessly test the interfaces. No browser plugin is required and no browsers will spawn, which may speed up tests. Add the `headless` option:
`node node_modules/amaze-tdd phantomjs`
`node node_modules/amaze-tdd headless`

@@ -67,2 +89,6 @@ ## Test files

## Deliverables
Along with the standard compiled `.js` file, you may also deliver the `specs` folder. When you run your tests, they're copied into this folder for easy delivery. The only thing your customer will need to do is install this NPM suite.
## Contributing

@@ -74,4 +100,13 @@

### 0.2.9
* Removed bundled drivers as they can be found elsewhere and makes this package about 40MB smaller
* Updated the check for local configuration files
* Added documentation for a familiar jQuery experience
* Renamed a folder to better suit its contents
* Added functionality that packages all specs for delivery
* Silenced the logging when using a headless browser (e.g. PhantomJS)
* Added process logging for transparency with colors!
### 0.2.8
* Changed the way the script checks for local configuration files.
* Changed the way the script checks for local configuration files

@@ -93,3 +128,3 @@ ### 0.2.7

* Using Chrome as default and PhantomJS for `phantomjs` option
* Refactored some files to use ES2015, more on the way
* Refactored some files to use ES2016, more on the way
* Included an ESlint config file and devDependencies

@@ -96,0 +131,0 @@ * Increased global timeout to 30s allowing removal of individual overrides

@@ -5,2 +5,3 @@ 'use strict';

var Browser;
var $;

@@ -11,2 +12,3 @@ suite('Sanity check: perform a Google search', function() {

Browser = Amaze.Client.build();
$ = Amaze.jQuery;
});

@@ -25,3 +27,3 @@

test('it can find the search box', function() {
return Amaze.$(Browser).find('input[name="q"]').then(function(search) {
return $(Browser).find('input[name="q"]').then(function(search) {
Amaze.Expect(search).to.have.length.above(0);

@@ -33,4 +35,4 @@ });

return Browser.get('https://google.com?noj=1').then(function() {
return Amaze.$(Browser).find('input[name="q"]').then(function(search) {
return Amaze.$(search).val('Deque accessibility').then(function() {
return $(Browser).find('input[name="q"]').then(function(search) {
return $(search).val('Deque accessibility').then(function() {
search.sendKeys(Amaze.Webdriver.Key.ENTER);

@@ -37,0 +39,0 @@ return Browser.getTitle().then(function(title) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc