Skip to content

Instantly share code, notes, and snippets.

View aleccool213's full-sized avatar
🏠
Working from home

Alec Brunelle aleccool213

🏠
Working from home
View GitHub Profile
{
"nodes": [
{
"id": "n0",
"label": "A node",
"x": 0,
"y": 0,
"size": 3
},
{
@aleccool213
aleccool213 / createResolver.ts
Last active November 21, 2019 14:34
A helper for apollo-local-state to create mutations much easier
import { IFieldResolver } from 'graphql-tools';
import { DocumentNode } from 'graphql';
import { ResolverContext } from '.';
interface InputVariablesShape<TInput> {
input: TInput;
}
/**
@aleccool213
aleccool213 / first_cypress_test.js
Created December 12, 2019 14:05
First Cypress Test on the Personal Blog
describe("The Home Page", () => {
it("successfully loads", () => {
cy.visit("/");
});
it("can visit a blog post link from the home page", () => {
cy.visit("/");
cy.get("#post-page-link").click();
declare global {
namespace Cypress {
interface Chainable<Subject> {
createFooBar: () => Chainable<string>;
}
}
}
/**
* Creates a foo and returns a bar.
Feature: Searching on DuckDuckGo
As a web surfer, I want to search DuckDuckGo, so that I can learn new things.
Background:
Given I am on DuckDuckGos website
Scenario: Simple DuckDuckGo search
When the search phrase "panda" is entered
Then results for "panda" are shown
import { Given } from 'cypress-cucumber-preprocessor/steps';
Given('I am on DuckDuckGos website', () => {
cy.visit('https://duckduckgo.com');
});
When('the search phrase "panda" is entered', () => {
...
});
/**
* Takes a snapshot of the application at the moment this method is called.
*
* When running in headless mode, it takes a snapshot with Percy, which is
* useful for testing purposes when integrated with our CI process.
*
* When running in headed mode, it takes a Cypress screenshot instead,
* which is more useful for allowing a developer to see a preview.
*
* @param description A string that describes the snapshot.
cypress-my-app:
working_directory: '~/Development/myapp'
parallelism: 3
steps:
- run:
name: 'Run cypress tests'
command: |
cypress run --record -- --parallel --group $CIRCLE_JOB --ci-build-id $CIRCLE_WORKFLOW_ID
"version": "0.0.0-development",
"publishConfig": { "access": "public", "branches": ["master"] }