Document how to test locally with BrowserStack

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-07-17 13:39:38 +02:00
parent 020bc6cf34
commit 58c2e7208f

View File

@ -57,3 +57,31 @@ For example you can use following setup in ``phpunit.xml``::
<env name="TESTSUITE_SELENIUM_HOST" value="127.0.0.1" />
<env name="TESTSUITE_SELENIUM_PORT" value="4444" />
</php>
Using BrowserStack
------------------
We're using BrowserStack to run our tests on the Travis CI. If you are a team
member, you can be granted access to the team account, but you can register own
account there as well.
To run tests locally, you need to install BrowserStack tool to enable local
testing, see their website for instructions:
https://www.browserstack.com/local-testing#command-line
Following instructions use PHP's built in server for the testing::
# Export BrowserStack credentials in the environment:
export TESTSUITE_BROWSERSTACK_USER=your_username
export TESTSUITE_BROWSERSTACK_KEY=your_key
# Port where tests will be running
export TESTSUITE_PORT=9000
export TESTSUITE_URL=http://127.0.0.1:$TESTSUITE_PORT/
# Start PHP built in server
php --server 127.0.0.1:$TESTSUITE_PORT > php.log &
# Start BrowserStack Local client to forward the traffic
~/browserstack/BrowserStackLocal -localIdentifier Manual "$TESTSUITE_BROWSERSTACK_KEY" 127.0.0.1,$TESTSUITE_PORT,0 &