From 4c3d50aabdffe704f69905838ebadcd73972c5f3 Mon Sep 17 00:00:00 2001
From: browniecab <cody.browne@blindsidenetworks.com>
Date: Thu, 30 Aug 2018 15:21:49 -0400
Subject: [PATCH] Add instructions to readme

(cherry picked from commit 016f7732620bc40ec6c526c563f66a359d36de15)
---
 .travis.yml                                   |  2 ++
 bigbluebutton-html5/test-html5.sh             |  1 +
 .../{.env_template => .env-template}          |  0
 bigbluebutton-html5/tests/puppeteer/README.md | 33 ++++++++++++++++++-
 .../tests/puppeteer/html5-check.js            |  4 +--
 5 files changed, 37 insertions(+), 3 deletions(-)
 rename bigbluebutton-html5/tests/puppeteer/{.env_template => .env-template} (100%)

diff --git a/.travis.yml b/.travis.yml
index 83fba39226..a56353e148 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,3 +22,5 @@ script:
 
 after_script:
   - docker stop $docker
+  - docker rm $docker
+  - docker rmi b2
diff --git a/bigbluebutton-html5/test-html5.sh b/bigbluebutton-html5/test-html5.sh
index 932445ec99..a01532a018 100755
--- a/bigbluebutton-html5/test-html5.sh
+++ b/bigbluebutton-html5/test-html5.sh
@@ -25,3 +25,4 @@ fi
 
 # Stop Docker container
 docker stop $docker
+docker rm $docker
diff --git a/bigbluebutton-html5/tests/puppeteer/.env_template b/bigbluebutton-html5/tests/puppeteer/.env-template
similarity index 100%
rename from bigbluebutton-html5/tests/puppeteer/.env_template
rename to bigbluebutton-html5/tests/puppeteer/.env-template
diff --git a/bigbluebutton-html5/tests/puppeteer/README.md b/bigbluebutton-html5/tests/puppeteer/README.md
index 4b51d97630..851987f663 100644
--- a/bigbluebutton-html5/tests/puppeteer/README.md
+++ b/bigbluebutton-html5/tests/puppeteer/README.md
@@ -1 +1,32 @@
-# bigbluebutton-tests
\ No newline at end of file
+# BigBlueButton Puppeteer Tests
+
+Tests for BigBlueButton using Puppeteer, Chromium and Jest.
+
+## Setup
+
+To run these tests, you will need the following:
+* Ubuntu 16.04 or later
+* Node.js 8.11.4 or later
+* Docker
+
+These instructions assume you have the BigBlueButton repository cloned into a directory named `bigbluebutton`.
+
+First, install the required modules with `npm install`, from this directory. When Puppeteer installs, it will automatically install the Chromium browser in which the tests will run.
+
+To run individual tests, you can also optionally install Jest globally with `sudo npm install jest -g`.
+
+## Running the tests with an existing BigBlueButton server
+
+To run these tests with an existing BigBlueButton server, make sure you have a server set up, and that you have the server's URL and secret. These will be the same URL and secret you would use to make API calls to the server. If you do not have these, you can find them by running `bbb-conf --secret` from the terminal in the server.
+
+Copy the `.env-template` file to a new file, and name it `.env`. In the `.env` file, add your BigBlueButton server URL and secret, so the tests will know which server to connect to.
+
+To run all the tests at once, run `npm test`. If you have Jest installed globally, you can run individual tests with `jest TEST [TEST...]`. The tests are found in the `.test.js files`, but you may choose to omit file extensions when running the tests.
+
+## Running the tests in a Docker container
+
+Using this method, you can run the tests with the latest version of the HTML5 client, which you can find in this repository. You will need Docker to run tests this way. To run the tests, just run `./test-html5.sh` from the `bigbluebutton/bigbluebutton-html5` directory. The script will start a Docker container with a BigBlueButton server and the source code for the HTML5 client, and will run the tests with this server before stopping and removing the container.
+
+### Note
+
+The HTML5 client takes a long time to start in the Docker container. The script will check if the HTML5 client is running before running the tests, but it will exit if it takes too many attempts. If the HTML5 client takes too long to start and the check exits without running the tests, you can experiment with the values of `maxRetries` and `retryDelay` in `html5-check.js`. Note that the value of `retryDelay` is in milliseconds.
\ No newline at end of file
diff --git a/bigbluebutton-html5/tests/puppeteer/html5-check.js b/bigbluebutton-html5/tests/puppeteer/html5-check.js
index f6db7d8b99..a49d2ead44 100644
--- a/bigbluebutton-html5/tests/puppeteer/html5-check.js
+++ b/bigbluebutton-html5/tests/puppeteer/html5-check.js
@@ -9,7 +9,7 @@ const helper = require('./helper');
   var check = bbb.protocol + "//" + bbb.hostname + "/html5client/check";
   console.log("HTML5 check URL: " + check);
   const maxRetries = 20;
-  const delay = 10000;
+  const retryDelay = 10000;
   var retryCount = 0;
   while(true)
   {
@@ -46,6 +46,6 @@ const helper = require('./helper');
       }
     }
     console.log("Retrying (attempt " + (retryCount) + "/" + maxRetries + ")...");
-    await helper.sleep(delay);
+    await helper.sleep(retryDelay);
   }
 })();
\ No newline at end of file
-- 
GitLab