Skip to content

Instantly share code, notes, and snippets.

View qswitcher's full-sized avatar

Jeffrey Russom qswitcher

  • Indeed.com
  • Austin, TX
  • 20:08 (UTC -05:00)
View GitHub Profile
async function waitForSearchResults() {
// check if oops page, if oops page, refresh
try {
return await (await browser.$(selectors.hit)).waitForExist(10000);
} catch (e) {
// check if it's an oops page
if (await isOopsPage()) {
// there was an oops page, refresh the page
console.error('Oops page, refreshing page....');
await browser.refresh();
const {
InMemoryCache
} = require('apollo-cache-inmemory');
const getQueryName = (query) => {
const defs = query.definitions;
if (defs && defs.length) {
const operationDefinition = defs.filter(
({kind}) => kind === 'OperationDefinition'
);
import { DocumentNode } from "graphql";
interface Query<TVariables> {
/* The GraphQL query shape to be used constructed using the `gql` template
* string tag from `graphql-tag`. The query will be used to determine the
* shape of the data to be read.*/
query: DocumentNode;
/**
* Any variables that the GraphQL query may depend on
interface ApolloCache<TSerialized> {
/**********************************************************
* Core API
*********************************************************/
/**
* Returns the cached results for a query if present
* @param query read options
*/
read<TResult, TVariables>(query: ReadOptions<TVariables>): TResult | null;
CodeBuild:
Type: 'AWS::CodeBuild::Project'
Properties:
Name: !Sub ${AWS::StackName}-CodeBuild
ServiceRole: !GetAtt CodeBuildRole.Arn
Artifacts:
# The downloaded source code for the build will come from CodePipeline
Type: CODEPIPELINE
Name: MyProject
Source:
AWSTemplateFormatVersion: 2010-09-09
Resources:
DeployBucket:
Type: 'AWS::S3::Bucket'
Properties:
# Technically we don't need the S3 bucket configured
# as a website, but I included it for the sake of completion.
WebsiteConfiguration:
IndexDocument: index.html
Distribution:
version: 0.1
phases:
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install
build:
commands:
- echo Build started on `date`
- npm run build
CodePipeline:
Type: 'AWS::CodePipeline::Pipeline'
Properties:
RoleArn: !GetAtt CodePipeLineRole.Arn
ArtifactStore:
Location: !Ref PipelineBucket
Type: S3
Stages:
-
Name: Source
Parameters:
GithubOwner:
Type: String
Default: qswitcher
Description: "Github repo owner"
GithubRepo:
Type: String
Default: my-test-app
Description: "Github repo name"
GithubOAuthToken:
AWSTemplateFormatVersion: 2010-09-09
Parameters:
ProjectSource:
Type: String
Default: "https://github.com/qswitcher/imgterest"
Description: "Source control URL (e.g. Github)"
GithubOwner:
Type: String
Default: qswitcher
GithubRepo: