Skip to content

Minor doc review #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions at-a-glance.rst
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
Mink at a Glance
================

There's huge number of browser emulators out there, like `Goutte`_, `Selenium`_,
There's a huge number of browser emulators out there, like `Goutte`_, `Selenium`_,
`Sahi`_ and others. They all do the same job, but do it very differently.
They behave differently and have very different API's. But, what's more important,
there is actually 2 completely different types of browser emulators out there:
there are actually 2 completely different types of browser emulators out there:

* Headless browser emulators
* Browser controllers

First type browser emulators are simple pure HTTP specification implementations, like
`Goutte`_. Those browser emulators send a real HTTP requests against an application
The first type of browser emulators are simple pure HTTP specification implementations, like
`Goutte`_. Those browser emulators send real HTTP requests against an application
and parse the response content. They are very simple to run and configure,
because this type of emulators can be written in any available programming
language and can be run through console on servers without GUI. Headless
because this type of emulator can be written in any available programming
language and can be run through the console on servers without a GUI. Headless
emulators have both advantages and disadvantages. Advantages are simplicity,
speed and ability to run it without the need of a real browser. But this
type of browsers has one big disadvantage, they have no JS/AJAX support.
speed and ability to run without the need of a real browser. But this
type of browser emulator has one big disadvantage, it has no JS/AJAX support.
So, you can't test your rich GUI web applications with headless browsers.

Second browser emulators type are browser controllers. Those emulators aim
The second type of browser emulators are browser controllers. Those emulators aim
to control the real browser. That's right, a program to control another program.
Browser controllers simulate user interactions on browser and are able to
retrieve actual information from current browser page. `Selenium`_ and `Sahi`_
are the two most famous browser controllers. The main advantage of browser
controllers usage is the support for JS/AJAX interactions on page. The disadvantage
is that such browser emulators require the installed browser, extra configuration
Browser controllers simulate user interactions on the browser and are able to
retrieve actual information from the current browser page. `Selenium`_ and `Sahi`_
are the two most famous browser controllers. The main advantage of using browser
controllers is the support for JS/AJAX interactions on the page. The disadvantage
is that such browser emulators require an installed browser, extra configuration
and are usually much slower than headless counterparts.

So, the easy answer is to choose the best emulator for your project and use
its API for testing. But as we've already seen, both browser emulator types have both
advantages and disadvantages. If you choose headless browser emulator, you
will not be able to test your JS/AJAX pages. And if you choose browser controller,
your overall test suite will become very slow at some point. So, in real
world we should use both! And that's why you need a **Mink**.
its API for testing. But as we've already seen, both browser emulator types have
advantages and disadvantages. If you choose a headless browser emulator, you
will not be able to test your JS/AJAX pages. And if you choose a browser controller,
your overall test suite will become very slow at some point. So, in the real
world we should use both! And that's why you need **Mink**.

**Mink** removes API differences between different browser emulators providing
different drivers (read in :doc:`/guides/drivers` chapter) for every browser
emulator and providing you with the easy way to control the browser (:doc:`/guides/session`),
emulator and providing you with an easy way to control the browser (:doc:`/guides/session`),
traverse pages (:doc:`/guides/traversing-pages`), manipulate page elements
(:doc:`/guides/manipulating-pages`) or interact with them (:doc:`/guides/interacting-with-pages`).

Expand Down
2 changes: 1 addition & 1 deletion drivers/browserkit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BrowserKitDriver is a pure PHP library available through Composer:
.. note::

The BrowserKit component only provides an abstract implementation. The
actual implementation are provided by other projects, like `Goutte`_
actual implementation is provided by other projects, like `Goutte`_
or the `Symfony HttpKernel`_ component.

If you are using Goutte, you should use the special :doc:`/drivers/goutte`
Expand Down
4 changes: 2 additions & 2 deletions drivers/sahi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SahiDriver
==========

SahiDriver provides a bridge for the `Sahi`_ browser controller. Sahi is
a new JS browser controller, that fast replaced old Selenium testing suite.
a new JS browser controller, that fast replaced the old Selenium testing suite.
It's both easier to setup and to use than classical Selenium. It has a GUI
installer for each popular operating system out there and is able to control
every systems browser through a special bundled proxy server.
Expand Down Expand Up @@ -43,7 +43,7 @@ to control it with ``Behat\Mink\Driver\SahiDriver``:

