public function testEmptyField()
 {
     $this->clearData();
     $this->submitForm();
     $this->assertEquals($this->baseUrl . "/system/company", $this->webDriver->getCurrentURL());
     $this->assertEquals(1, count($this->webDriver->findElement(WebDriverBy::className("error-box"))));
 }
 public function testBlankFields()
 {
     //click with empty data
     $this->submitForm();
     $this->assertEquals($this->baseUrl . "/system/permissions/create", $this->webDriver->getCurrentURL());
     $this->assertEquals(1, count($this->webDriver->findElement(WebDriverBy::className("error-box"))));
 }
示例#3
0
 public function testProcessOrder()
 {
     $this->driver->get($this->getTestPath('/admin'));
     $this->driver->findElement(WebDriverBy::id('username'))->sendKeys('admin');
     $this->driver->findElement(WebDriverBy::id('login'))->sendKeys('P@ssw0rd');
     $this->driver->findElement(WebDriverBy::className('form-button'))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Sales']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Orders']"))->click();
     $this->driver->wait()->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('sales_order_grid_filter_real_order_id')));
     $this->driver->findElement(WebDriverBy::id('sales_order_grid_filter_real_order_id'))->sendKeys('ICANN-D10000014');
     $this->driver->findElement(WebDriverBy::id('sales_order_grid_filter_real_order_id'))->sendKeys(WebDriverKeys::ENTER);
     sleep(3);
     $this->driver->findElement(WebDriverBy::xpath("//html/body/div[1]/div[2]/div/div[3]/div/div[2]/div/table/tbody/tr[1]/td[2]"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Invoice']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Submit Invoice']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Ship']"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Add Tracking Number']"))->click();
     $this->driver->findElement(WebDriverBy::id("trackingC1"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//select[@id='trackingC1']/option[@value='fedex']"))->click();
     $this->driver->findElement(WebDriverBy::id("trackingT1"))->sendKeys('FEDEX');
     $this->driver->findElement(WebDriverBy::id("trackingN1"))->sendKeys('Tracking0001');
     $this->driver->findElement(WebDriverBy::id("send_email"))->click();
     $this->driver->findElement(WebDriverBy::xpath("//span[text()='Submit Shipment']"))->click();
     sleep(5);
 }
示例#4
0
 public function testShouldNotLogCommandsInNormalMode()
 {
     $this->setDebugMode(false);
     // Make debug mode disabled
     $this->driver->findElement(\WebDriverBy::className('foo'));
     $this->driver->getTitle();
     $this->expectOutputString('');
 }
 /**
  * Test searchs based only on rooms.
  * @test
  */
 public function testRoomSearch()
 {
     //#1 Search for room only with numbers
     self::$helper->createRoomAttribute("Beamer");
     self::$helper->createRoom('123', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 3));
     self::$helper->searchForRoomByName("123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("123", self::$helper->getFirstResult());
     //#2 Search for room with letter
     self::$helper->createRoom('032a', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
     self::$helper->searchForRoomByName("032a");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("032a", self::$helper->getFirstResult());
     //#3 Search for 123a to trigger intelligent search
     self::$helper->searchForRoomByName("123a");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("123", self::$helper->getFirstResult());
     try {
         self::$webDriver->findElement(WebDriverBy::className('ilInfoMessage'));
     } catch (Exception $ex) {
         $this->fail("#3 Intelligent Search did not give a message" . $ex);
     }
     //#4 Search for empty room
     self::$helper->searchForRoomByName("");
     $this->assertEquals("2", self::$helper->getNoOfResults());
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('123'));
         self::$webDriver->findElement(WebDriverBy::linkText('032a'));
     } catch (Exception $ex) {
         $this->fail("#4 Searching for all rooms did not find all rooms");
     }
     //#5 Search for only letter room
     self::$helper->searchForRoomByName("IA");
     $this->assertEquals("0", self::$helper->getNoOfResults());
     self::$helper->createRoom('IA', 1, 20, "TEST", " - Keine Zuordnung - ", array('Beamer' => 1));
     self::$helper->searchForRoomByName("IA");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     $this->assertEquals("IA", self::$helper->getFirstResult());
     //#6 (intelligent) search for room with - signed numbers
     self::$helper->searchForRoomByName("-123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     //#7 (intelligent) search for room with + signed numbers
     self::$helper->searchForRoomByName("+123");
     $this->assertEquals("1", self::$helper->getNoOfResults());
     //#8 Test SQL Injection
     self::$helper->searchForRoomByName("\\';SELECT * FROM usr;--");
     $this->assertEquals("0", self::$helper->getNoOfResults());
     //#9 Search for multiple rooms
     self::$helper->searchForRoomByName("2");
     $this->assertEquals("2", self::$helper->getNoOfResults());
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('123'));
         self::$webDriver->findElement(WebDriverBy::linkText('032a'));
     } catch (Exception $ex) {
         $this->fail("#9 Searching for rooms containing 2 did not find all rooms");
     }
     self::$helper->deleteAllRooms();
 }
