Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This is not an official Google product.
Icon made by Freepik from www.flaticon.com
Full stack solution leveraging Firebase, Polymer, and a Python Flask server on App Engine to create a live action game. Learn more at https://humansvszombies.org/
Pull requests very welcome and encouraged, to help you get started we have broken it down to the level you want to test against. As mentioned in CONTRIBUTING.md, we do need you to submit a CLA first, but that should be an easy process.
You may run against the fake JS server (do nothing), run against production, or create your own Firebase project.
Clone this project and follow the setup section if you are missing any dependencies
cd web
npm install
bower install
./node_modules/firebase-tools/bin/firebase login
./node_modules/firebase-tools/bin/firebase use --add trogdors-29fa4
If the last line fails with an "Invalid project selection" error, then run ./node_modules/firebase-tools/bin/firebase login to make sure you are logged in using the right account.
Copy the first relevant part of web/config_.json to web/config.json (i.e., remove the underscore)
npm start
Visit localhost:5000
Stop your webserver via Ctrl-C to abort
Run bower install paper-button
under web directory
- Copy the first relevant part of web/config_.json to web/config.json (i.e., remove the underscore)
- Restart your web server
- Go to
localhost:5000/?bridge=remote
These are one time firebase setup instructions along with backend configuration
-
Change config.json's backendUrl to be "http://localhost:8080/"
-
Open authentication using the left hand pane and enable (1) Google and (2) Email/Password
-
Open the users tab, create 8 users listed below
Use the same password (write it down, you'll need it if you want to run webdrivers)
-
Hit the copy button next to zella's name and put that into your config.py and config.json
Repeat for the remaining seven fake users.
-
In Firebase, open the web config and have these values ready to copy into the config.json file
-
In your project make a new web/config.json file, similar to the examples in web/config_.json and copy over the values
-
Run
./node_modules/firebase-tools/bin/firebase use --add
...your project...
(If this command fails with an "Invalid project selection" error, then run ./node_modules/firebase-tools/bin/firebase login to make sure you are logged in using the right account.)
- Restart your development environment and visit
localhost:5000/?bridge=remote
Fake Users |
---|
zella@playhvz.com |
deckerd@playhvz.com |
zeke@playhvz.com |
moldavi@playhvz.com |
jack@playhvz.com |
minny@playhvz.com |
reggie@playhvz.com |
drake@playhvz.com |
- Open your Firebase account page and use the gear icon to select the settings
- Make a copy of config_.py and name it config.py (remove the underscore)
- Back in Firebase copy your webconfig and place a copy into your newly created config.py
- Click on the Service Accounts tab and navigate to the Database Secrets sub tab.
- Show your the secrets key and copy it over for the FIREBASE_SECRET value in config.py.
- You can now run your server with
dev_appserver.py app.yaml
- You can also navigate your front end to use this server with localhost:5000/?bridge=remote as long as you setup your front end config's backend URL (config.json)
Install Node and NPM https://www.npmjs.com/get-npm
Add this to your ~/.bash_profile: export PATH=$PATH:[ghvz folder path here]/web/tests/macdrivers
for example: export PATH=$PATH:/Users/verdagon/Desktop/ghvz/web/tests/macdrivers
source ~/.bash_profile
(continue in the common section below)
Navigate to web/tests/linuxdrivers
. Run chmod +x chromedriver
to make the
chromedriver executable.
Note: If the default chromedriver does not work, you can download the latest version here.
Add this to your ~/.bashrc: export PATH=$PATH:[ghvz folder path here]/web/tests/linuxdrivers
for example: export PATH=$PATH:/Users/verdagon/Desktop/ghvz/web/tests/linuxdrivers
(continue in the common section below)
cd web/tests
pip install selenium
sudo goobuntu-add-repo -e cloud-sdk-trusty
sudo apt-get update
sudo apt-get install google-cloud-sdk
sudo apt-get install google-cloud-sdk-app-engine-python
(continue in the common section below)
- Go to https://cloud.google.com/appengine/downloads
- Click Python
- Click DOWNLOAD AND INSTALL THE CLOUD SDK
- Download and install that SDK.
(continue in the common section below)
cd backend
gcloud init
Set project to humansvszombies-24348 (You should have access to this, but if you don't see this or don't have access to this, ask someone on the team)
pip install -r requirements.txt -t lib
Copy config_.py to config.py
If you're running your server against the prod firebase instance, replace FIREBASE_SECRET with the key from https://console.firebase.google.com/project/trogdors-29fa4/settings/serviceaccounts/databasesecrets and replace the FIREBASE_CONFIG map with the map from clicking on "Web Setup" link at https://console.firebase.google.com/u/0/project/trogdors-29fa4/authentication
Start up the local server with dev_appserver.py app.yaml
Make sure you have webdriver setup by following instructions in the setup section above
First, start up your local server; the webdrivers assume something is running at localhost:5000
To run the webdrivers:
cd web/tests
python run.py --p PASSWORD [--url TARGET_URL] [SPECIFIC_TEST_NAMES] [-d|m] [-l|r] [-s|-max MAX_PARALLEL] [-cp NEW_PASSWORD] [-cmp MAX_PARALLEL] [-rr] [-rf]
Replacing ALLCAPS'd segments with your values.
PASSWORD
is the password for your fake account. To get passwords for fake test accounts, please ask someone on the team.SPECIFIC_TEST_NAMES
maps to test file names, minus the .py. This list of tests may have any number of elements. If no tests are specified, by default all are run.- If the first element in
SPECIFIC_TEST_NAMES
is not, all tests will be run EXCEPT those specified -d
uses desktop window sizing. Omitting this flag will run with mobile sizing instead.-m
uses mobile window sizing (default behavior).-l
indicates local server testing, and will rely on in-memory state rather than a database. User accounts defined in config.json will be used for tests.-r
indicates remote server testing, and will use your firebase and user account settings fromconfig.json
.-s
runs the tests sequentially (rather than in parallel)-max
specifies the maximum number of tests which can be run in parallel at a time (default is 3)-cp
changes the default password if the password flag is not provided.-cmp
changes maxParallel default - the default number of tests which will run together at a time-rr
reruns the same tests run last time run.py was run-rf
reruns tests that failed the last time run.py was run
Note: Bracketed segments are optional.
WARNING: This test will nuke our prod firebase. This is fine, everyone knows that that data could disappear at any moment. Though if two people run this test at the same time, it could fail. There's an open task on go/hvz-milestones (#201) to fix these particular inconveniences.
First, get a local backend server running. Then:
cd backend/
pip install requests
python backend_test.py
To launch a new version (once you have gcloud hooked in to the right app engine account):
gcloud app deploy app.yaml cron.yaml queue.yaml
- This is for historical reasons only, you should never need to do this.
firebase init
- (left database, functions, and hosting all checked, hit enter)
- selected Zeds
- let it use database.rules.json
- let it install dependencies
- for public directory, put client/
- when it asks about single page app, say no
./node_modules/firebase-tools/bin/firebase use --add trogdors-29fa4
(make sure you have the access to this project)
./node_modules/firebase-tools/bin/firebase deploy