File tree Expand file tree Collapse file tree
user_guide_src/source/testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,7 +178,8 @@ are useful for using within assertions in your tests.
178178see()
179179-----
180180
181- The ``see() `` method checks the text on the page to see if it exists either by itself, or more specifically within
181+ Returns a boolean true/false based on whether the text on the page exists either
182+ by itself, or more specifically within
182183a tag, as specified by type, class, or id:
183184
184185.. literalinclude :: response/018.php
Original file line number Diff line number Diff line change 11<?php
22
33// Check that "Hello World" is on the page
4- $ results ->see ('Hello World ' );
4+ if ($ results ->see ('Hello World ' )) {
5+ // ...
6+ }
7+
58// Check that "Hello World" is within an h1 tag
6- $ results ->see ('Hello World ' , 'h1 ' );
9+ if ($ results ->see ('Hello World ' , 'h1 ' )) {
10+ // ...
11+ }
12+
713// Check that "Hello World" is within an element with the "notice" class
8- $ results ->see ('Hello World ' , '.notice ' );
14+ if ($ results ->see ('Hello World ' , '.notice ' )) {
15+ // ...
16+ }
17+
918// Check that "Hello World" is within an element with id of "title"
10- $ results ->see ('Hello World ' , '#title ' );
19+ if ($ results ->see ('Hello World ' , '#title ' )) {
20+ // ...
21+ }
Original file line number Diff line number Diff line change 11<?php
22
33// Checks that "Hello World" does NOT exist on the page
4- $ results ->dontSee ('Hello World ' );
4+ if ($ results ->dontSee ('Hello World ' )) {
5+ // ...
6+ }
7+
58// Checks that "Hellow World" does NOT exist within any h1 tag
6- $ results ->dontSee ('Hello World ' , 'h1 ' );
9+ if ($ results ->dontSee ('Hello World ' , 'h1 ' )) {
10+ // ...
11+ }
Original file line number Diff line number Diff line change 11<?php
22
33// Check that an element with class 'notice' exists
4- $ results ->seeElement ('.notice ' );
4+ if ($ results ->seeElement ('.notice ' )) {
5+ // ...
6+ }
7+
58// Check that an element with id 'title' exists
6- $ results ->seeElement ('#title ' );
9+ if ($ results ->seeElement ('#title ' )) {
10+ // ...
11+ }
12+
713// Verify that an element with id 'title' does NOT exist
8- $ results ->dontSeeElement ('#title ' );
14+ if ($ results ->dontSeeElement ('#title ' )) {
15+ // ...
16+ }
Original file line number Diff line number Diff line change 11<?php
22
33// Check that a link exists with 'Upgrade Account' as the text::
4- $ results ->seeLink ('Upgrade Account ' );
4+ if ($ results ->seeLink ('Upgrade Account ' )) {
5+ // ...
6+ }
7+
58// Check that a link exists with 'Upgrade Account' as the text, AND a class of 'upsell'
6- $ results ->seeLink ('Upgrade Account ' , '.upsell ' );
9+ if ($ results ->seeLink ('Upgrade Account ' , '.upsell ' )) {
10+ // ...
11+ }
Original file line number Diff line number Diff line change 11<?php
22
33// Check that an input exists named 'user' with the value 'John Snow'
4- $ results ->seeInField ('user ' , 'John Snow ' );
4+ if ($ results ->seeInField ('user ' , 'John Snow ' )) {
5+ // ...
6+ }
7+
58// Check a multi-dimensional input
6- $ results ->seeInField ('user[name] ' , 'John Snow ' );
9+ if ($ results ->seeInField ('user[name] ' , 'John Snow ' )) {
10+ // ...
11+ }
Original file line number Diff line number Diff line change 11<?php
22
33// Check if checkbox is checked with class of 'foo'
4- $ results ->seeCheckboxIsChecked ('.foo ' );
4+ if ($ results ->seeCheckboxIsChecked ('.foo ' )) {
5+ // ...
6+ }
7+
58// Check if checkbox with id of 'bar' is checked
6- $ results ->seeCheckboxIsChecked ('#bar ' );
9+ if ($ results ->seeCheckboxIsChecked ('#bar ' )) {
10+ // ...
11+ }
You can’t perform that action at this time.
0 commit comments