示例#6
0
 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());
     }
 }
示例#7
0
 public function testNavBar()
 {
     $this->driver->get('http://localhost:80/index.php');
     $menu = $this->driver->findElement(WebDriverBy::id('navcontent'))->findElement(WebDriverBy::tagName('ul'));
     //assert that we are not in mobile mode when maximized
     $this->driver->manage()->window()->maximize();
     $this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
     //assert that we are in mobile mode with a small window
     $this->driver->manage()->window()->setSize(new WebDriverDimension(450, 600));
     $this->driver->wait(2, 250)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu")));
     $this->assertContains("mobilemenu", $menu->getAttribute("class"));
     //assert that reverting back clears mobile mode
     $this->driver->manage()->window()->maximize();
     //$this->driver->wait(2, 250)->until(WebDriverExpectedCondition::not(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("mobilemenu"))));
     sleep(1);
     $this->assertFalse(strpos($menu->getAttribute("class"), "mobilemenu"));
 }
示例#8
0
 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'));
 }
示例#9
0
 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();
 }
示例#10
0
<?php

// An example of using php-webdriver.
require_once 'lib/__init__.php';
// start Firefox with 5 second timeout
$host = 'http://localhost:4444/wd/hub';
// this is the default
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => 'firefox');
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
// navigate to 'http://docs.seleniumhq.org/'
$driver->get('http://docs.seleniumhq.org/');
// adding cookie
$driver->manage()->deleteAllCookies();
$driver->manage()->addCookie(array('name' => 'cookie_name', 'value' => 'cookie_value'));
$cookies = $driver->manage()->getCookies();
print_r($cookies);
// click the link 'About'
$link = $driver->findElement(WebDriverBy::id('menu_about'));
$link->click();
// print the title of the current page
echo "The title is " . $driver->getTitle() . "'\n";
// print the title of the current page
echo "The current URI is " . $driver->getCurrentURL() . "'\n";
// Search 'php' in the search box
$input = $driver->findElement(WebDriverBy::id('q'));
$input->sendKeys('php')->submit();
// wait at most 10 seconds until at least one result is shown
$driver->wait(10)->until(WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(WebDriverBy::className('gsc-result')));
// close the Firefox
$driver->quit();
 /**
  * Tests the editing of rooms.
  * @test
  */
 public function testRoomEditing()
 {
     self::$helper->createRoom('name1', 1, 2, "type1", " - Keine Zuordnung - ");
     self::$helper->createRoom('name2', 1, 2, "type2", " - Keine Zuordnung - ");
     // edit room1: change name to name2 -> fail
     self::$helper->editRoom('name1', 'name2', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#1 Editing of a room name to existing name has succeeded" . $ex);
     }
     // edit room1: change name to empty string -> fail
     self::$helper->editRoom('name1', '', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#2 Editing of a room name to empty string has succeeded" . $ex);
     }
     // edit room1: change seats to empty string -> fail
     self::$helper->editRoom('name1', 'name1', 1, '', "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Editing of room seats to empty string has succeeded" . $ex);
     }
     // edit room1: change seats to less than min seats -> fail
     self::$helper->editRoom('name1', 'name1', 2, 1, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#4 Editing of room seats to less than min seats has succeeded" . $ex);
     }
     // edit room1: change seats to negative seats -> fail
     self::$helper->editRoom('name1', 'name1', 1, -1, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5 Editing of room seats negative seats has succeeded" . $ex);
     }
     // edit room1: change name to name3 -> success
     self::$helper->editRoom('name1', 'name3', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name3"));
         self::$webDriver->findElement(WebDriverBy::linkText("name2"));
     } catch (Exception $ex) {
         $this->fail("#6 Editing of room name has failed" . $ex);
     }
     // edit room2: change name to name1 -> success
     self::$helper->editRoom('name2', 'name1', 1, 2, "type2", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name3"));
         self::$webDriver->findElement(WebDriverBy::linkText("name1"));
     } catch (Exception $ex) {
         $this->fail("#7 Editing of room name has failed" . $ex);
     }
     // edit room1: change name to name2 -> success
     self::$helper->editRoom('name3', 'name2', 1, 2, "type1", " - Keine Zuordnung - ");
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("name2"));
         self::$webDriver->findElement(WebDriverBy::linkText("name1"));
     } catch (Exception $ex) {
         $this->fail("#8 Editing of room name has failed" . $ex);
     }
 }
