public function testCreateMenuItem() { $d = $this->driver; $cpPage = $this->doAdminLogin(); // $genericPage = new GenericAdminPage($d, $this); $genericPage = $cpPage->clickMenu('Menu Manager'); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('Main Menu')); echo "found Main Menu"; $el->click(); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('New')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[contains(@onclick, 'iframe')]")); echo "found select button"; $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); // switch to modal iframe $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Single Article')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[@value='Single Article']")); $salt = mt_rand(); $d->findElement(By::id('jform_title'))->sendKeys('Test Menu Title ' . $salt); $el = $d->findElement(By::partialLinkText('Select / Change'))->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Australian Parks')); $text = $d->findElement(By::xPath("//body"))->getText(); $this->assertTrue(strpos($text, '( ! ) Notice:') === false, '**PHP notice found on page.'); $el->click(); $el = $d->waitForElementUntilIsNotPresent(By::xPath("//div[@id='sbox-content']/iframe")); $d->findElement(By::xPath("//a[contains(@onclick, 'item.save')]"))->click(); // Clean up }
/** * @test */ public function createMenuItem() { $cpPage = $this->doAdminLogin(); $page = $cpPage->clickMenu('Main Menu'); $page->clickButton('New'); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('New')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[contains(@onclick, 'iframe')]")); echo "found select button"; $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); // switch to modal iframe $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Single Article')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[@value='Single Article']")); $salt = mt_rand(); $d->findElement(By::id('jform_title'))->sendKeys('Test Menu Title ' . $salt); $el = $d->findElement(By::partialLinkText('Select / Change'))->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Australian Parks')); $el->click(); $el = $d->waitForElementUntilIsNotPresent(By::xPath("//div[@id='sbox-content']/iframe")); $d->findElement(By::xPath("//a[contains(@onclick, 'item.save')]"))->click(); // Clean up }
public function testTinyTyping() { $d = $this->_driver; //get url $d->get($this->_testUrl . '/administrator'); //access text input $webElement = $d->findElement(By::id("mod-login-username")); $webElement->clear(); $webElement->sendKeys("admin"); $webElement = $d->findElement(By::id("mod-login-password")); $webElement->clear(); $webElement->sendKeys("password"); //access button $d->findElement(By::partialLinkText("Log in"))->click(); $d->waitForElementUntilIsPresent(By::partialLinkText('Add New Article'))->click(); $salt = mt_rand(); $d->waitForElementUntilIsPresent(By::id('jform_title'))->sendKeys('Article Title ' . $salt); $d->switchTo()->getFrameByName('jform_articletext_ifr'); $d->findElement(By::id('tinymce'))->sendKeys('This is some article text.'); $d->switchTo()->getDefaultFrame(); $d->findElement(By::xPath("//a[contains(@onclick, 'article.save')]"))->click(); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('Article Title ' . $salt)); $this->assertInstanceOf('SeleniumClient\\WebElement', $el); $el->click(); $d->waitForElementUntilIsPresent(By::id('jform_title')); $select = new SelectElement($d->findElement(By::id("jform_state"))); $select->selectByValue("2"); $select = new SelectElement($d->findElement(By::id("jform_featured"))); $select->selectByValue("1"); sleep(5); // Clean up }
public function testCreateMenuItem() { //get url $this->_driver->get($this->_testUrl . '/administrator'); //access text input $webElement = $this->_driver->findElement(By::id("mod-login-username")); $webElement->clear(); $webElement->sendKeys("admin"); $webElement = $this->_driver->findElement(By::id("mod-login-password")); $webElement->clear(); $webElement->sendKeys("password"); //access button $this->_driver->findElement(By::partialLinkText("Log in"))->click(); $d = $this->_driver; $el = $d->waitForElementUntilIsPresent(By::partialLinkText('Menu Manager')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('Main Menu')); echo "found Main Menu"; $el->click(); $el = $d->waitForElementUntilIsPresent(By::partialLinkText('New')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[contains(@onclick, 'iframe')]")); echo "found select button"; $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); // switch to modal iframe $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Single Article')); $el->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//input[@value='Single Article']")); $salt = mt_rand(); $d->findElement(By::id('jform_title'))->sendKeys('Test Menu Title ' . $salt); $el = $d->findElement(By::partialLinkText('Select / Change'))->click(); $el = $d->waitForElementUntilIsPresent(By::xPath("//div[@id='sbox-content']/iframe")); $el = $d->switchTo()->getFrameByWebElement($el)->findElement(By::partialLinkText('Australian Parks')); $el->click(); $el = $d->waitForElementUntilIsNotPresent(By::xPath("//div[@id='sbox-content']/iframe")); $d->findElement(By::xPath("//a[contains(@onclick, 'item.save')]"))->click(); // Clean up }