@@ -48,11 +48,9 @@ public function testBasicForm(): void
4848
4949 $ page ->pressButton ('Save ' );
5050
51- if ($ this ->safePageWait (5000 , 'document.getElementById("first") !== null ' )) {
52- $ this ->assertEquals ('Anket for Konstantin ' , $ webAssert ->elementExists ('css ' , 'h1 ' )->getText ());
53- $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
54- $ this ->assertEquals ('Lastname: Kudryashov ' , $ webAssert ->elementExists ('css ' , '#last ' )->getText ());
55- }
51+ $ this ->assertEquals ('Anket for Konstantin ' , $ webAssert ->elementExists ('css ' , 'h1 ' )->getText ());
52+ $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
53+ $ this ->assertEquals ('Lastname: Kudryashov ' , $ webAssert ->elementExists ('css ' , '#last ' )->getText ());
5654 }
5755
5856 /**
@@ -70,11 +68,7 @@ public function testFormSubmitWays(string $submitVia): void
7068
7169 $ page ->pressButton ($ submitVia );
7270
73- if ($ this ->safePageWait (5000 , 'document.getElementById("first") !== null ' )) {
74- $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
75- } else {
76- $ this ->fail ('Form was never submitted ' );
77- }
71+ $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
7872 }
7973
8074 /**
@@ -98,9 +92,7 @@ public function testFormSubmit(): void
9892
9993 $ webAssert ->elementExists ('xpath ' , 'descendant-or-self::form[1] ' )->submit ();
10094
101- if ($ this ->safePageWait (5000 , 'document.getElementById("first") !== null ' )) {
102- $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
103- }
95+ $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
10496 }
10597
10698 public function testFormSubmitWithoutButton (): void
@@ -113,9 +105,7 @@ public function testFormSubmitWithoutButton(): void
113105
114106 $ webAssert ->elementExists ('xpath ' , 'descendant-or-self::form[1] ' )->submit ();
115107
116- if ($ this ->safePageWait (5000 , 'document.getElementById("first") !== null ' )) {
117- $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
118- }
108+ $ this ->assertEquals ('Firstname: Konstantin ' , $ webAssert ->elementExists ('css ' , '#first ' )->getText ());
119109 }
120110
121111 public function testBasicGetForm (): void
@@ -204,8 +194,8 @@ public function testAdvancedForm(): void
204194
205195 $ button ->press ();
206196
207- if ( $ this ->safePageWait ( 5000 , ' document.getElementsByTagName("title") === "Advanced form save" ' )) {
208- $ out = <<<'OUT'
197+ $ this ->assertStringContainsString (
198+ <<<'OUT'
209199array(
210200 agreement = `on`,
211201 email = `ever.zet@gmail.com`,
@@ -218,9 +208,9 @@ public function testAdvancedForm(): void
218208)
219209some_file.txt
2202101 uploaded file
221- OUT;
222- $ this -> assertStringContainsString ( $ out , $ page ->getContent ());
223- }
211+ OUT,
212+ $ page ->getContent ()
213+ );
224214 }
225215
226216 public function testQuoteInValue (): void
@@ -245,22 +235,27 @@ public function testQuoteInValue(): void
245235
246236 $ button ->press ();
247237
248- if ($ this ->safePageWait (5000 , 'document.getElementsByTagName("title") !== null ' )) {
249- $ out = <<<'OUT'
238+ $ this ->assertThat (
239+ $ page ->getContent (),
240+ $ this ->logicalOr (
241+ $ this ->stringContains (
242+ <<<'OUT'
250243 first_name = `Foo "item"`,
251244 last_name = `Bar`,
252- OUT;
245+ OUT
246+ ),
247+ $ this ->stringContains (
253248 // Escaping of double quotes are optional in HTML text nodes. Even though our backend escapes
254249 // the quote in the HTML when returning it, browsers may apply only the minimal escaping in
255250 // the content they expose to Selenium depending of how they build it (they might serialize
256- // their DOM again rathet than returning the raw HTTP response content).
257- $ minEscapedOut = <<<'OUT'
251+ // their DOM again rather than returning the raw HTTP response content).
252+ <<<'OUT'
258253 first_name = `Foo "item"`,
259254 last_name = `Bar`,
260- OUT;
261-
262- $ this -> assertThat ( $ page -> getContent (), $ this -> logicalOr ( $ this -> stringContains ( $ out ), $ this -> stringContains ( $ minEscapedOut )));
263- }
255+ OUT
256+ )
257+ )
258+ );
264259 }
265260
266261 public function testMultiInput (): void
0 commit comments