Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3dfcd00

Browse files
committedApr 4, 2018
Merge branch '2.0' of github.com:Modelizer/Laravel-Selenium into 2.0
2 parents ceb2402 + 38864a6 commit 3dfcd00

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed
 

‎src/Services/InteractWithPage.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected function scroll($amount)
4747
*
4848
* @param $value
4949
* @param $element
50+
*
5051
* @return $this
5152
*/
5253
protected function select($value, $element)
@@ -110,12 +111,12 @@ protected function seePageIs($path)
110111

111112
public function getTextByTag($tag)
112113
{
113-
return $this->wd->findElement(WebDriverBy::tagName($tag))->getText();
114+
return $this->wd->findElement(WebDriverBy::tagName($tag))->getText();
114115
}
115116

116117
/**
117118
* Type a value into a form input by that input name.
118-
* Note: Type is an alias of typeBySelectorType
119+
* Note: Type is an alias of typeBySelectorType.
119120
*
120121
* @param $value
121122
* @param $name
@@ -144,8 +145,9 @@ public function type($value, $name, $clear = false)
144145
* @param $name - value to use for the selector $type
145146
* @param bool $clear - Whether or not to clear the input first on say an edit form
146147
*
147-
* @return $this
148148
* @throws CannotFindElement
149+
*
150+
* @return $this
149151
*/
150152
private function typeBySelectorType($type, $value, $name, $clear = false)
151153
{
@@ -270,28 +272,32 @@ protected function click($textOrId)
270272
* If xpath is provided, will attempt to find by that first.
271273
*
272274
* @param null $name
273-
* @return \Facebook\WebDriver\Remote\RemoteWebElement
274275
*
275276
* @throws CannotFindElement
277+
*
278+
* @return \Facebook\WebDriver\Remote\RemoteWebElement
276279
*/
277280
protected function findElement($name)
278281
{
279-
280282
try {
281283
return $this->wd->findElement(WebDriverBy::id($name));
282-
} catch (\Exception $e) { }
284+
} catch (\Exception $e) {
285+
}
283286

284287
try {
285288
return $this->wd->findElement(WebDriverBy::name($name));
286-
} catch (\Exception $e) { }
289+
} catch (\Exception $e) {
290+
}
287291

288292
try {
289293
return $this->wd->findElement(WebDriverBy::cssSelector($name));
290-
} catch (\Exception $e) { }
294+
} catch (\Exception $e) {
295+
}
291296

292297
try {
293298
return $this->wd->findElement(WebDriverBy::xpath($name));
294-
} catch (\Exception $e) { }
299+
} catch (\Exception $e) {
300+
}
295301

296302
throw new CannotFindElement('Cannot find element: '.$value.' isn\'t visible on the page');
297303
}

‎tests/feature/FormTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class FormTest extends SeleniumTestCase
88
{
99
/** @test */
10-
function it_should_fill_input_fields()
10+
public function it_should_fill_input_fields()
1111
{
1212
$this->visit()
1313
->click('Form')
@@ -18,7 +18,7 @@ function it_should_fill_input_fields()
1818
}
1919

2020
/** @test */
21-
function it_should_type_information()
21+
public function it_should_type_information()
2222
{
2323
$formInfo = [
2424
'firstName' => 'Mohammed',
@@ -33,23 +33,23 @@ function it_should_type_information()
3333
}
3434

3535
/** @test */
36-
function it_should_type_email_by_name()
36+
public function it_should_type_email_by_name()
3737
{
3838
$this->visit()
3939
->click('Form')
4040
->type('alice@foo.com', 'inputEmail-name');
4141
}
4242

4343
/** @test */
44-
function it_should_type_email_by_id()
44+
public function it_should_type_email_by_id()
4545
{
4646
$this->visit()
4747
->click('Form')
4848
->typeById('bob@bar.com', 'inputEmail');
4949
}
5050

5151
/** @test */
52-
function it_should_type_by_css_selector()
52+
public function it_should_type_by_css_selector()
5353
{
5454
$this->visit()
5555
->click('Form')
@@ -58,7 +58,7 @@ function it_should_type_by_css_selector()
5858
}
5959

6060
/** @test */
61-
function it_should_type_information_and_press_a_button()
61+
public function it_should_type_information_and_press_a_button()
6262
{
6363
$formInfo = [
6464
'firstName' => 'Mohammed',
@@ -75,7 +75,7 @@ function it_should_type_information_and_press_a_button()
7575
}
7676

7777
/** @test */
78-
function it_should_submit_form()
78+
public function it_should_submit_form()
7979
{
8080
$formInfo = [
8181
'firstName' => 'Mohammed',

‎tests/feature/InteractionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@
77
class InteractionTest extends SeleniumTestCase
88
{
99
/** @test */
10-
function it_should_visit_page()
10+
public function it_should_visit_page()
1111
{
1212
$this->visit();
1313
}
1414

1515
/** @test */
16-
function it_should_see_page_url()
16+
public function it_should_see_page_url()
1717
{
1818
$this->visit('/about')
1919
->seePageIs('/about');
2020
}
2121

2222
/** @test */
23-
function it_should_see_text_on_page()
23+
public function it_should_see_text_on_page()
2424
{
2525
$this->visit()
2626
->see('Laravel Selenium Test Helper');
2727
}
2828

2929
/** @test */
30-
function check_text_not_exists_on_page()
30+
public function check_text_not_exists_on_page()
3131
{
3232
$this->visit()
3333
->notSee('Bootstrap');
3434
}
3535

3636
/** @test */
37-
function it_should_click_link()
37+
public function it_should_click_link()
3838
{
3939
$this->visit()
4040
->click('Contact Us')
4141
->see('Contact Us');
4242
}
4343

4444
/** @test */
45-
function it_should_scroll()
45+
public function it_should_scroll()
4646
{
4747
$this->visit()
4848
->click('About')

0 commit comments

Comments
 (0)
Please sign in to comment.