siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
155 lines (93 loc) • 6.79 kB
Markdown
{@img images/128-Px-Coloured.png}
Integration with LambdaTest cloud-testing infrastructure
==========================================================
Most of the web projects need to support all major browsers. When aiming for the full certainty about the quality of the product in every supported browser,
a logical step is to run the test suite in all those browsers. Counting Chrome, Firefox, Safari, Edge - thats at least 4x
of the single test suite launch, so for the single-machine setup, the workload can quickly become extremely intense.
One way to solve this bottleneck is to maintain a farm of virtual machines with various OS/browser combinations.
This can be tricky and will consume lots of your time and resources. Another, more elegant way is to use services
providing the same infrastructure in the cloud. Thanks to service such as [LambdaTest](https://lambdatest.com/) it is now very simple.
Authentication
--------------
When registering an account in LambdaTest, you will receive a username and an access token.
Later in this guide we will refer to these as "LambdaTest username" and "LambdaTest access token" (or LambdaTest API key).
Quick testing
-------
Assuming your local web server is configured to listen at host "localhost" on port 80, all you need to launch your test suite in the cloud
is to sign up for the LambdaTest trial and run the following command:
__SIESTA_DIR__/bin/webdriver https://localhost/my/siesta/project/wrapper.html --lambdatest LT_USERNAME,LT_KEY
--cap browserName=firefox --cap platform=windows
That's all, the only difference from a normal Siesta automated launch, is the `--lambdatest` option, which is a shortcut performing
a few additional actions. We'll examine what happens under the hood later in this guide.
Note how we have specified the desired OS/browser combination using the `--cap` switch (it specifies remote webdriver capability).
There are LambdaTest specific capabilities (<https://www.lambdatest.com/capabilities-generator/>) and generic Selenium capabilities
(<https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities>). See also [this page](https://www.lambdatest.com/support/docs/selenium-automation-capabilities/) for more information.
If your webserver listens on a different host (`mylocalhost` for example) then the `--lambdatest` option should look like:
--lambdatest LT_USERNAME,LT_KEY,mylocalhost
Finding the values for `platform` and `browserName` capability
---------------------------
Sometimes it can be tricky to find the value for the "platform" platform, Selenium documentation provides only the generic ones.
In such case, use the LambdaTest online tool: <https://www.lambdatest.com/capabilities-generator/>. You can choose
the desired OS/browser combination there and check what capabilities should be specified for that.
Parallelization
---------------
When using cloud-based infrastructure, each test page is running inside the own VM, which guarantees the exclusive focus owning
and allows us to run several test pages in parallel. Naturally, that speeds-up the test execution, by the number of parallel sessions
we can run.
This can be done using the `--max-workers` option, that specifies the maximum number of parallel sessions.
Under the hood
-------------
Let's examine what happens under the hood when we use the `--lambdatest` shortcut option. In fact, we don't have to use this shortcut
option and can perform all the steps listed below manually.
1) The first thing that happens is that Siesta establishes a local tunnel from your machine to the LambdaTest server, using the LambdaTest tunnel binaries.
You can do this step manually by using the batch file in the Siesta package:
__SIESTA_DIR__/bin/lt --user LT_USERNAME --key LT_API_KEY --allowHosts mylocalhost
When launched successfully, you should see the following text:
INFO Tunnel binary started on port :9090
INFO Using ssh(over_22) :: connection mode
INFO Launching tunnel
INFO You can start testing now
INFO Tunnel ID: 1445858
2) The `--host` option is set to point to the LambdaTest server, based on your username and access token:
--host="https://LT_USERNAME:LT_API_KEY@hub.lambdatest.com/wd/hub"
To sum up, instead of using the `--lambdatest` shortcut option, we could:
- launch the tunnel manually:
__SIESTA_DIR__/bin/lt --user LT_USERNAME --key LT_API_KEY --allowHosts mylocalhost
- specify the command as:
__SIESTA_DIR__/bin/webdriver https://localhost/my/siesta/project/wrapper.html
--host="https://LT_USERNAME:LT_API_KEY@hub.lambdatest.com/wd/hub"
--cap browserName=Firefox --cap platform="Windows 7"
For convenience, instead of setting the `--host` option manually, one can specify `--lambdatest-user` and `--lambdatest-key` options.
__SIESTA_DIR__/bin/webdriver https://localhost/my/siesta/project/wrapper.html
--lambdatest-user=LT_USERNAME --lambdatest-key=LT_API_KEY
--cap browserName=Firefox --cap platform="Windows 7"
Shared tunnel
---------
To share the tunnel to LambdaTest between the tests launches (saves the tunnel up/down time, convenient during development), use the
`--lambdatest_` option, which does the same things as `--lambdatest` but uses existing tunnel.
Then you'll need to launch the tunnel manually:
__SIESTA_DIR__/bin/lt --user LT_USERNAME --key LT_API_KEY --allowHosts mylocalhost
Conclusion
----------
As you can see, thanks to the excellent [LambdaTest](https://lambdatest.com) infrastructure, launching your tests in the cloud is as easy as specifying
one extra argument on the command line. The benefits of cloud testing are obvious - no need to waste time and resources setting up and maintaining your own VM farm, and additionally you can run your test suite in various browsers in parallel.
See also:
---------
<https://www.lambdatest.com/support/docs/javascript-with-selenium-running-javascript-automation-scripts-on-lambdatest-selenium-grid/>
<https://www.lambdatest.com/capabilities-generator/>
Buy this product
---------
Visit our store: <https://bryntum.com/store/siesta>
Support
---------
Ask a question in our community forum: <https://www.bryntum.com/forum/viewforum.php?f=20>
Subscribers can post expedited questions in Premium Forum: <https://www.bryntum.com/forum/viewforum.php?f=21>
Please report any bugs through the web interface at <https://www.assembla.com/spaces/bryntum/support/tickets>
See also
---------
Siesta web-page: <https://bryntum.com/products/siesta>
Other Bryntum products: <https://bryntum.com/products>
COPYRIGHT AND LICENSE
---------
Copyright (c) 2009-2022, Bryntum AB & Nickolay Platonov
All rights reserved.