示例#12
0
function orderMedications($driver, $name)
{
    goHome($driver);
    $medication = $driver->findElement(WebDriverBy::linkText('Medication List'));
    $medication->click();
    $driver->wait(65);
    $order = $driver->findElement(WebDriverBy::className('btn'));
    $order->click();
    $driver->findElement(WebDriverBy::name("quantity"))->sendKeys("23");
    $driver->findElement(WebDriverBy::name("name"))->sendKeys($name);
    $order = $driver->findElement(WebDriverBy::className('btn'));
    $order->click();
    //  $driver->findElement(WebDriverBy::name("quantity"))->sendKeys("5");
    //  $driver->findElement(WebDriverBy::name("name"))->sendKeys($name);
    //  $order = $driver->findElement(WebDriverBy::className('btn'));
    //  $order->click();
    goHome($driver);
}
 public function testAppointmentPrivileges()
 {
     #1 check without any privilege
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     try {
         $webDriver->findElement(webDriverBy::linkText('Termine'));
         $this->fail("#1 Appointments are displayed even if there's no privilege");
     } catch (Exception $ex) {
         //Nothing to do here - the Element musn't be found!
     }
     #2 check with the privilege to see appointments and administrate booking attributes
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     $class_1_id = self::$helper->getPrivilegeClassIDByNamePartial(self::$classname_1);
     self::$helper->grantPrivilege('accessAppointments', $class_1_id);
     self::$helper->grantPrivilege('adminBookingAttributes', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Termine'))->isDisplayed(), '#2 - 1 Appointments are not displayed even the privilege is granted');
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Termine'))->isDisplayed(), '#2 - 2 Attributes are not displayed even the privilege is granted');
     # Check if non_public bookings are not displayed
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     //Create a non-public booking
     self::$helper->createRoom(self::$standard_roomname, '1', '10');
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "12", "00", "1", "1", date("Y") + 1, "13", "00", '');
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(0, self::$helper->getNoOfResults(), "#3 A non-public booking is visible to an user without the privilege");
     #4 Check the privilege to see non-public bookings
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('seeNonPublicBookingInformation', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(1, self::$helper->getNoOfResults(), "#4 A non-public booking is not visible to an user with the privilege");
     #5 Check if the search is accessible
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('accessSearch', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::linkText('Suche'))->isDisplayed(), '#5 Search is not displayed even the privilege is granted');
     #6 Check if the "add booking"-link is not showed, if the privilege isn't given
     try {
         $webDriver->findElement(webDriverBy::partialLinkText('Buchung hinzufügen'))->click();
         $this->fail('#6 Add Booking is acceptible without the privilege');
     } catch (Exception $ex) {
         //Nothing to do - the exception should come
     }
     #7 Check if the "add booking"-link is showed if the privilege is given
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('addOwnBookings', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::partialLinkText('Buchung hinzufügen'))->isDisplayed(), '#7 Add Booking is not displayed even the privilege is granted');
     #8 Check if a user with a higher Priority can oust another booking
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "15", "00", "1", "1", date("Y") + 1, "16", "00", '');
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "17", "00", "1", "1", date("Y") + 1, "18", "00", '');
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     $class_2_id = self::$helper->getPrivilegeClassIDByNamePartial(self::$classname_2);
     self::$helper->grantPrivilege('cancelBookingLowerPriority', $class_2_id);
     self::$helper->grantPrivilege('accessSearch', $class_2_id);
     self::$helper->grantPrivilege('seeNonPublicBookingInformation', $class_2_id);
     self::$helper->grantPrivilege('accessAppointments', $class_2_id);
     self::$helper->grantPrivilege('addOwnBookings', $class_2_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_2_login, self::$new_user_2_pw);
     self::$helper->toRSS();
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "15", "00", "1", "1", date("Y") + 1, "16", "00", '');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
         $this->fail("#8 Booking with ousting a lower-priority booking does not succeed");
     } catch (Exception $ex) {
     }
     #9 Check if user with higher priority can cancel bookings with lower priority
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::id('chb_select_all_'))->click();
     self::$webDriver->findElement(webDriverBy::cssSelector('div.ilTableCommandRow > div > input[name="cmd[confirmMultipleCancels]"]'))->click();
     self::$webDriver->findElement(webDriverBy::name('cmd[cancelMultipleBookings]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
         $this->fail('#9 Cancelling a booking with a lower priority is impossible');
     } catch (Exception $ex) {
     }
     #10 Check if serial bookings can be made and if unlimited bookings are possible
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('addSequenceBookings', $class_1_id);
     self::$helper->grantPrivilege('addUnlimitedBookings', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     try {
         $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::id('il_recurrence_1'))->isDisplayed(), "#10 Sequence Bookings are impossible");
     } catch (Exception $ex) {
         $this->fail("#10 Sequence Bookings are impossible");
     }
     self::$helper->toRSS();
     self::$helper->searchForRoomByName(self::$standard_roomname);
     self::$webDriver->findElement(WebDriverBy::linktext('Buchen'))->click();
     self::$helper->doABooking(self::$standard_subject, "1", "1", date("Y") + 1, "20", "00", "1", "1", date("Y") + 2, "11", "00", '');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
         $this->fail('#10 Unlimited Bookings are impossible');
     } catch (Exception $ex) {
     }
     #11 Import Bookings
     self::$helper->logout();
     self::$helper->login(self::$login_root, self::$pass_root);
     self::$helper->toRSS();
     self::$webDriver->findElement(webDriverBy::linkText('Privilegien'))->click();
     self::$helper->grantPrivilege('accessImport', $class_1_id);
     self::$helper->logout();
     self::$helper->login(self::$new_user_1_login, self::$new_user_1_pw);
     self::$helper->toRSS();
     try {
         $this->assertEquals(true, self::$webDriver->findElement(webDriverBy::partialLinkText('Import'))->isDisplayed(), "#11 Import is not accessible");
     } catch (Exception $ex) {
         $this->fail("#11 Import is not accessible");
     }
     //Not implemented: Preferences for notifications. The ID for this privilege
     // (to be used in grantPrivilege() is 'notificationSettings'
 }
示例#14
0
 public function testGetByClassName()
 {
     $this->driver->get($this->getTestPath('index.html'));
     self::assertEquals('Test by Class', $this->driver->findElement(WebDriverBy::className('test_class'))->getText());
 }
 /**
  * Test import for DaVinci as far as possible
  */
 public function testImport()
 {
     #1 Import without file
     self::$helper->importDaVinciFile('');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#1 Import no file does work");
     }
     #2 Import with false file
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'fail.txt');
     try {
         //No error message
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#2 Import a false/corrupted file does work");
     }
     #3 Import with false file type
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'fail.pdf');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Import a false file type does work");
     }
     #4 Import with bookings but without rooms
     //Imports rooms too!
     //self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, false, 20);
     try {
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#4 Import bookings without rooms does work");
     }
     #5 Import without bookings, only rooms with -1 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, -1);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5 Import room with -1 seats does work");
     }
     #6 Import without bookings, only rooms with "ab" seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, "ab");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#6 Import room with ab seats does work");
     }
     #7 Import without bookings, only rooms with 0 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, 0);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#7 Import room with 0 seats does work");
     }
     #8 Import without bookings, only rooms with "" seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, "");
     try {
         //Missing Error Message
         //self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#8 Import room with no seats does work");
     }
     #9 Import without bookings, only rooms with 20 seats
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', false, true, 20);
     try {
         //No sucess message
         //self::$webDriver->findElement(WebDriverBy::className("ilInfoMessage"));
         self::$webDriver->findElement(WebDriverBy::linkText('Räume'))->click();
         self::$webDriver->findElement(WebDriverBy::linkText('I117'));
     } catch (Exception $ex) {
         $this->fail('#9.1 Import rooms does not work');
     }
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
     } catch (Exception $ex) {
         $this->fail('#9.2 Import rooms also imports bookings');
     }
     #10 Import bookings to rooms
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, false, 20);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
         $this->fail('#10 Import bookings does not work');
     } catch (Exception $ex) {
         //Comes here when sucessful!
     }
     #11 Override all
     self::$helper->importDaVinciFile(self::$test_file_absolut_path . 'sucess.txt', true, true, 10);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Räume'))->click();
         self::$webDriver->findElement(WebDriverBy::linkText('I117'));
     } catch (Exception $ex) {
         $this->fail('#11.1 Override rooms does not work');
     }
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Einträge']"));
         $this->fail('#11.2 Override bookings does not work');
     } catch (Exception $ex) {
         //Comes here when sucessful!
     }
 }
 /**
  * Precondition: No priviledge classes
  * Postcondition: No priviledge classes
  * @test
  */
 public function createAndDeleteClassesTest()
 {
     //#1 Test Cancel of a creation
     self::$webDriver->findElement(WebDriverBy::linkText('Privilegien'))->click();
     self::$webDriver->findElement(WebDriverBy::linkText(' Neue Klasse anlegen '))->click();
     self::$webDriver->findElement(WebDriverBy::name('cmd[showPrivileges]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText(' Neue Klasse anlegen '));
     } catch (Exception $ex) {
         $this->fail("#1: Cancel of a new privilege class does not link to pivilege class overview: " . $ex);
     }
     //#2 Create a Privilege Class
     self::$helper->createPrivilegClass("Test_A", "Test_A", "User", 1);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("Test_A ⇒ User"));
     } catch (Exception $ex) {
         $this->fail("#2.1: Creation of a new privilege class with ILIAS-role does not work: " . $ex);
     }
     self::$helper->createPrivilegClass("Test_C", "Test_C", "Keine", 5);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("Test_C"));
     } catch (Exception $ex) {
         $this->fail("#2.2: Creation of a new privilege class without ILIAS-role does not work: " . $ex);
     }
     self::$helper->deletePrivilegClass("Test_C");
     //#3 Create an existing privilege class
     self::$helper->createPrivilegClass("Test_A", "Test_A", "User", 1);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3: Creation of an existing privilege class with ILIAS-role  works: " . $ex);
     }
     //#4 Create a privilege class that gets user-rolls from the same role as another already existing class.
     self::$webDriver->findElement(WebDriverBy::name('cmd[showPrivileges]'))->click();
     self::$helper->createPrivilegClass("Test_B", "Test_B", "User", 0);
     try {
         self::$webDriver->findElement(WebDriverBy::linkText("Test_B ⇒ User"));
     } catch (Exception $ex) {
         $this->fail("#4: Creation of a new privilege class with same ILIAS-role as another does not work: " . $ex);
     }
     self::$helper->deletePrivilegClass("Test_B ⇒ User");
     //#5 Create an empty privileges class
     self::$helper->createPrivilegClass("", "Test_C", "Guest", 2);
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5: Creation of a no-name privilege class seems to be allowed: " . $ex);
     }
     self::$webDriver->findElement(WebDriverBy::name("cmd[showPrivileges]"))->click();
     //#6 Delete Test_A class, none should be left
     self::$webDriver->findElement(WebDriverBy::linkText("Test_A ⇒ User"))->click();
     self::$webDriver->findElement(WebDriverBy::linkText(' Klasse löschen '))->click();
     self::$webDriver->findElement(WebDriverBy::name('cmd[renderEditClassForm]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText(' Klasse löschen '))->click();
     } catch (Exception $ex) {
         $this->fail("#6.1: Click cancel in the delete confirmation does not redirect to edit of the class " . $ex);
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Klasseneigenschaften'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText(' Klasse löschen '))->click();
     } catch (Exception $ex) {
         $this->fail("#6.2: Click backtab in the delete confirmation does not redirect to edit of the class " . $ex);
     }
     self::$webDriver->findElement(WebDriverBy::name('cmd[deleteClass]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Keine Klassen vorhanden']"))->click();
     } catch (Exception $ex) {
         $this->fail("#6.3: Deleting a privileges class does not delete it " . $ex);
     }
 }
 /**
  * @test
  */
 public function testBookingattributeManagement()
 {
     //#1 Create a new booking attribute
     self::$helper->createBookingAttribute("Book_A");
     try {
         self::$webDriver->findElement(WebDriverBy::id('radio_action_mode_rename_attribute'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//option[text()='Book_A']"));
     } catch (Exception $ex) {
         $this->fail("#1 Creation of a new booking attribute has failed" . $ex);
     }
     //#2 Create an empty booking attribute
     self::$helper->createBookingAttribute("");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Creation of an empty booking attribute has succeded" . $ex);
     }
     //#3 Create an existing booking attribute
     self::$helper->createBookingAttribute("Book_A");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#3 Creation of an existing booking attribute has succeded" . $ex);
     }
     //#4 Create a new booking attribute with html tags
     self::$helper->createBookingAttribute("<b><u>Book_B</u></b>");
     try {
         self::$webDriver->findElement(WebDriverBy::id('radio_action_mode_rename_attribute'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//option[text()='Book_B']"));
     } catch (Exception $ex) {
         $this->fail("#5 Creation of a new booking attribute with HTML has failed" . $ex);
     }
     self::$helper->changeBookingAttribute('Book_B', 'Book_B');
     //#5 Check if creation bookings GUI has the new attributes
     self::$helper->createRoom('123', 1, 20, "TEST", " - Keine Zuordnung - ", array());
     self::$helper->searchForRoomByAll("123", "", "", "", date('Y') + 1, '23', '50', '23', '55', array());
     self::$webDriver->findElement(WebDriverBy::linkText("Buchen"))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::xpath("//label[text()='Book_A']"));
         self::$webDriver->findElement(WebDriverBy::xpath("//label[text()='Book_B']"));
     } catch (Exception $ex) {
         $this->fail("#5 Creation booking GUI does not have created attributes" . $ex);
     }
     self::$helper->doABooking('TEST', "", "", "", "", "", "", "", "", "", "", false, "", false, array(), array('Book_A' => 'TEST A', 'Book_B' => 'TEST B'));
     //#6 Change name of a booking attribute into a new
     self::$helper->changeBookingAttribute('Book_A', 'Book_C');
     try {
         self::$webDriver->findElement(WebDriverBy::id('radio_action_mode_rename_attribute'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//option[text()='Book_C']"));
     } catch (Exception $ex) {
         $this->fail("#6 Renaming a booking attribute has failed" . $ex);
     }
     //#7 Change name of a booking attribute into nothing
     self::$helper->changeBookingAttribute('Book_C', '');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#7 Changing a booking attribute to no name has succeded" . $ex);
     }
     //#8 Change name of a booking attribute into existing one
     self::$helper->changeBookingAttribute('Book_C', 'Book_B');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#8 Changing a booking attribute to an existing name has succeded " . $ex);
     }
     //#9 Change name of a booking attribute into the same
     self::$helper->changeBookingAttribute('Book_C', 'Book_C');
     try {
         self::$webDriver->findElement(WebDriverBy::id('radio_action_mode_rename_attribute'))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//option[text()='Book_C']"));
     } catch (Exception $ex) {
         $this->fail("#9 Renaming a booking attribute to his old name has failed " . $ex);
     }
     //#10 Check if changes did not effect the bookings
     self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
     self::$webDriver->findElement(WebDriverBy::id('ilChkboxListAnchorText_tbl_roomobj'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Book_C']"));
         self::$webDriver->findElement(WebDriverBy::xpath("//td[text()='Book_B']"));
         $attr_inputs = self::$webDriver->findElements(WebDriverBy::name("tblfsroomobj[]"));
         foreach ($attr_inputs as $input) {
             if (empty($input->getAttribute('checked'))) {
                 $input->click();
             }
         }
         self::$webDriver->findElement(WebDriverBy::name("cmd[showBookings]"))->click();
         self::$webDriver->findElement(WebDriverBy::xpath("//td[contains(text(),'TEST A')]"));
         self::$webDriver->findElement(WebDriverBy::xpath("//td[contains(text(),'TEST B')]"));
     } catch (Exception $ex) {
         $this->fail("#10 Changes of a booking attribute does effect bookings");
     }
     //#11 Delete booking attribute
     self::$helper->deleteBookingAttribute("Book_C");
     $el = false;
     try {
         self::$webDriver->findElement(WebDriverBy::id('radio_action_mode_rename_attribute'))->click();
         $el = self::$webDriver->findElement(WebDriverBy::xpath("//option[text()='Book_C']"));
     } catch (Exception $unused) {
     }
     if ($el) {
         $this->fail("#11 Deleting a booking attribute has failed");
     }
     self::$helper->deleteBookingAttribute("Book_B");
     //#12 Change none booking attribute to a new name
     self::$helper->changeBookingAttribute('', 'Book_B');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#12 Changing a none existing booking attribute to an none existing name has succeded" . $ex);
     }
     //#13 Delete none booking attribute
     self::$helper->deleteBookingAttribute('');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#13 Deleting a none existing booking attribute has succeded" . $ex);
     }
     //#14 Check if deletion did effect the bookings
     self::$webDriver->findElement(WebDriverBy::linkText('Termine'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::id('ilChkboxListAnchorText_tbl_roomobj'))->click();
         $this->fail("#14 Deletion of a booking attribute does not effect bookings");
     } catch (Exception $unused) {
     }
     self::$helper->deleteAllRooms();
 }
