Skip to content

Instantly share code, notes, and snippets.

View rasmar's full-sized avatar

Marcin Raszkiewicz rasmar

View GitHub Profile
@rasmar
rasmar / Gemfile
Last active February 20, 2018 18:30
E2E - Gemfile
...
group :test do
...
gem "capybara", "~> 2.7", ">= 2.7.1"
gem "chromedriver-helper", "~> 1.0"
gem "rspec_junit_formatter" # Preparing proper output for CircleCI test metadata
gem "selenium-webdriver", "~> 2.53", ">= 2.53.4"
end
@rasmar
rasmar / .e2e.env
Created December 22, 2017 10:16
E2E - env var
LOCAL_E2E=true
@rasmar
rasmar / rails_helper.rb
Last active February 20, 2018 18:35
E2E - rails_helper
require "capybara/rails"
require "selenium-webdriver"
...
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: { "chromeOptions" => { "args" => %w[window-size=1024,768] } },
@rasmar
rasmar / spec_helper.rb
Created December 22, 2017 10:49
E2E - spec_helper
require "capybara/rspec"
@rasmar
rasmar / circle.yml
Last active February 20, 2018 19:43
E2E - backend circle.yml
machine:
services:
- redis
environment:
ES_JAVA_OPTS: "-Xms2g -Xmx2g"
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
CONTINUOUS_INTEGRATION: true
dependencies:
post:
- if [[ ! -e elasticsearch-5.5.1 ]]; then wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz && tar -xvf elasticsearch-5.5.1.tar.gz; fi
@rasmar
rasmar / package.json
Created December 22, 2017 11:35
E2E - package
"scripts": {
"build": "react-scripts build",
...
"start": "react-scripts start",
"start-test": "REACT_APP_API_BASE_URL=http://localhost:5001 react-scripts start",
...
@rasmar
rasmar / homepage_spec.rb
Created December 22, 2017 11:52
E2E - simple homepage test
require 'rails_helper'
feature 'Home page', js: true do
scenario 'visit home page' do
visit '/'
expect(current_path).to eq '/'
expect(page.first('span').text).to eq("How Jaacoo works")
end
end
@rasmar
rasmar / Dockerfile
Last active March 9, 2018 12:15
E2E - starting dockerfile
## specify node version
FROM quay.io/netguru/ng-node:6 as builder # First 'FROM', as builder is used as reference below
## add necessary environments
ENV NODE_ENV staging # Set env var
## add code & build app
ADD . $APP_HOME # Copy / add external source to image's filesystem
RUN yarn install # Install all dependencies for frontend app
RUN yarn build # Compile frontend build
@rasmar
rasmar / Dockerfile.e2e
Last active March 9, 2018 12:15
E2E - final Dockerfile
## Real app image
FROM nginx:alpine # Remove 'as app'
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 3000
@rasmar
rasmar / circle.yml
Last active December 22, 2017 12:58
E2E - add single stage
dependecies:
pre:
...
- pyenv rehash
- docker build -t frontend_img -f Dockerfile.e2e.build . # Builds image from Dockerfile.e2e.build (with our front app)
- docker create --name frontend_pre frontend_img # Creates container from image
- docker cp frontend_pre:/app/build ./tmp # Copies /app/build directory (compiled app) from a container to ./tmp in CircleCI machine
...