.. note::

Notice, that first argument of ``SahiDriver`` is always a browser name,
Notice, that the first argument of ``SahiDriver`` is always a browser name,
`supported by Sahi`_.

If you want more control during the driver initialization, like for example
Expand Down
4 changes: 2 additions & 2 deletions guides/drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ types, often written in different languages? Through drivers! A Mink driver
is a simple class, that implements ``Behat\Mink\Driver\DriverInterface``.
This interface describes bridge methods between Mink and real browser emulators.
Mink always talks with browser emulators through its driver. It doesn't know
anything about how to start/stop or traverse page in that particular browser
anything about how to start/stop or traverse pages in that particular browser
emulator. It only knows what driver method it should call in order to do this.

Mink comes with six drivers out of the box:
Expand All @@ -26,7 +26,7 @@ Mink comes with six drivers out of the box:
Driver Feature Support
----------------------

Although Mink does its best on removing browser differences between different
Although Mink does its best to remove browser differences between different
browser emulators, it can't do much in some cases. For example, BrowserKitDriver
cannot evaluate JavaScript and Selenium2Driver cannot get the response status
code. In such cases, the driver will always throw a meaningful
Expand Down
16 changes: 8 additions & 8 deletions guides/interacting-with-pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ the links and press the buttons on the page.
.. note::

These methods are actually equivalent internally (pressing a button involves
clicking on it). Having both methods allows to keep the code more readable.
clicking on it). Having both methods allows the code to be more readable.

.. _interacting-with-forms:

Interacting with Forms
----------------------

The ``NodeElement`` class has a set of methods allowing to interact with
The ``NodeElement`` class has a set of methods allowing interaction with
forms:

``NodeElement::getValue``
Expand Down Expand Up @@ -67,7 +67,7 @@ forms:
Interacting with the Mouse
--------------------------

The ``NodeElement`` class offers a set of methods allowing to interact with
The ``NodeElement`` class offers a set of methods allowing interaction with
the mouse:

``NodeElement::click``
Expand Down Expand Up @@ -109,8 +109,8 @@ Mink supports drag'n'drop of one element onto another:
Shortcut Methods
----------------

The ``TraversableElement`` class provides a few shortcut methods allowing
to find a child element on the page and perform an action on it immediately:
The ``TraversableElement`` class provides a few shortcut methods that allow
finding a child element on the page and performing an action on it immediately:

``TraversableElement::clickLink``
Looks for a link (see findLink) and clicks on it.
Expand All @@ -131,9 +131,9 @@ to find a child element on the page and perform an action on it immediately:
Looks for a select or radio group (see findField) and selects a choice in it.

``TraversableElement::attachFileToField``
Looks for a file field (see findField) and attach a file to it.
Looks for a file field (see findField) and attaches a file to it.

.. note::

All these shortcut methods are throwing an ``ElementNotFoundException``
in case the child element cannot be found.
All these shortcut methods throw an ``ElementNotFoundException``
if the child element cannot be found.
2 changes: 1 addition & 1 deletion guides/managing-sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ one single container object:

.. note::