示例#18
0
 /**
  * Wait for element whose class name contains the search value; compound class names are not permitted.
  *
  * @param string $className
  * @param bool $mustBeVisible Pass true to check if element is also visible. False only checks presence in DOM.
  * @return \RemoteWebElement
  */
 public function waitForClass($className, $mustBeVisible = false)
 {
     return $this->waitForElement(\WebDriverBy::className($className), $mustBeVisible);
 }
 protected function submitForm()
 {
     $submitBtn = $this->webDriver->findElement(WebDriverBy::className("submit-button"));
     $submitBtn->click();
 }
示例#20
0
 protected function getWebDriverLocator(array $by)
 {
     $type = key($by);
     $locator = $by[$type];
     switch ($type) {
         case 'id':
             return \WebDriverBy::id($locator);
         case 'name':
             return \WebDriverBy::name($locator);
         case 'css':
             return \WebDriverBy::cssSelector($locator);
         case 'xpath':
             return \WebDriverBy::xpath($locator);
         case 'link':
             return \WebDriverBy::linkText($locator);
         case 'class':
             return \WebDriverBy::className($locator);
         default:
             throw new TestRuntime("Locator type '{$by}' is not defined. Use either: xpath, css, id, link, class, name");
     }
 }
 /**
  * Tests Changing and Deletion of a floorplan
  * @test
  */
 public function testEditAndDeleteFloorPlans()
 {
     self::$webDriver->findElement(WebDriverBy::linkText('Gebäudeplan'))->click();
     self::$helper->createFloorPlan('TEST_A', self::$test_file_absolut_path . 'sucess.jpg', 'Test');
     self::$helper->createFloorPlan('TEST_B', self::$test_file_absolut_path . 'sucess.jpg', 'Test');
     //#1 Check links from update back to overview
     $menu = self::$webDriver->findElement(WebDriverBy::xpath("//div[@id='il_center_col']/div[4]/table/tbody/tr[2]/td[4]"));
     $menu->findElement(WebDriverBy::linkText('Aktionen'))->click();
     $menu->findElement(WebDriverBy::linkText('Bearbeiten'))->click();
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Gebäudepläne anzeigen'));
     } catch (Exception $ex) {
         $this->fail('#1.1 Backtab from update a floorplan does not link back to overview' . $ex);
     }
     $menu = self::$webDriver->findElement(WebDriverBy::xpath("//div[@id='il_center_col']/div[4]/table/tbody/tr[2]/td[4]"));
     $menu->findElement(WebDriverBy::linkText('Aktionen'))->click();
     $menu->findElement(WebDriverBy::linkText('Bearbeiten'))->click();
     self::$webDriver->findElement(WebDriverBy::name('cmd[render]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Gebäudepläne anzeigen'));
     } catch (Exception $ex) {
         $this->fail('#1.2 Cancel from update a floorplan does not link back to overview' . $ex);
     }
     //#1b Check Links back from deletion
     $menu = self::$webDriver->findElement(WebDriverBy::xpath("//div[@id='il_center_col']/div[4]/table/tbody/tr[2]/td[4]"));
     $menu->findElement(WebDriverBy::linkText('Aktionen'))->click();
     $menu->findElement(WebDriverBy::linkText('Löschen'))->click();
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Gebäudepläne anzeigen'));
     } catch (Exception $ex) {
         $this->fail('#1.1b Backtab from deletion a floorplan does not link back to overview' . $ex);
     }
     $menu = self::$webDriver->findElement(WebDriverBy::xpath("//div[@id='il_center_col']/div[4]/table/tbody/tr[2]/td[4]"));
     $menu->findElement(WebDriverBy::linkText('Aktionen'))->click();
     $menu->findElement(WebDriverBy::linkText('Löschen'))->click();
     self::$webDriver->findElement(WebDriverBy::name('cmd[render]'))->click();
     try {
         self::$webDriver->findElement(WebDriverBy::linkText('Gebäudepläne anzeigen'));
     } catch (Exception $ex) {
         $this->fail('#1.2b Cancel from update a floorplan does not link back to overview' . $ex);
     }
     //#2 Changing Title to a new one
     self::$helper->changeFirstFloorPlan('TEST_AA', "");
     $menu = self::$webDriver->findElement(WebDriverBy::xpath("//div[@id='il_center_col']/div[4]/table/tbody/tr[2]/td[4]"));
     $menu->findElement(WebDriverBy::linkText('Aktionen'))->click();
     $menu->findElement(WebDriverBy::linkText('Bearbeiten'))->click();
     $newName = self::$webDriver->findElement(WebDriverBy::id("title"))->getAttribute('value');
     $this->assertEquals($newName, 'TEST_AA', '#2 Update title of floorplan does not work. ');
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#3 Changing Title to an existing one (fails atm)
     self::$helper->changeFirstFloorPlan('TEST_A', "");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
         self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     } catch (Exception $ex) {
         $this->fail('#3 Update title to existing floorplan works. ' . $ex);
     }
     //#4 Changing Title to empty
     self::$helper->changeFirstFloorPlan('', "");
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail('#4 Update floorplan title to nothing works. ' . $ex);
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#5 Test empty Plan
     self::$helper->changeFirstFloorPlan('Test_B', '', ' ');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#5 Update to no-plan floorplan seems to work");
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#6 Test empty.jpg
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'empty.jpg');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#6 Add an empty picture as floorplan seems to work");
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#7 Test big.jpg
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'big.jpg');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#7 Add an too big picture as floorplan seems to work");
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#8 Test fail.txt
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'fail.txt');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#8 Update a txt as floorplan seems to work");
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#9 Test fail.pdf
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'fail.pdf');
     try {
         self::$webDriver->findElement(WebDriverBy::className("ilFailureMessage"));
     } catch (Exception $ex) {
         $this->fail("#9 Update a pdf as floorplan seems to work");
     }
     self::$webDriver->findElement(WebDriverBy::linkText('Zurück zu den Gebäudeplänen'))->click();
     //#10 Test sucess.jpg
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'sucess.jpg');
     try {
         self::$webDriver->findElement(WebDriverBy::linkText(" Test_B"));
     } catch (Exception $ex) {
         $this->fail("#10 Update a jpg as floorplan seems not to work");
     }
     //#11 Test sucess.bmp
     self::$helper->changeFirstFloorPlan('Test_B', '', self::$test_file_absolut_path . 'sucess.bmp');
     try {
         self::$webDriver->findElement(WebDriverBy::linkText(" Test_B"));
     } catch (Exception $ex) {
         $this->fail("#11 Update a bmp as floorplan seems not to work");
     }
     self::$helper->deleteAllFloorPlans();
 }
