f6a3477ab5e45f50fb6c2695266b8781de1e1fa9
[yaffs-website] / vendor / drupal / drupal-extension / doc / blackbox.rst
1 Blackbox Driver
2 ===============
3
4 The blackbox driver assumes no privileged access to the site. You can run the
5 tests on a local or remote server, and all the actions will take place through
6 the site's user interface. This driver was enabled as part of the installation
7 instructions by lines 13 and 14, highlighted below.
8
9 .. literalinclude:: _static/snippets/behat-bb.yml
10    :language: yaml
11    :linenos:
12    :lines: 1-14
13    :emphasize-lines: 13-14
14
15 Region steps
16 ------------
17
18 It may be really important that a block is in the correct region, or you may
19 have a link or button that doesn't have a unique label. The blackbox driver
20 allows you to create a map between a CSS selector and a user-readable region
21 name so you can use steps like the following without having to write any custom
22 PHP::
23
24
25   I press "Search" in the "header" region
26   I fill in "a value" for "a field" in the "content" region
27   I fill in "a field" with "Stuff" in the "header" region
28   I click "About us" in the "footer" region
29
30 Example:
31 ++++++++
32
33 A stock Drupal 7 installation has a footer area identified by the CSS Id
34 "footer". By editing the behat.yml file and adding lines 15 and 16 below:
35
36 .. literalinclude:: _static/snippets/behat-bb.yml
37    :language: yaml
38    :linenos:
39    :emphasize-lines: 15-16
40
41 You can use a step like the following without writing any custom PHP::
42
43   When I click "About us" in the "footer" region.
44
45
46 Using the blackbox driver configured with the regions of your site, you can
47 access the following region-related steps:
48
49 .. Note::
50     These examples won't work unless you define the appropriate regions in
51      your behat.yml file.
52
53 .. literalinclude:: _static/snippets/blackbox.feature
54    :language: gherkin
55    :linenos:
56    :lines: 1-61
57
58 Message selectors
59 -----------------
60
61 The Drupal Extension makes use of three selectors for message. If your CSS
62 values are different than the defaults (shown below), you'll need to update
63 your behat.yml file:
64
65 .. code-block:: yaml
66    :linenos:
67    :emphasize-lines: 2-5
68
69     Drupal\DrupalExtension:
70       selectors:
71         message_selector: '.messages'
72         error_message_selector: '.messages.messages-error'
73         success_message_selector: '.messages.messages-status'
74
75 Message-related steps include:
76
77 .. literalinclude::  _static/snippets/blackbox.feature
78    :language: gherkin
79    :linenos:
80    :lines: 63-81
81
82 Override text strings
83 ---------------------
84
85 The Drupal Extension relies on default text for certain steps. If you have
86 customized the label visible to users, you can change that text as follows:
87
88 .. code-block:: yaml
89
90      Drupal\DrupalExtension:
91        text:
92          log_out: "Sign out"
93          log_in: "Sign in"
94          password_field: "Enter your password"
95          username_field: "Nickname"