Skip to content

Instantly share code, notes, and snippets.

View IcodeNet's full-sized avatar
😀

Byron Thanopoulos IcodeNet

😀
View GitHub Profile
@IcodeNet
IcodeNet / steps to use a react-scripts-custom-name in order to use create-react-app
Created October 14, 2018 11:41
create-react-app --scripts-version=react-scripts-ts
Here are all the steps I used to get a custom fork working in case anyone else gets as stuck as I did 😃
Forked the create-react-app repo and cloned it locally
Changed the package name in packages/react-scripts/package.json to be a new custom name - such as react-scripts-ts or react-scripts-custom-name
Changed the 'react-scripts' reference in packages/react-scripts/scripts/init.js#L17 to match the new package name I chose
Then I did a cd packages/react-scripts followed by an npm publish which published successfully perhaps in local Artifactory/Proget
Which then resulted in create-react-app test-app --scripts-version react-scripts-custom-name working as expected
  • Start by creating an enum that contains the different action types

Each Action type will have a origin (page) and an declares an Event (Something that has happened)

  import { Action } from '@ngrx/store';
  import {Aplication } from './domain/appication';
  
 export enum ApplicationActionTypes {
/* GIST NAME*/

in Cypress there are always 3 frames.

  • top (which is the main cypress application).
  • spec file (which is your individual spec file) and
  • app (the remote application)

so if you're inside of a spec or support file, you need to do window.app to point to the app

top.app = cy.state('window'); .... // then access top.app
@IcodeNet
IcodeNet / Cypress-LoopAndRunTests.js
Last active November 19, 2017 12:05
Cypress - looping through each of your specs and then iteratively running them.
const cypress = require('cypress')
const Promise = require('bluebird')
const glob = Promise.promisify(require('glob'))
const started = new Date()
let numFailed = 0
return glob('cypress/integration/**/*', {
nodir: true,
let gaScriptStripped = false;
Cypress.on('window:before:load', function(win) {
let createElement = win.document.createElement;
win.document.createElement = function(tag) {
if (tag === 'script' && win.document.currentScript.innerHTML.includes('google-analytics.com')) {
tag = 'custom_script';
gaScriptStripped = true;
@IcodeNet
IcodeNet / e2e-shadowdom.md
Created October 27, 2017 22:37 — forked from ChadKillingsworth/e2e-shadowdom.md
Selenium Testing with Shadow DOM

End-to-end Testing with Shadow DOM

As the web component specs continue to be developed, there has been little information on how to test them. In particular the /deep/ combinator has been deprecated in Shadow DOM 1.0. This is particularly painful since most end-to-end testing frameworks rely on elements being discoverable by XPath or calls to querySelector. Elements in Shadow DOM are selectable by neither.

WebDriver.io

Webdriver.io has the standard actions by selectors, but also allows browser executable scripts to return an element

@IcodeNet
IcodeNet / example.ts
Created June 1, 2017 08:06 — forked from mhevery/example.ts
Angular2: NgProbe Design
// https://gist.github.com/mhevery/4b1bdb59a8c16f9cbe76
/// <reference path="probe.d.ts" />
///////////////////////
/// WORK IN PROGRESS //
///////////////////////
var appRef: ApplicationRef = ng.platform.applications[0];
/**
* Zone is a mechanism for intercepting and keeping track of asynchronous work.
*
* A Zone is a global object which is configured with rules about how to intercept and keep track
* of the asynchronous callbacks. Zone has these responsibilities:
*
* 1. Intercept asynchronous task scheduling
* 2. Wrap callbacks for error-handling and zone tracking across async operations.
* 3. Provide a way to attach data to zones
* 4. Provide a context specific last frame error handling
@IcodeNet
IcodeNet / microsyntax.md
Created June 1, 2017 07:57 — forked from mhevery/microsyntax.md
Angular microsyntax gramar

Microsyntax

Microsyntax in Angular allows you to write <div *ngFor="let item of items">{{item}}</div> instead of <ng-template ngFor [ngForOf]="items"><div>{{item}}</div></ng-template.

Constraints

The microsyntax must:

  • be know ahead of time so that IDEs can parse it without knowing what is the underlying semantics of the directive or what directives are present.
  • must translate to key-value attributes in the DOM.