示例#22
0
 /**
  * @param array $by
  * @return \WebDriverBy
  */
 protected function getStrictLocator(array $by)
 {
     $type = key($by);
     $locator = $by[$type];
     switch ($type) {
         case 'id':
             return \WebDriverBy::id($locator);
         case 'name':
             return \WebDriverBy::name($locator);
         case 'css':
             return \WebDriverBy::cssSelector($locator);
         case 'xpath':
             return \WebDriverBy::xpath($locator);
         case 'link':
             return \WebDriverBy::linkText($locator);
         case 'class':
             return \WebDriverBy::className($locator);
         default:
             throw new MalformedLocatorException("{$by} => {$locator}", "Strict locator can be either xpath, css, id, link, class, name: ");
     }
 }
 public function testWebDriverByLocators()
 {
     $this->module->amOnPage('/login');
     $this->module->seeElement(WebDriverBy::id('submit-label'));
     $this->module->seeElement(WebDriverBy::name('password'));
     $this->module->seeElement(WebDriverBy::className('optional'));
     $this->module->seeElement(WebDriverBy::cssSelector('form.global_form_box'));
     $this->module->seeElement(WebDriverBy::xpath(\Codeception\Util\Locator::tabIndex(4)));
     $this->module->fillField(WebDriverBy::name('password'), '123456');
     $this->module->amOnPage('/form/select');
     $this->module->selectOption(WebDriverBy::name('age'), 'child');
     $this->module->amOnPage('/form/checkbox');
     $this->module->checkOption(WebDriverBy::name('terms'));
     $this->module->amOnPage('/');
     $this->module->seeElement(WebDriverBy::linkText('Test'));
     $this->module->click(WebDriverBy::linkText('Test'));
     $this->module->seeCurrentUrlEquals('/form/hidden');
 }
 /**
  * Tests one room attribute field in room filter
  * @test
  */
 public function testRoomAttribute()
 {
     self::$helper->createRoomAttribute('TEST_A');
     self::$helper->createRoom('123', 1, 20, "", " - Keine Zuordnung - ", array('TEST_A' => 2));
     self::$helper->createRoom('123a', 1, 40, "", " - Keine Zuordnung - ", array('TEST_A' => 4));
     //#1 -1
     self::$helper->applyRoomFilter('', '', array('TEST_A' => -1));
     $this->assertEquals(2, self::$helper->getNoOfResults(), '#1 -1 for room attributes in room filter does not work');
     try {
         self::$webDriver->findElement(WebDriverBy::className('ilInfoMessage'));
     } catch (Exception $ex) {
         $this->fail('#1 -1 for room attributes in room filter does not work');
     }
     //#2 0
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 0));
     $this->assertEquals(2, self::$helper->getNoOfResults(), '#2 0 for room attributes in room filter does not work');
     //#3 1
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 1));
     $this->assertEquals(2, self::$helper->getNoOfResults(), '#3 1 for room attributes in room filter does not work');
     //#4 2
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 2));
     $this->assertEquals(2, self::$helper->getNoOfResults(), '#4 2 for room attributes in room filter does not work');
     //#5 3
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 3));
     $this->assertEquals(1, self::$helper->getNoOfResults(), '#5 3 for room attributes in room filter does not work');
     $this->assertEquals('123a', self::$helper->getFirstResult(), '#5 3 for room attributes in room filter does not work');
     //#6 4
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 4));
     $this->assertEquals(1, self::$helper->getNoOfResults(), '#6 4 for room attributes in room filter does not work');
     $this->assertEquals('123a', self::$helper->getFirstResult(), '#6 4 for for room attributes in room filter does not work');
     //#7 5
     self::$helper->applyRoomFilter('', '', array('TEST_A' => 5));
     $this->assertEquals(1, self::$helper->getNoOfResults(), '#7 5 for for room attributes in room filter does not work');
     $this->assertEquals('123a', self::$helper->getFirstResult(), '#7 5 for for room attributes in room filter does not work');
     try {
         self::$webDriver->findElement(WebDriverBy::className('ilInfoMessage'));
     } catch (Exception $ex) {
         $this->fail('#7 5 for room attributes in room filter does not work');
     }
     self::$helper->deleteAllRooms();
     self::$helper->deleteRoomAttribute('TEST_A');
 }