Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/camilotk/selenium-teste

Um pequeno experimento de usar selenium, laravel e lambdatest.
https://github.com/camilotk/selenium-teste

Last synced: 4 days ago
JSON representation

Um pequeno experimento de usar selenium, laravel e lambdatest.

Awesome Lists containing this project

README

        

# Selenium
This is a test repository for learning and test Laravel Dusk with Selenium.

# Step-by-Step
1. Install composer library on Laravel project:

```composer
composer require --dev laravel/dusk
```

2. Do the Laravel Dusk install command.

```
php artisan dusk:install
```

3. Add on .env file the username and API Key of LambdaTest, both can be found in your [acoount profile](https://accounts.lambdatest.com/detail/profile).

**.env**
```
LT_USERNAME="your username"
LT_ACCESS_KEY="your access key"
```
4. in the folder tests/DuskTestCase.php comment the content of prepare() method and add in driver method before return:
```php
$options = (new ChromeOptions)->addArguments([
'--headless',
'--disable-gpu',
'--no-sandbox',
'--ignore-certificate-errors',
]);

$username = env('LT_USERNAME');
$access_key = env('LT_ACCESS_KEY');
$url = "https://".$username.":".$access_key."@hub.lambdatest.com/wd/hub";

return RemoteWebDriver::create($url, {DesiredCapabilities});
```
5. Replace {DesiredCapabilities} by the contents generated by [this link](https://www.lambdatest.com/capabilities-generator/). Important that 'tunnel' is set as true to everything work.
6. Download the lambdatest zip achive and extract the LT binary.
7. Then in terminal in same folder that are the LT binary copy and paste the command in "configure tunel" of lambdatest dashboard (remember to select 'home' checkbox) and replace '/home/selenium' for the path to public folder of project.
8. Generate the test:

``` php artisan dusk:make {class}Test ```

9. Write the tests.

10. Test:

```php artisan dusk ```