/** * Verify how the API calls were made. * * @param TestEvent $event Event. * * @return void */ public function verifyRemoteAPICalls(TestEvent $event) { $test_case = $event->getTestCase(); if (get_class($test_case) !== get_class($this) || $test_case->getName() !== $this->getName()) { return; } $browser = $this->getBrowser(); if ($browser instanceof SauceLabsBrowserConfiguration) { $session = $event->getSession(); if ($session === null) { $this->markTestSkipped('Unable to connect to SauceLabs. Please check Internet connection.'); } $sauce_rest = new SauceRest($browser->getApiUsername(), $browser->getApiKey()); $job_info = $sauce_rest->getJob($session->getDriver()->getWebDriverSessionId()); $this->assertEquals(get_class($test_case) . '::' . $test_case->getName(), $job_info['name']); $passed_mapping = array('testSuccess' => true, 'testFailure' => false); $this->assertSame($passed_mapping[$test_case->getName()], $job_info['passed']); } }
/** * Returns information about session. * * @param string $session_id Session ID. * * @return array */ public function getInfo($session_id) { return $this->_sauceRest->getJob($session_id); }