Mink will even lazy-start your sessions when needed (on first ``getSession()``
Mink will even lazy-start your sessions when needed (on the first ``getSession()``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this doc is outdated. The Mink class does not ever start session anymore. It is a simple registry. Sessions themselves are now starting automatically when you visit a page for the first time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"real" doc content updates can easily be done in separate PRs. I have not attempted to check the truth of the statements, just fixed up some grammar.

call). So, the browser will not be started until you really need it!

Or you could even omit the session name in default cases:
Expand Down
11 changes: 5 additions & 6 deletions guides/manipulating-pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,18 @@ The ``Element`` class provides access to the content of elements.
.. note::

``getText()`` will strip tags and unprinted characters out of the response,
including newlines. So it'll basically return the text, that user sees
including newlines. So it'll basically return the text that the user sees
on the page.

Checking Element Visibility
---------------------------

The ``NodeElement::isVisible`` methods allows to checks whether the element
is visible.
The ``NodeElement::isVisible`` method checks whether the element is visible.

Accessing Form State
--------------------

The ``NodeElement`` class allows to access the state of form elements:
The ``NodeElement`` class allows access to the state of form elements:

``NodeElement::getValue``
Gets the value of the element. See :ref:`interacting-with-forms`.
Expand All @@ -86,8 +85,8 @@ The ``NodeElement`` class allows to access the state of form elements:
Shortcut methods
~~~~~~~~~~~~~~~~

The ``TraversableElement`` class provides a few shortcut methods allowing
to find a child element in the page and checks the state of it immediately:
The ``TraversableElement`` class provides a few shortcut methods that allow
finding a child element in the page and checking the state of it immediately:

``TraversableElement::hasCheckedField``
Looks for a checkbox (see findField) and checks whether it is checked.
Expand Down
2 changes: 1 addition & 1 deletion guides/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ The method can also be used to reset a previous authentication:
.. note::

Automatic HTTP authentication is only supported in headless drivers.
Because HTTP authentication in browser requires manual user action, that
Because HTTP authentication in the browser requires manual user action, that
can't be done remotely for browser controllers.

Javascript Evaluation
Expand Down
8 changes: 4 additions & 4 deletions guides/traversing-pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ on top of ``find()`` to make it easier to achieve many common use cases:

.. note::

These shortcuts are returning a single element. If you need to find all
These shortcuts return a single element. If you need to find all
matches, you will need to use ``findAll`` with the :ref:`named selector <named-selector>`.

Nested Traversing
~~~~~~~~~~~~~~~~~

Every ``find*()`` method will return a ``Behat\Mink\Element\NodeElement`` instance
and ``findAll()`` will return an array of such instances. The fun part is
that you can make same old traversing on such elements as well:
that you can use the same methods of traversing on such elements as well:

.. code-block:: php

Expand Down Expand Up @@ -116,7 +116,7 @@ on the page:

This selector searches for an element inside the current node (which
is ``<html>`` for the page object). This means that trying to pass it
the XPath of and element retrieved with ``ElementInterface::getXpath``
the XPath of an element retrieved with ``ElementInterface::getXpath``
will not work (this query includes the query for the root node). To check
whether an element object still exists on the browser page, use ``ElementInterface::isValid``
instead.
Expand All @@ -128,7 +128,7 @@ Named Selectors

Named selectors provide a set of reusable queries for common needs. For conditions
based on the content of elements, the named selector will try to find an
exact match first. It will then fallback to partial matching in case there
exact match first. It will then fallback to partial matching if there
is no result for the exact match. The ``named_exact`` selector type can be
used to force using only exact matching. The ``named_partial`` selector type
can be used to apply partial matching without preferring exact matches.
Expand Down
12 changes: 6 additions & 6 deletions index.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Welcome to the Mink documentation!
==================================

One of the most important parts in the web is a browser. Browser is the window
One of the most important parts in the web is a browser. A browser is the window
through which web users interact with web applications and other users. Users
are always talking with web applications through browsers.

So, in order to test that our web application behaves correctly, we need
a way to simulate this interaction between the browser and the web application
in our tests. We need a **Mink**.
in our tests. We need **Mink**.

Mink is an open source browser controller/emulator for web applications, written
in PHP 5.3.
Expand All @@ -34,8 +34,8 @@ The recommended way to install Mink with all its dependencies is through
In this case you must use the different call
``php composer.phar`` everywhere instead of the simple command ``composer``.

Everything will be installed inside ``vendor`` folder.
Finally, include Composer autoloading script to your project:
Everything will be installed inside the ``vendor`` folder.
Finally, include the Composer autoloading script to your project:

.. code-block:: php

Expand All @@ -55,9 +55,9 @@ Finally, include Composer autoloading script to your project:
- SahiDriver - ``behat/mink-sahi-driver``
- WUnitDriver - ``behat/mink-wunit-driver``

If you're newcomer or just don't know what to choose, you should probably
If you're a newcomer or just don't know what to choose, you should probably
start with the GoutteDriver and the Selenium2Driver (you will be able
to tuneup it later):
to tune it up later):

Guides
------
Expand Down