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
Given('I do a custom login', function(credentials) { | |
const { username, password } = credentials; | |
const agent = this.currentAgent; | |
await agent | |
.post(this.replaceVars(`${base}/api/login`)); | |
.send({ | |
username, | |
password, | |
}); |
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
const { getRandomWord } = require('word-maker'); | |
const getFizzBuzz = n => `${n % 3 === 0 ? 'Fizz' : ''}${n % 5 === 0 ? 'Buzz' : ''}`; | |
async function getResults() { | |
const promises = Array(100).fill().map(async (v, i) => { | |
i++; | |
try { | |
return `${i}: ${getFizzBuzz(i) || await getRandomWord({ withErrors: true })}`; | |
} catch (err) { |
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
parseInt(10); // eslint-disable-line rule-name |
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
import { createRouter } from 'router'; | |
const router = createRouter([ | |
{ | |
path: '/foo:/ | |
view: <MyComponent /> | |
enter: ({ foo }) => store.loadVenue(foo); | |
}, | |
paths: [ '/foo:/', 'bar:/' ], | |
view: <SomethingElse /> |
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
const userAgent = typeof window !== 'undefined' ? window.navigator.userAgent : 'no-window'; | |
const isBot = /bot|crawler|spider|crawling/i.test(userAgent); | |
export class ServerLogStream { | |
constructor(opts = {}) { | |
const { | |
writeCondition = ServerLogStream.defaultWriteCondition, | |
} = opts; |
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
var casper = require('casper').create({ | |
verbose: true, | |
logLevel: 'info' | |
}); | |
var page = require('webpage').create(); | |
var utils = require('utils'); | |
//args | |
var base = casper.cli.get('out'); | |
var width = parseInt(casper.cli.get("width")); |
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
var items = [{ | |
html: '<p>One</p>' | |
}, { | |
html: '<p>Two</p>' | |
}, { | |
html: '<p>Three</p>' | |
}]; | |
var html = items.reduce(function(html, item) { | |
html.push(item.html); |
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
//little util to do tidier directory concatenation | |
function dir() { | |
var args = Array.prototype.slice.call(arguments); | |
var prefix = ""; | |
if(args[0] === "!") { | |
prefix = args[0]; | |
args.shift(); | |
} | |
return prefix + args.join("/"); | |
} |
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
/** | |
* Asserts a microdata item value matches the given expected value in the remote DOM environment | |
* Depends on the casper.fetchMicrodata method | |
* | |
* @param itemType {String} The item type of the item scopes to look for properties in | |
* @param property {String} The name of the property the compare the expected value against | |
* @param expectedItemValue {String} The expected value of the item property | |
* @param message {String} The assertion message | |
* @param itemTypeIndex {Number} A specific index of an item scope to use. If omitted or null, will look for matches in | |
* all item scopes |
NewerOlder