Skip to content

Instantly share code, notes, and snippets.

View NicholasBoll's full-sized avatar

Nicholas Boll NicholasBoll

  • Workday
  • Boulder, CO
View GitHub Profile
@NicholasBoll
NicholasBoll / todo_spec.ts
Last active February 15, 2018 07:18
Cypress command composition
export const createTodo = (name: string) => {
cy.get('.new-todo').type(`${name}{enter}`)
return cy
.get('.todo-list')
.contains('li', name.trim())
.first()
}
export const updateTodo = (name: string) => ($todo: JQuery) => {
@NicholasBoll
NicholasBoll / promiseExample.ts
Last active February 5, 2018 14:27
Example of a promise chain
interface Todo {
id: string
name: string
done: boolean
}
const createTodo = (name: string) => new Promise<Todo>((resolve) => {
setTimeout(
resolve,
100,
@NicholasBoll
NicholasBoll / myCustomCommand.ts
Last active November 18, 2020 12:28
Adding Custom Cypress command
declare namespace Cypress {
interface Chainable<Subject> {
myCustomCommand(username: string, password: string): Cypress.Chainable<Response>
}
}
Cypress.Commands.add('myCustomCommand', (username: string, password: string) => {
Cypress.log({
name: 'loginByForm',
@NicholasBoll
NicholasBoll / async_testing.js
Created August 18, 2015 18:57
Async AngularJS testing
describe('getFormattedCustomerInfo-async', function(){
var customerService;
var customerFormattingService;
var $q;
var $scope;
beforeEach(function(){
module('customer');
inject( function($injector){
customerService = $injector.get('customer-service');
customerFormattingService = $injector.get('customer-formatting-service-async');