Modelizer / Laravel-Selenium

Selenium Testing for Laravel 5
MIT License
108 stars 33 forks source link

Sauce labs integration #14

Closed kre8or69 closed 7 years ago

kre8or69 commented 8 years ago

Love the package and using it locally and headless on travis-ci.

Just wondering if you have plans to support sauce labs or browser stack in the future (or just the remote web driver).

Looking forward to all you're upgrades!!

Modelizer commented 8 years ago

Yes, those are cool things which will help to push this package on a new level. Also, I like your thought.

Feel free to submit a PR if you like to contribute.

kre8or69 commented 8 years ago

So it turns out the phpunit_selenium already is mostly set up to do it. Just overriding the the setup and including an array of browsers with some specific attributes is all that's needed.

Here's a tester I was using, might be helpful.

On a side note I found that using the using see('words','title') wasn't able to retrieve the page title. Might be a known issue though :)

use Modelizer\Selenium\SeleniumTestCase;

define('SAUCE_HOST', env(SAUCE_USERNAME).':'.env(SAUCE_ACCESS_KEY).'@ondemand.saucelabs.com');

class WebDriverExample extends SeleniumTestCase
{
    protected $start_url = 'http://saucelabs.com/test/guinea-pig';

    protected function setUp()
    {
        $this->setUpLaravel();
        $this->baseUrl = 'http://saucelabs.com/test/guinea-pig';
        $this->setBrowserUrl($this->baseUrl);
    }

    public static $browsers = [
        [
            'browserName' => 'chrome',
            'host' => SAUCE_HOST,
            'port' => 80,
            'desiredCapabilities' => [
                'version' => '48',
                'platform' => 'Linux',
            ]
        ],
        [
            'browserName' => 'firefox',
            'host' => SAUCE_HOST,
            'port' => 80,
            'desiredCapabilities' => [
                'version' => '45',
                'platform' => 'Linux',
            ],
        ], [
            'browserName' => 'safari',
            'host' => SAUCE_HOST,
            'port' => 80,
            'desiredCapabilities' => [
                'version' => '9',
                'platform' => 'Mac 10.11',
            ],
        ]
    ];

    public function testTitle()
    {
        $this->visit('/')->wait(1)->assertContains("I am a page title",$this->title());
    }

    public function testLink()
    {
        $this->visit('/')->see('i am a link')->click('i am a link')->wait(2)->assertContains("I am another page title",$this->title());
    }
}
Modelizer commented 7 years ago

Closing for now.