The "Ask Darcel" web app.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app update hero (#610) Jan 21, 2019
docker/tiller chore(nginx): updated docker build to use latest stable nginx and rem… Oct 19, 2017
docs Import react starter kit. Apr 4, 2016
testcafe Issue #439: TestCafe tests for add/remove service schedule Dec 2, 2018
testing Autofixed linting issues Sep 30, 2018
tools fix(algolia): move fix for travisci overwrite to image build Nov 12, 2018
.babelrc Removed babel istanbul plugin Jun 9, 2018
.editorconfig Import react starter kit. Apr 4, 2016
.eslintignore Fixed all eslint issues and removed from eslintignore (#507) Sep 10, 2018
.eslintrc.js Closed/Open hours now behave as they should Nov 18, 2018
.flowconfig Import react starter kit. Apr 4, 2016
.gitattributes Import react starter kit. Apr 4, 2016
.gitignore Fixing resource website link issue #555 (#556) Sep 30, 2018
.nvmrc Upgrade versions of node and npm. Aug 26, 2018
.travis.yml Set Algolia environment variables in API server running for TestCafe … Oct 21, 2018
CONTRIBUTING.md Added basic contributor guidelines Mar 4, 2018
Dockerfile Fix algolia prefix (#583) Nov 11, 2018
LICENSE Add GPLv3 license. Sep 30, 2018
README.md Replace the old .env setup instructions with config.yml instructions (#… Nov 13, 2018
config.docker.yml Add Docker entrypoint to substitute in environment variables. Sep 13, 2018
config.example.yml Add new Google API key for use in staging/development. Oct 21, 2018
docker-compose.yml Fix webpack-dev-server command to work with TestCafe. Aug 27, 2018
package-lock.json Added tests for RelativeOpeningTimes component Nov 18, 2018
package.json Exit mocha tests after running Nov 18, 2018
powered-by-sauce-labs-badges-red.svg Add Sauce logo. Jul 26, 2018
travis-testcafe.sh Set Algolia environment variables in API server running for TestCafe … Oct 21, 2018
webpack.config.js Revert "Added hashing to bundle.js for invalidation (#333)" Oct 18, 2018

README.md

ShelterTech Web App Travis CI Status

Sauce Labs Browser Test Status

Sauce Test Status

Docker-based Development Environment (Recommended)

Requirements

Docker Community Edition (CE) >= 17.06 Docker Compose >= 1.18

Follow the Docker installation instructions for your OS.

Set up the project

This is not a full guide to Docker and Docker Compose, so please consult other guides to learn more about those tools.

The docker-compose.yml is configured to mount the git repo on your host filesystem into the Docker container so that any changes you make on your host machine will be synced into the container and vice versa.

Creating the config.yml file

All config should be added in a file called config.yml. A sample config.example.yml is provided, you need to copy it and edit any parts that ask you to enter in your own information.

$ cp config.example.yml config.yml

# Open it in your preferred text editor
Algolia

Algolia is used as our search engine and in order for it to operate properly for everyone, we each need our own index.

  • in config.yml set your github username as the value for ALGOLIA_INDEX_PREFIX. This will point to the search index matching your local environment.

Building and running the application

# Install node dependencies
$ docker-compose run --rm web npm install

# Build static assets bundle
$ docker-compose run --rm web npm run build

# Run dev server
$ docker-compose up

You should be able to view the web app in your browser at http://localhost:8080.

By default, this assumes that you have also set up askdarcel-api project using the Docker setup instructions and that the API server is running. If you want to target a different instance of askdarcel-api, you can modify the API_URL environment variable in docker-compose.yml.

Non-Docker Development Environment

Installing Node.js and npm

We recommend using nvm (Node Version Manager) or Docker to ensure that the versions of Node.js and npm are the same across development, Travis CI, staging, and production environments.

After installing nvm, to install both Node.js and npm run from the top of the git repo:

$ nvm install  # Reads from .nvmrc

Installing npm dependencies

To install the dependencies, from the top directory run

npm install

To build the bundled script with webpack run

npm run build

And to run the dev server, run

npm run dev

End to end testing

Quick summary of what TestCafe is and how it works

It's a framework for running end-to-end tests (read: real browser tests) that injects your tests onto an existing web page. Architecturally, they spin up a lightweight proxy server that wraps your web page, and when you connect a browser to the proxy server, it serves the requested page with the test driver injected into it.

It's essentially an alternative to writing Selenium tests, and I've found it nice to use because it mimics many of the common HTML5 DOM APIs and because they've added a lot of reasonable default behavior that Selenium lacks, such as properly waiting for events to finish running and for elements to appear before running your assertions.

How to run

If you are not using Docker and all the services are bound to localhost, then you should just be able to run:

$ npm run testcafe -- --skip-js-errors chrome testcafe/*.js

Note: Make sure you have the dev server running (npm run dev) before you try running the above

If you are using Docker, then you'll need to run it somewhat like this:

$ docker-compose run --rm -p 1337:1337 -e BASE_URL=http://web:8080 web npm run testcafe -- --skip-js-errors remote --skip-js-errors --hostname localhost --ports 1337,1338 ./testcafe/

This will spin up a web server at http://localhost:1337/ and print out a URL to use. You should manually enter it into your browser to start the tests.

Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs

Powered By Sauce Labs