Skip to content

Instantly share code, notes, and snippets.

View wingsuitist's full-sized avatar

Sam Felix wingsuitist

  • Basel
View GitHub Profile
@wingsuitist
wingsuitist / app.po.ts
Last active July 8, 2017 18:29
angular 4 protractor end 2 end testing - page object for e2e test
import { browser, by, element } from 'protractor';
export class LetslearnPage {
navigateTo() {
return browser.get('/');
}
getTitle() {
return element(by.css('lsl-root h1')).getText();
@wingsuitist
wingsuitist / app.component.html
Last active July 7, 2017 14:17
angular 4 protractor end 2 end testing - simple component
<h1>{{title}}</h1>
<div>
Points: <span>{{points}}</span>
</div>
<button (click)="plus1()">Plus 1</button>
<button (click)="reset()">Reset</button>
@wingsuitist
wingsuitist / karma.conf.js
Created July 5, 2017 09:26
karma.conf.js: Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS. Raw Raw
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
@wingsuitist
wingsuitist / .gitlab-ci.yml
Last active May 30, 2018 13:51
gitlab-ci.yml : Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS. Raw Raw Raw
image: node:latest
cache:
paths:
- node_modules/
test_letslearn:
script:
- npm install
- ./node_modules/@angular/cli/bin/ng test --single-run=true --browsers PhantomJS --watch=false
@wingsuitist
wingsuitist / gist:b713944adc08c878d033471703ed44c1
Last active July 15, 2018 18:01
git: : Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS. Raw Raw
git remote add origin git@gitlab.com:XXyour_userXX/XXyour_projectXX.git
git add -A
git commit -m 'TDD from letsboot rocks!'
git push -u origin master
@wingsuitist
wingsuitist / polyfills.ts
Created June 30, 2017 11:22
polyfills: Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS. Raw
/* ... */
/* enable these */
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
@wingsuitist
wingsuitist / app.component.html
Created June 30, 2017 09:27
app-component: Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS.
<h1>{{title}}</h1>
{{points}}
<button (click)="plus1()">plus1</button>
@wingsuitist
wingsuitist / app.component.spec.ts
Last active June 30, 2017 09:59
app-component test: Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS.
import { async, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser'; /* add this to use By.css('button') */
import { AppComponent } from './app.component';
describe('AppComponent', () => {
/* ... */
it(`should have as title 'lsl'`, async(() => {
/* ... */
@wingsuitist
wingsuitist / new-letslearn-app.sh
Last active July 1, 2017 15:13
Angular 4 and testing: angular/cli + gitlab-ci + ng test + PhantomJS.
npm install -g @angular/cli
ng --version # tutorial tested with: @angular/cli: 1.2.0, node: 8.1.2
ng new letslearn --prefix lsl
cd letslearn
ng serve -o
@wingsuitist
wingsuitist / docker-machine-net-consul.sh
Last active September 13, 2016 09:55
Docker machine net example
#!/bin/bash
export SWARM_KV="kv"
export SWARM_NODES="node1 node2 node3"
for node in $SWARM_KV ; do docker-machine create -d virtualbox $node; done
eval $(docker-machine env kv) ;
docker run -d -p 8500:8500 gliderlabs/consul-server -data-dir=/tmp -bind=0.0.0.0 -bootstrap