Skip to main content

A Robot Framework library for Webpack.

Project description

==============================================================================
A Robot Framework library for Webpack.
==============================================================================

.. image:: https://travis-ci.org/kitconcept/robotframework-webpack.svg?branch=master
:target: https://travis-ci.org/kitconcept/robotframework-webpack

.. image:: https://img.shields.io/pypi/status/robotframework-webpack.svg
:target: https://pypi.python.org/pypi/robotframework-webpack/
:alt: Egg Status

.. image:: https://img.shields.io/pypi/v/robotframework-webpack.svg
:target: https://pypi.python.org/pypi/robotframework-webpack/
:alt: Latest Version

.. image:: https://img.shields.io/pypi/l/robotframework-webpack.svg
:target: https://pypi.python.org/pypi/robotframework-webpack/
:alt: License

|br|

.. image:: https://raw.githubusercontent.com/kitconcept/robotframework-djangolibrary/master/kitconcept.png
:alt: kitconcept
:target: https://kitconcept.com/


Introduction
------------

WebpackLibrary is a Robot Framework library for Webpack. It allows to start
and stop the Webpack dev server.

Installation
------------

Install robotframework-webpack with pip::

$ pip install robotframework-webpack


Documentation
-------------

https://kitconcept.github.io/robotframework-webpack/

Usage
-----

In order to write your first robot test, make sure that you include Selenium2Library and WebpackLibrary. Create a test.robot file with the following content::

*** Variables ***
${HOST} 127.0.0.1
${PORT} 8080
${BROWSER} chrome
${SERVER} http://${HOST}:${PORT}


*** Settings ***

Documentation WebpackLibrary Acceptance Tests
Library Selenium2Library timeout=10 implicit_wait=0
Library WebpackLibrary
Suite Setup Start Webpack and Open Browser
Suite Teardown Stop Webpack and Close Browser


*** Test Cases ***

Scenario: Webpack Dev Server
Go To ${SERVER}
# Amend this line to check for the real content of your app. Otherwise this test will fail.
Wait until page contains Hello World
Page Should Contain Hello World


*** Keywords ***

Start Webpack and Open Browser
Start Webpack yarn start
Open Browser ${SERVER} ${BROWSER}
Set Window Size 1280 1024

Stop Webpack and Close Browser
Stop Webpack
Close Browser


Keywords
--------

Start Webpack: Starts the webpack process. The keyword take the command line command to start Webpack (e.g. 'yarn start').

Start Webpack yarn start

Optional parameters are:

- path: relative or absolute path to the path where the command should be executed.
- check: string that the keyword looks for in the Webpack output to know that Webpack has been fully started (default is 'Compiled successfully').
- debug: returns debug information

Example with all parameters set::

Start Webpack yarn start
.. path=tests/test-create-react-app
.. check=Compiled successfully
.. debug=True

Stop Webpack: Stopps the webpack process that has been started with 'Start Webpack'.
The keyword has no parameters.

Rationale
---------

You can start a Webpack process with standard Robot Framework keywords::

Run process yarn run build shell=True cwd=${CURDIR}
Run process yarn global add serve shell=True cwd=${CURDIR}
Start process serve -s build shell=True cwd=${CURDIR}

You can even kill the process at the end of the test (suite)::

Terminate All Processes kill=True

Though. You will need to set a sleep statement to wait until the Webpack
process is fully up and running. Since this can take a considerable amount
of time it will make your test suite inefficient and hard to scale.

Robot Framework Webpack checks the output of the Webpack process until it
is fully up and running. As soon as Webpack is ready, the test can continue.


Development
-----------

Project Setup::

$ virtualenv-2.7 .py27
$ source .py27/bin/activate
$ pip install -r requirements.txt
$ python setup.py develop

Run Tests::

$ .py27/bin/pybot tests

.. |br| raw:: html

<br />

1.0.4 (2018-03-01)
------------------

- Fix typo in 'Stop Webpack' keyword which breaks the entire library when it is imported.
[timo]


1.0.3 (2018-03-01)
------------------

Bugfixes:

- Raise RuntimeError when 'Start Webpack' and 'Stop Webpack' fail.
[timo]


1.0.2 (2018-02-15)
------------------

Bugfixes:

- Remove br in README which breaks the pypi page.
[timo]


1.0.1 (2018-02-15)
------------------

Bugfixes:

- Fix ReST in README.
[timo]


1.0.0 (2018-02-15)
------------------

Breaking Changes:

- Refactor 'Start Webpack' keyword.
Remove "host", "port", "content_base", "config", "webpack_bin_path", "debug" params.
Keep "path" param. Add required "command" param and an optional "check" param.
[timo]

Bugfixes:

- Use a process group to start Webpack to being able to stop all child processes.
This fixes issues with leftover child processes with create-react-app.
[timo]


1.0a8 (2016-07-21)
------------------

Breaking Changes:

- Change ROBOT_LIBRARY_SCOPE to 'GLOBAL'. It does not make sense to fire up
webpack for every single test.
[timo]


1.0a7 (2016-07-19)
------------------

Bugfixes:

- Do not log the webpack path.
[timo]


1.0a6 (2016-07-18)
------------------

Bugfixes:

- Allow to use 'Start Webpack' keyword without a debug attribute set. This
fixes https://github.com/kitconcept/robotframework-webpack/issues/2.
[timo]


1.0a5 (2016-07-13)
------------------

New Features:

- Add 'webpack_bin_path' param to 'Start Webpack' keyword.
[timo]


1.0a4 (2016-07-13)
------------------

Breaking Changes:

- Move all arguments from WebpackLibrary import to 'Start Webpack' keyword.
[timo]

Bugfixes:

- Remove requests from dependencies.
[timo]

- Fix package keywords.
[timo]


1.0a3 (2016-07-13)
------------------

Bugfixes:

- Fix content_base param.
[timo]

- Log OSErrors when calling webpack.
[timo]


1.0a2 (2016-07-13)
------------------

New Features:

- Add config parameter to WebpackLibrary.
[timo]

1.0a1 (2016-07-12)
------------------

- Initial release.
[timo]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-webpack-1.0.4.tar.gz (57.2 kB view details)

Uploaded Source

File details

Details for the file robotframework-webpack-1.0.4.tar.gz.

File metadata

File hashes

Hashes for robotframework-webpack-1.0.4.tar.gz
Algorithm Hash digest
SHA256 01a7180ed462ec817af0a2fc083e65b158540328a564c23334448c76482fcfeb
MD5 a46d7eff4694615f2010d5c6481023b6
BLAKE2b-256 48e2f2d5bbf7e0450f0b0e4364b3c3858bfb0e91bece05251724edbb5f8d9894

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page