/** * Tests that, after clicking the "Advanced" button, all of the * advanced filters appear on the page and are the correct element type. * * @return void */ function testCandidateListAdvancedOptionsAppear() { $this->safeGet($this->url . "/candidate_list/"); $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertContains("Access Profile", $bodyText); // Switch to Advanced mode $basicButton = $this->webDriver->findElement(WebDriverBy::Name("advanced")); $basicButton->click(); // Go through each element and ensure it's on the page after clicking // advanced $scanDoneOptions = $this->webDriver->findElement(WebDriverBy::Name("scan_done")); $this->assertEquals("select", $scanDoneOptions->getTagName()); $participantsStatusOptions = $this->webDriver->findElement(WebDriverBy::Name("Participant_Status")); $this->assertEquals("select", $participantsStatusOptions->getTagName()); $dobOptions = $this->webDriver->findElement(WebDriverBy::Name("dob")); $this->assertEquals("input", $dobOptions->getTagName()); // Not currently done //$this->assertEquals("date",$dobOptions->getAttribute("type")); $genderOptions = $this->webDriver->findElement(WebDriverBy::Name("gender")); $this->assertEquals("select", $genderOptions->getTagName()); $numVisits = $this->webDriver->findElement(WebDriverBy::Name("Visit_Count")); $this->assertEquals("input", $dobOptions->getTagName()); // Not currently done in Loris. //$this->assertEquals("number",$dobOptions->getAttribute("type")); //$this->assertEquals("0",$dobOptions->getAttribute("min")); $edcOptions = $this->webDriver->findElement(WebDriverBy::Name("edc")); $this->assertEquals("input", $edcOptions->getTagName()); // Not currently done //$this->assertEquals("date",$edcOptions->getAttribute("type")); $latestVisitOptions = $this->webDriver->findElement(WebDriverBy::Name("Latest_Visit_Status")); $this->assertEquals("select", $latestVisitOptions->getTagName()); $feedbackOptions = $this->webDriver->findElement(WebDriverBy::Name("Feedback")); $this->assertEquals("select", $feedbackOptions->getTagName()); }
public function test1() { $aAdVals = array('ad_id' => 1989, 'location' => array('VN', 'US'), 'ad_type' => Phpfox::getService('socialad.helper')->getConst('ad.type.html')); Phpfox::getService('unittest.test.socialad')->insertTestAd($aAdVals); $this->driver->get($this->url); $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_left .header_menu_login_input')); $search->click(); $this->driver->getKeyboard()->sendKeys('*****@*****.**'); // need refactoring $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_right .header_menu_login_input')); $search->click(); $this->driver->getKeyboard()->sendKeys('123456'); $search = $this->driver->findElement(WebDriverBy::cssSelector('.header_menu_login_button input')); $search->click(); // checking that page title contains word 'GitHub' $by = WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id']); $this->assertElementFound($by); $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id'])); $this->driver->executeScript('$(".ynsaDisplayAdHideButton").show();'); // $search->click(); // $this->driver->getMouse()->mouseMove($search->getCoordinates()); $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id'] . ' .ynsaDisplayAdHideButton')); $search->click(); $search = $this->driver->findElement(WebDriverBy::cssSelector('#ynsaAdDisplay_' . $aAdVals['ad_id'] . ' .ynsaDisplayAdBlock')); $this->assertFalse($search->isDisplayed()); // need a function convert xPath to css selector $search = $this->driver->findElement(WebDriverBy::cssSelector('#header_menu_holder ul:nth-child(1) > li:nth-child(3) > a:nth-child(1)')); $search->click(); $search = $this->driver->findElement(WebDriverBy::cssSelector('#header_menu_holder ul:nth-child(1) > li:nth-child(3) > ul > li:nth-child(6) a')); $search->click(); }
/** * Tests that, when loading the new_profile module with all settings * enabled, the correct fields all appear in the body. * * @return void */ function testNewProfilePageLoads() { $this->setUpConfigSetting("useEDC", "true"); $this->setUpConfigSetting("useProjects", "true"); $this->webDriver->get($this->url . "?test_name=new_profile"); $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertContains("New Profile", $bodyText); $dobField = $this->webDriver->findElement(WebDriverBy::Name("dob1")); $this->assertEquals("input", $dobField->getTagName()); //$this->assertEquals("date", $dobField->getAttribute("type")); $dob2Field = $this->webDriver->findElement(WebDriverBy::Name("dob2")); $this->assertEquals("input", $dob2Field->getTagName()); //$this->assertEquals("date", $dob2Field->getAttribute("type")); $edcField = $this->webDriver->findElement(WebDriverBy::Name("edc1")); $this->assertEquals("input", $edcField->getTagName()); //$this->assertEquals("date", $edcField->getAttribute("type")); $edc2Field = $this->webDriver->findElement(WebDriverBy::Name("edc2")); $this->assertEquals("input", $edc2Field->getTagName()); //$this->assertEquals("date", $edc2Field->getAttribute("type")); $genderField = $this->webDriver->findElement(WebDriverBy::Name("gender")); $this->assertEquals("select", $genderField->getTagName()); $projectField = $this->webDriver->findElement(WebDriverBy::Name("ProjectID")); $this->assertEquals("select", $projectField->getTagName()); $this->restoreConfigSetting("useEDC"); $this->restoreConfigSetting("useProjects"); }
/** * @test */ public function 質問ページから質問投稿する() { // $basic_user = '******'; // $basic_pass = '******'; // $gooid_user = '******'; // $gooid_pass = '******'; // $domain = '*****.goo.ne.jp'; require __DIR__ . '/../config.php'; $basic_user = urlencode($basic_user); $basic_pass = urlencode($basic_pass); $title = 'タイトル' . time(); $description = '本文' . time(); $driver = Util::createDriver(); Util::loginToGoo($driver, $gooid_user, $gooid_pass); $driver->get("http://{$basic_user}:{$basic_pass}@{$domain}/question"); $driver->findElement(\WebDriverBy::id('title_area'))->sendKeys($title); $driver->findElement(\WebDriverBy::id('text_area'))->sendKeys($description); $driver->findElement(\WebDriverBy::cssSelector('#question_confirm_btn > a > span.q-text'))->click(); Util::skipPageLenvingAlert($driver); $driver->wait(5)->until(\WebDriverExpectedCondition::visibilityOfElementLocated(\WebDriverBy::cssSelector('#match_categories > input'))); $driver->findElement(\WebDriverBy::cssSelector('#question_complete_button > a'))->click(); $driver->findElement(\WebDriverBy::cssSelector('li.tooSeeBtn > a'))->click(); $actual_title = $driver->getTitle(); $url = $driver->getCurrentUrl(); preg_match('/\\/qa\\/(\\d+)\\.html/', $url, $matches); $qid = $matches[1]; $trimed_title = preg_replace('/ - .+/', '', $actual_title); echo $actual_title . "\n"; echo $url . "\n"; echo $qid . "\n"; $driver->quit(); $this->assertEquals($title, $trimed_title); }
/** * @param Admin $I */ public function tryToTest(Admin $I) { // Select page module $I->wantToTest('Add a page with page module'); $I->click('Page'); // New page from root page $typo3NavigationContainer = '#typo3-navigationContainer'; $I->waitForElement($typo3NavigationContainer); $rootNode = 'a.x-tree-node-anchor > span'; $rootNodeIcon = '#extdd-1 > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-root'; $contextMenuNew = '#typo3-pagetree-contextmenu > ul > li.x-menu-list-item:nth-of-type(2) > a > span.x-menu-item-text'; $I->waitForElement($rootNode); $I->click($rootNodeIcon); $I->waitForElement($contextMenuNew); $I->click($contextMenuNew); // Switch to content frame $I->switchToIFrame('content'); // New page select position wizard $I->click('i[title="Insert the new page here"]'); // FormEngine new page record $saveButton = 'body > div > div.module-docheader.t3js-module-docheader > div.module-docheader-bar.module-docheader-bar-buttons.t3js-module-docheader-bar.t3js-module-docheader-bar-buttons > div.module-docheader-bar-column-left > div > div > button:nth-child(1)'; $I->waitForElement($saveButton); // Check empty $I->amGoingTo('check empty error'); $I->click($saveButton); $I->wait(2); $editControllerDiv = '#EditDocumentController > div'; $generalTab = $editControllerDiv . ' > div:nth-child(1) > ul > li'; $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use($generalTab) { return $webdriver->findElement(\WebDriverBy::cssSelector($generalTab))->getAttribute('class'); }); $I->assertContains('has-validation-error', $classString); // Add page $pageTitle = $editControllerDiv . ' > div:nth-child(1) > div > div.tab-pane:nth-child(1) > fieldset:nth-child(2) > div > div:nth-child(1) > div > div.form-control-wrap > div > input'; $I->fillField($pageTitle, 'Testpage'); $I->click($saveButton); $I->waitForElement($pageTitle); $I->assertEquals('Testpage', $I->grabValueFrom($pageTitle), 'Value in input field.'); $I->switchToIFrame(); // Check tree $I->waitForElement($typo3NavigationContainer); $pageInTree = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > a > span'; $I->assertEquals('Testpage', $I->grabTextFrom($pageInTree), 'Value in tree.'); // And delete page from tree $pageInTreeIcon = '#typo3-pagetree-tree > div > div > ul > div > li > ul > li > div > span.t3js-icon.icon.icon-size-small.icon-state-default.icon-apps-pagetree-page-default'; $pageActions = '#typo3-pagetree-contextmenu > ul > li:nth-child(8) > a > span.x-menu-item-text'; $delete = '#typo3-pagetree-contextmenu-sub1 > ul > li:nth-child(6) > a > span.x-menu-item-text'; $I->click($pageInTreeIcon); $I->waitForElement('#typo3-pagetree-contextmenu'); $I->waitForElement($pageActions); $I->moveMouseOver($pageActions); $I->waitForElement('#typo3-pagetree-contextmenu-sub1'); $I->click($delete); $yesButtonPopup = '#main > div.x-window.x-window-plain.x-window-dlg > div.x-window-bwrap > div.x-window-bl > div > div > div > div.x-panel-fbar.x-small-editor.x-toolbar-layout-ct > table > tbody > tr > td.x-toolbar-left > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(2) > td.x-btn-mc > em > button'; $I->waitForElement($yesButtonPopup); $I->click($yesButtonPopup); $I->wait(2); $I->cantSee('Testpage'); }
/** * Tests that Instrument list loads with permission * * @return void */ function testInstrumentListDoespageLoadWithPermission() { $this->setupPermissions(array("access_all_profiles")); $this->webDriver->get($this->url . "/instrument_list/"); $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertContains("instrument_list", $bodyText); $this->resetPermissions(); }
/** * Tests that help editor loads with the permission * * @return void */ function testDataTeamHelperPermission() { $this->setupPermissions(array("data_team_helper")); $this->safeGet($this->url . "/data_team_helper/"); $bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertNotContains("You do not have access to this page.", $bodyText); $this->resetPermissions(); }
/** * Tests that, when loading the instrument_manager module without permission, some * text appears in the body. * * @return void */ function testInstrumentManagerDoespageLoadWithoutpermission() { $this->setupPermissions(array()); $this->safeGet($this->url . "/instrument_manager/"); $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertContains("You do not have access to this page.", $bodyText); $this->resetPermissions(); }
/** * @param RemoteWebDriver $web_driver */ function __construct(RemoteWebDriver $web_driver) { $this->web_driver = $web_driver; // Дожидаемся загрузки первого елемента(в данном случае картинка) $wait = new WebDriverWait($this->web_driver, 30); $wait->until(WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::id('MainContent_img_lg'))); $this->products = $this->web_driver->findElements(WebDriverBy::cssSelector("a.pname_list")); }
static function getHotels() { $hotelsElements = self::getElement("hotelList")->findElements(\WebDriverBy::cssSelector("li.hotel")); $hotels = []; foreach ($hotelsElements as $element) { $hotels[] = new Hotel($element); } return $hotels; }
public function testBulkCompressShouldCompressUncompressedSizes() { $this->enable_compression_sizes(array('thumbnail')); $this->set_api_key('PNG123'); $this->upload_image(dirname(__FILE__) . '/../fixtures/example-large.png'); $this->enable_compression_sizes(array('thumbnail', 'medium')); media_bulk_action(self::$driver, 'tinypng_bulk_compress'); $this->assertContains('Compressed 2 out of 2 sizes', self::$driver->findElement(WebDriverBy::cssSelector('td.tiny-compress-images'))->getText()); }
public function testLimitReachedDismisses() { $this->set_api_key('LIMIT123'); $this->upload_image(dirname(__FILE__) . '/../fixtures/input-example.png'); self::$driver->findElement(WebDriverBy::cssSelector('.tiny-notice button, .tiny-notice a.tiny-dismiss'))->click(); self::$driver->wait(2)->until(WebDriverExpectedCondition::invisibilityOfElementWithText(WebDriverBy::cssSelector('.tiny-dismiss'), 'Dismiss')); self::$driver->get(wordpress('/wp-admin/options-media.php')); $this->assertEquals(0, count(self::$driver->findElements(WebDriverBy::cssSelector('div.error p')))); }
/** * @return int */ public function noOfTrainResultsOnPage() { $i = $this->actor; $elements = array(); $i->executeInSelenium(function (\RemoteWebDriver $webDriver) use(&$elements) { $elements = $webDriver->findElements(\WebDriverBy::cssSelector('div[id="results-train"] div[class="result"]')); }); return count($elements); }
/** * Tests that the final Radiological Review loads if the user has the correct * permissions (edit_final_radiological_review or view_final_radiological_review) * It should only be able to see the menu item. * @return void */ function testFinalRadiologicalReviewLoadsWithPermission() { $this->setupPermissions(array("view_final_radiological_review")); $this->safeGet($this->url . "/final_radiological_review/"); // Test that the Imaging menu appears in the first row $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertNotContains("You do not have access to this page.", $bodyText); $this->resetPermissions(); }
public function getAllDeals() { $dealsElements = $this->element->findElements(\WebDriverBy::cssSelector(self::DEALS_SELECTOR)); $deals = []; foreach ($dealsElements as $element) { $deals[] = new Deal($element); } return $deals; }
/** * Tests that searching for users using thei user IDs works * * @return void */ function testSearchForUsers() { $this->safeGet($this->url . "/user_accounts/"); $bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body")); $bodyText->getText(); $this->_assertSearchBy(array('userID' => 'my_nonexistent_user_ID'), null); $this->_assertSearchBy(array('userID' => 'UnitTester'), array(self::$_UNIT_TESTER)); $this->_assertSearchBy(array('userID' => 'unittester'), array(self::$_UNIT_TESTER)); $this->_assertSearchBy(array('userID' => 'n'), array(self::$_ADMIN, self::$_UNIT_TESTER)); }
public function testNavbarMenuIsOrangeWhenHovered() { $this->webDriver->get($this->url); try { $menu = $this->webDriver->findElement(WebDriverBy::cssSelector('.menu-link')); $this->webDriver->getMouse()->mouseMove($menu->getCoordinates()); $this->assertEquals('#FFd600', $menu->getCSSValue('color')); } catch (Facebook\WebDriver\Exception\NoSuchElementException $e) { $this->fail('Navbar menu not found'); } }
public function testInputExists() { $this->wd->get($this->url); $not_found = True; try { if ($this->wd->findElement(WebDriverBy::cssSelector('input[type="text"]'))) { $not_found = False; } } catch (Facebook\WebDriver\Exception\NoSuchElementException $e) { $this->fail('input not found'); } $this->assertFalse($not_found); }
/** *Tests landing the Reliability with the permission 'access_all_profiles' or 'reliability_edit_all' * * @return void */ function testLoginWithPermission() { $this->setupPermissions(array("access_all_profiles")); $this->safeGet($this->url . "/reliability/"); $bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertNotContains("You do not have access to this page.", $bodyText); $this->resetPermissions(); $this->setupPermissions(array("reliability_edit_all")); $this->safeGet($this->url . "/reliability/"); $bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertNotContains("You do not have access to this page.", $bodyText); $this->resetPermissions(); }
public function testSearch() { $sites = array('menshealth' => array('site_url' => 'http://www.menshealth.com', 'burger_link' => 'a#menu-btn-toggle'), 'runnersworld' => array('site_url' => 'http://www.runnersworld.com', 'burger_link' => 'a.menu-icon-link'), 'womenshealth' => array('site_url' => 'http://www.womenshealthmag.com', 'burger_link' => 'a#menu-btn-toggle')); foreach ($sites as $site) { $this->driver->get($site['site_url']); $search_term = 'fitness'; $search_link = $this->driver->findElement(WebDriverBy::className('search-submit')); $search_link->click(); $search_field = $this->driver->findElement(WebDriverBy::className('search-text')); $search_field->sendKeys($search_term)->submit(); $results_stats = $this->driver->findElement(WebDriverBy::cssSelector('.google-appliance-search-stats .placeholder')); $this->assertContains($search_term, $results_stats->getText()); } }
function testLoginSuccess() { $this->webDriver->get($this->url . '/main.php?logout=true'); $username = $this->webDriver->findElement(WebDriverBy::Name("username")); $this->assertEquals('', $username->getAttribute("value")); $password = $this->webDriver->findElement(WebDriverBy::Name("password")); $this->assertEquals('', $password->getAttribute("value")); $login = $this->webDriver->findElement(WebDriverBy::Name("login")); $this->assertEquals('submit', $login->getAttribute("type")); $this->assertEquals('Login', $login->getAttribute("value")); $username->sendKeys("UnitTester"); $password->sendKeys("4test4"); $login->click(); $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText(); $this->assertContains("Welcome", $bodyText); }
public function validarPaginaIcialValidarMensagemAlerta() { $this->driver->get($this->url); $this->driver->findElement(WebDriverBy::id("novopedido"))->click(); $this->driver->findElement(WebDriverBy::id("id"))->sendKeys("TESTE"); $combo = $this->driver->findElement(WebDriverBy::id("produto")); $combo = new WebDriverSelect($combo); $combo->selectByValue("Firefox"); $this->driver->findElement(WebDriverBy::id("estoque"))->sendKeys(100); $this->driver->findElement(WebDriverBy::id("valor"))->sendKeys(19.9); $this->driver->findElement(WebDriverBy::cssSelector("label[for='quantidade5']"))->click(); $this->driver->findElement(WebDriverBy::tagName("button"))->click(); $mensagem = $this->driver->switchTo()->alert()->getText(); $this->driver->switchTo()->alert()->dismiss(); $this->assertEquals("Sucesso", $mensagem); }
public function testBulkCompressShouldCompressAll() { $this->prepare(1, 1); self::$driver->get(wordpress('/wp-admin/upload.php?page=tiny-bulk-compress.php')); $elements = self::$driver->findElements(WebDriverBy::cssSelector('#tiny-bulk-compress p')); $this->assertContains('2 images', $elements[1]->getText()); self::$driver->findElement(WebDriverBy::cssSelector('#tiny-bulk-compress button'))->click(); self::$driver->wait(2)->until(WebDriverExpectedCondition::textToBePresentInElement(WebDriverBy::cssSelector('.updated'), 'All images are processed')); $elements = self::$driver->findElements(WebDriverBy::cssSelector('.media-item .filename')); $filenames = array_map('innerText', $elements); $this->assertEquals(2, count($filenames)); $this->assertContains('input-large', $filenames); $this->assertContains('input-example', $filenames); $this->assertEquals('2', self::$driver->findElement(WebDriverBy::cssSelector('#tiny-progress span'))->getText()); $this->assertEquals('5', self::$driver->findElement(WebDriverBy::cssSelector('#tiny-status span'))->getText()); }
/** * Set value of Select2 element * @param string $originalId ID of original select/input element * @param string $value Value to be selected * @param bool $multiSelect OPTIONAL Is the select multiselect? * @todo Support multiple values for multiselects */ public function setSelect2Value($originalId, $value, $multiSelect = false) { $select2selector = '#s2id_' . $originalId; // Wait for select2 to appear $select2link = $this->tc->wd->wait()->until(\WebDriverExpectedCondition::presenceOfElementLocated(\WebDriverBy::cssSelector($select2selector . ' ' . ($multiSelect ? 'input' : 'a')))); // Click on element to open dropdown - to copy users behavior $select2link->click(); $this->log('Sending keys to select2: %s', $value); // Insert searched term into s2 generated input $this->tc->wd->findElement(\WebDriverBy::cssSelector($multiSelect ? $select2selector . ' input' : '#select2-drop input'))->sendKeys($value); // Wait until result are rendered (or maybe loaded with ajax) $firstResult = $this->tc->wd->wait()->until(\WebDriverExpectedCondition::presenceOfElementLocated(\WebDriverBy::cssSelector('.select2-drop .select2-result.select2-highlighted'))); $this->log('Dropdown detected, selecting the first result: %s', $firstResult->getText()); // Select first item in results $firstResult->click(); }
public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::xpath('html/body/div[1]/div[1]/div/div[2]/form/label')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.repo-list-item:nth-child(1) > h3:nth-child(2) > a:nth-child(1)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); }
public function testSearch() { $this->webDriver->get($this->url); // find search field by its id $search = $this->webDriver->findElement(WebDriverBy::id('js-command-bar-field')); $search->click(); // typing into field $this->webDriver->getKeyboard()->sendKeys('php-webdriver'); // pressing "Enter" $this->webDriver->getKeyboard()->pressKey(WebDriverKeys::ENTER); $firstResult = $this->webDriver->findElement(WebDriverBy::cssSelector('li.public:nth-child(1) > h3:nth-child(3) > a:nth-child(1) > em:nth-child(2)')); $firstResult->click(); // we expect that facebook/php-webdriver was the first result $this->assertContains("php-webdriver", $this->webDriver->getTitle()); $this->assertEquals('https://github.com/facebook/php-webdriver', $this->webDriver->getCurrentURL()); $this->assertElementNotFound(WebDriverBy::className('avatar')); // $this->waitForUserInput(); }
/** * Call backend login page and verify login button changes color on mouse over, * verifies page is available and CSS is properly loaded. * * @param Kasper $I */ public function tryToTest(Kasper $I) { $I->wantTo('check login functions'); $I->amOnPage('/typo3/index.php'); $I->waitForElement('#t3-username', 10); $I->wantTo('mouse over css change login button'); // Make sure mouse is not over submit button from a previous test $I->moveMouseOver('#t3-username'); $bs = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); }); $I->moveMouseOver('#t3-login-submit'); $I->wait(1); $bsmo = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-login-submit'))->getCSSValue('box-shadow'); }); $I->assertFalse($bs === $bsmo); }
function testDataDictSearchKeywordFilters() { $this->webDriver->get($this->url . "/datadict/"); $this->webDriver->wait(120, 1000)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::Name("keyword"))); $searchKey = $this->webDriver->findElements(WebDriverBy::Name("keyword")); switch (count($searchKey)) { case 1: break; case 0: $this->fail("Could not find search keyword field"); return; default: $this->fail("Too many search keyword fields."); return; } $searchKey[0]->sendKeys("NotRealMAGICNUMBER335"); $searchButton = $this->webDriver->findElement(WebDriverBy::Name("filter")); $searchButton->click(); $this->markTestSkipped("Data Dict test not yet updated for React"); /* try { while (true) { $oldBody->isDisplayed(); } } catch(Exception $e) { $this->webDriver->executescript("document.documentElement.outerHTML"); } */ $rows = $this->webDriver->findElements(WebDriverBy::cssSelector("table tbody tr")); $this->assertTrue(count($rows) == 1, "Incorrect number of rows returned when filtering for keyword on datadict" . print_r($rows, true)); $cols = $this->webDriver->findElements(WebDriverBy::cssSelector("table tbody tr td")); // Rownumber $this->assertEquals($cols[0]->getText(), "1"); // SourceFrom $this->assertEquals($cols[1]->getText(), "nowhere"); // Name $this->assertEquals($cols[2]->getText(), "TestParameterNotRealMAGICNUMBER335"); // SourceField $this->assertEquals($cols[3]->getText(), "imaginary"); // Description $this->assertEquals($cols[4]->getText(), "I am a fake description used only for testing you should not see me. MAGICNUMBER335"); }
/** * Call backend login page and submit invalid login data. * Verifies login is not accepted and an error message is rendered. * * @param Kasper $I */ public function tryToTest(Kasper $I) { $I->wantTo('check login functions'); $I->amOnPage('/typo3/index.php'); $I->waitForElement('#t3-username'); $I->wantTo('check empty credentials'); $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-username'))->getAttribute('required'); }); $I->assertEquals('true', $required, '#t3-username'); $required = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) { return $webdriver->findElement(\WebDriverBy::cssSelector('#t3-password'))->getAttribute('required'); }); $I->assertEquals('true', $required, '#t3-password'); $I->wantTo('use bad credentials'); $I->fillField('#t3-username', 'testify'); $I->fillField('#t3-password', '123456'); $I->click('#t3-login-submit-section > button'); $I->waitForText('Verifying Login Data'); $I->waitForElement('#t3-login-error'); $I->see('Your login attempt did not succeed'); }
public function testRegisterNewUser() { // $now = time(); // $this->clickRegisterLink(); // $elements_values = array( // 'edit-name' => $now, // 'edit-mail' => "$now@example.com", // 'edit-pass-pass1' => 'password', // 'edit-pass-pass2'=> 'password', // ); // foreach ($elements_values as $key => $value) { // $element = $this->webDriver->findElement(WebDriverBy::id($key)); // $element->clear()->sendKeys($value); // } // $submit = $this->webDriver->findElement(WebDriverBy::id('edit-submit')); // $submit->click(); $now = Automation::registerNewUser($this->webDriver); $messages = $this->webDriver->findElement(WebDriverBy::cssSelector('.messages')); $expected_text = 'Registration successful. You are now logged in.'; $actual_text = $messages->getText(); $this->assertContains($expected_text, $actual_text, 'Registration message'); }