clean install

This commit is contained in:
matze committed 2024-12-10 15:08:16 +01:00
commit e14eb2d8fd
31193 files changed
+3555714

No files matched your search

@@ -0,0 +1,76 @@
<?php
/**
* Copyright 2012-2017 Anthon Pang. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package WebDriver
*
* @author Anthon Pang <apang@softwaredevelopment.ca>
*/
namespace WebDriver\SauceLabs;
use WebDriver\Capability as BaseCapability;
/**
* WebDriver\SauceLabs\Capability class
*
* @package WebDriver
*/
class Capability extends BaseCapability
{
/**
* Desired capabilities - SauceLabs
*
* @see https://saucelabs.com/docs/additional-config
*/
// Job Annotation
const NAME = 'name'; // Name the job
const BUILD = 'build'; // Record the build number
const TAGS = 'tags'; // Tag your jobs
const PASSED = 'passed'; // Record pass/fail status
const CUSTOM_DATA = 'custom-data'; // Record custom data
// Performance improvements and data collection
const RECORD_VIDEO = 'record-video'; // Video recording
const VIDEO_UPLOAD_ON_PASS = 'video-upload-on-pass'; // Video upload on pass
const RECORD_SCREENSHOTS = 'record-screenshots'; // Record step-by-step screenshots
const CAPTURE_HTML = 'capture-html'; // HTML source capture
const QUIET_EXCEPTIONS = 'webdriver.remote.quietExceptions'; // Enable Selenium 2's automatic screenshots
const SAUCE_ADVISOR = 'sauce-advisor'; // Sauce Advisor
// Selenium specific
const SELENIUM_VERSION = 'selenium-version'; // Use a specific Selenium version
const SINGLE_WINDOW = 'single-window'; // Selenium RC's single window mode
const USER_EXTENSIONS_URL = 'user-extensions-url'; // Selenium RC's user extensions
const FIREFOX_PROFILE_URL = 'firefox-profile-url'; // Selenium RC's custom Firefox profiles
// Timeouts
const MAX_DURATION = 'max-duration'; // Set maximum test duration
const COMMAND_TIMEOUT = 'command-timeout'; // Set command timeout
const IDLE_TIMEOUT = 'idle-timeout'; // Set idle test timeout
// Sauce specific
const PRERUN = 'prerun'; // Prerun executables
const TUNNEL_IDENTIFIER = 'tunnel-identifier'; // Use identified tunnel
const SCREEN_RESOLUTION = 'screen-resolution'; // Use specific screen resolution
const DISABLE_POPUP_HANDLER = 'disable-popup-handler'; // Disable popup handler
const AVOID_PROXY = 'avoid-proxy'; // Avoid proxy
const DEVICE_ORIENTATION = 'deviceOrientation'; // Device orientation (portrait or landscape)
const DEVICE_TYPE = 'deviceType'; // Device type (phone or tablet)
// Job Sharing
const PUBLIC_RESULTS = 'public'; // Make public, private, or share jobs
}
@@ -0,0 +1,313 @@
<?php
/**
* Copyright 2012-2017 Anthon Pang. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package WebDriver
*
* @author Anthon Pang <apang@softwaredevelopment.ca>
* @author Fabrizio Branca <mail@fabrizio-branca.de>
*/
namespace WebDriver\SauceLabs;
use WebDriver\ServiceFactory;
/**
* WebDriver\SauceLabs\SauceRest class
*
* @package WebDriver
*/
class SauceRest
{
/**
* @var string
*/
private $userId;
/**
* @var string
*/
private $accessKey;
/**
* Constructor
*
* @param string $userId Your Sauce user name
* @param string $accessKey Your Sauce API key
*/
public function __construct($userId, $accessKey)
{
$this->userId = $userId;
$this->accessKey = $accessKey;
}
/**
* Execute Sauce Labs REST API command
*
* @param string $requestMethod HTTP request method
* @param string $url URL
* @param mixed $parameters Parameters
*
* @return mixed
*
* @throws \WebDriver\Exception\CurlExec
*
* @see http://saucelabs.com/docs/saucerest
*/
protected function execute($requestMethod, $url, $parameters = null)
{
$extraOptions = array(
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_USERPWD => $this->userId . ':' . $this->accessKey,
// don't verify SSL certificates
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTPHEADER => array('Expect:'),
CURLOPT_FAILONERROR => true,
);
$url = 'https://saucelabs.com/rest/v1/' . $url;
list($rawResult, $info) = ServiceFactory::getInstance()->getService('service.curl')->execute($requestMethod, $url, $parameters, $extraOptions);
return json_decode($rawResult, true);
}
/**
* Get account details: /rest/v1/users/:userId (GET)
*
* @param string $userId
*
* @return array
*/
public function getAccountDetails($userId)
{
return $this->execute('GET', 'users/' . $userId);
}
/**
* Check account limits: /rest/v1/limits (GET)
*
* @return array
*/
public function getAccountLimits()
{
return $this->execute('GET', 'limits');
}
/**
* Create new sub-account: /rest/v1/users/:userId (POST)
*
* For "partners", $accountInfo also contains 'plan' => (one of 'free', 'small', 'team', 'com', or 'complus')
*
* @param array $accountInfo array('username' => ..., 'password' => ..., 'name' => ..., 'email' => ...)
*
* @return array array('access_key' => ..., 'minutes' => ..., 'id' => ...)
*/
public function createSubAccount($accountInfo)
{
return $this->execute('POST', 'users/' . $this->userId, $accountInfo);
}
/**
* Update sub-account service plan: /rest/v1/users/:userId/subscription (POST)
*
* @param string $userId User ID
* @param string $plan Plan
*
* @return array
*/
public function updateSubAccount($userId, $plan)
{
return $this->execute('POST', 'users/' . $userId . '/subscription', array('plan' => $plan));
}
/**
* Unsubscribe a sub-account: /rest/v1/users/:userId/subscription (DELETE)
*
* @param string $userId User ID
*
* @return array
*/
public function unsubscribeSubAccount($userId)
{
return $this->execute('DELETE', 'users/' . $userId . '/subscription');
}
/**
* Get current account activity: /rest/v1/:userId/activity (GET)
*
* @return array
*/
public function getActivity()
{
return $this->execute('GET', $this->userId . '/activity');
}
/**
* Get historical account usage: /rest/v1/:userId/usage (GET)
*
* @param string $start Optional start date YYYY-MM-DD
* @param string $end Optional end date YYYY-MM-DD
*
* @return array
*/
public function getUsage($start = null, $end = null)
{
$query = http_build_query(array(
'start' => $start,
'end' => $end,
));
return $this->execute('GET', $this->userId . '/usage' . (strlen($query) ? '?' . $query : ''));
}
/**
* Get jobs: /rest/v1/:userId/jobs (GET)
*
* @param boolean $full
*
* @return array
*/
public function getJobs($full = null)
{
$query = http_build_query(array(
'full' => (isset($full) && $full) ? 'true' : null,
));
return $this->execute('GET', $this->userId . '/jobs' . (strlen($query) ? '?' . $query : ''));
}
/**
* Get full information for job: /rest/v1/:userId/jobs/:jobId (GET)
*
* @param string $jobId
*
* @return array
*/
public function getJob($jobId)
{
return $this->execute('GET', $this->userId . '/jobs/' . $jobId);
}
/**
* Update existing job: /rest/v1/:userId/jobs/:jobId (PUT)
*
* @param string $jobId Job ID
* @param array $jobInfo Job information
*
* @return array
*/
public function updateJob($jobId, $jobInfo)
{
return $this->execute('PUT', $this->userId . '/jobs/' . $jobId, $jobInfo);
}
/**
* Stop job: /rest/v1/:userId/jobs/:jobId/stop (PUT)
*
* @param string $jobId
*
* @return array
*/
public function stopJob($jobId)
{
return $this->execute('PUT', $this->userId . '/jobs/' . $jobId . '/stop');
}
/**
* Delete job: /rest/v1/:userId/jobs/:jobId (DELETE)
*
* @param string $jobId
*
* @return array
*/
public function deleteJob($jobId)
{
return $this->execute('DELETE', $this->userId . '/jobs/' . $jobId);
}
/**
* Get running tunnels for a given user: /rest/v1/:userId/tunnels (GET)
*
* @return array
*/
public function getTunnels()
{
return $this->execute('GET', $this->userId . '/tunnels');
}
/**
* Get full information for a tunnel: /rest/v1/:userId/tunnels/:tunnelId (GET)
*
* @param string $tunnelId
*
* @return array
*/
public function getTunnel($tunnelId)
{
return $this->execute('GET', $this->userId . '/tunnels/' . $tunnelId);
}
/**
* Shut down a tunnel: /rest/v1/:userId/tunnels/:tunnelId (DELETE)
*
* @param string $tunnelId
*
* @return array
*/
public function shutdownTunnel($tunnelId)
{
return $this->execute('DELETE', $this->userId . '/tunnels/' . $tunnelId);
}
/**
* Get current status of Sauce Labs' services: /rest/v1/info/status (GET)
*
* @return array array('wait_time' => ..., 'service_operational' => ..., 'status_message' => ...)
*/
public function getStatus()
{
return $this->execute('GET', 'info/status');
}
/**
* Get currently supported browsers: /rest/v1/info/browsers (GET)
*
* @param string $termination Optional termination (one of "all", "selenium-rc", or "webdriver')
*
* @return array
*/
public function getBrowsers($termination = '')
{
if ($termination) {
return $this->execute('GET', 'info/browsers/' . $termination);
}
return $this->execute('GET', 'info/browsers');
}
/**
* Get number of tests executed so far on Sauce Labs: /rest/v1/info/counter (GET)
*
* @return array
*/
public function getCounter()
{
return $this->execute('GET', 'info/counter');
}
}