Skip to content

Instantly share code, notes, and snippets.

@generalredneck
generalredneck / headless-testing.pp
Created July 20, 2012 15:42
headless-testing.pp
class apci_devel::headless_testing {
include java
package { "xvfb":
ensure => present,
}
package { "firefox":
ensure => present,
}
@generalredneck
generalredneck / test.php
Created August 2, 2012 15:33
isElementPresentInIframe
public function isElementPresentInIframe($element_locator, $iframe_locator, $timeout = null) {
$this->selectFrame($iframe_locator);
if (empty($timeout) {
$this->waitForFrameToLoad();
}
else {
$this->waitForFrameToLoad($timeout);
}
return $this->isElementPresent($element_locator);
}
function waitForMail($subject) {
$lastExceptionMessage = '';
for ($second = 0; ; $second+=2) {
if ($second > 45) {
$this->fail(
"WaitFor timeout. \n"
. "Last exception message: \n" . $lastExceptionMessage
);
}
$this->clickAndWait('link=Search');
@generalredneck
generalredneck / composure.json
Created August 20, 2012 21:41
composure.json
{
"require": {
"behat/behat": "2.4@stable",
"behat/mink-extension":"*",
"behat/mink-goutte-driver":"*", "behat/mink-selenium2-driver":"*",
"pear-phpunit/PHPUnit":"3.6.11", "pear-phpunit/PHPUnit_Selenium":"1.2.7"
}, "repositories":[
{ "type":"vcs", "url":"git@github.com:AllPlayers/AllPlayers-PHP.git"
}, { "type":"pear",
"url":"pear.php.net" }, {
[17:07:46]achappell@a:~/main (behat)
$ bin/behat --tags @javascript
Feature: Register an user from the home page.
As an Anonymous user,
I need to be able to register myself as a user of AllPlayers.com
so that I can use it's functionality.
@javascript
Scenario: Successfully register a user without verification # features/user/register.feature:7
Feature: google
I want to search something on google
Scenario: Search something on google
Given I am on "/"
And I fill in "q" with "selenium"
When I press "Google Search"
And I click the first link
Then I should see "selenium"
@generalredneck
generalredneck / keepsgoing.log
Created September 11, 2012 14:59
Selenium log snipped
07:03:45.493 INFO - Command request: waitForPageToLoad[90000, ] on session be710e83a2684c4a934f8663dbe376a9
07:03:45.525 INFO - Got result: OK on session be710e83a2684c4a934f8663dbe376a9
07:03:45.529 INFO - Command request: getExpression[(typeof selenium.browserbot.getCurrentWindow().jQuery == 'undefined' || !selenium.browserbot.getCurrentWindow().jQuery.active), ] on session be710e83a2684c4a934f8663dbe376a9
07:03:45.543 INFO - Got result: OK,(typeof selenium.browserbot.getCurrentWindow().jQuery == 'undefined' || !selenium.browserbot.getCurrentWindow().jQuery.active) on session be710e83a2684c4a934f8663dbe376a9
07:03:45.546 INFO - Command request: waitForCondition[(typeof selenium.browserbot.getCurrentWindow().jQuery == 'undefined' || !selenium.browserbot.getCurrentWindow().jQuery.active), 90000] on session be710e83a2684c4a934f8663dbe376a9
07:03:45.572 INFO - Got result: OK on session be710e83a2684c4a934f8663dbe376a9
07:03:45.576 INFO - Command request: getExpression[xpath=//label[contains(text(), 'Enable regi
@generalredneck
generalredneck / products.html
Created September 18, 2012 18:39
simple test
<html>
<head>
<style>
div.product {
height:100px;
width:100px;
border: 1px solid black;
background-color:yellow;
float:left;
}
@generalredneck
generalredneck / xpath.php
Created September 27, 2012 18:12
XPath - A Fun Walk With A Powerful Query Language
<?php
require_once 'Console/Table.php';
$groupsDoc = new DOMDocument();
$groupsDoc->load("groups.xml");
$groupsDoc->formatOutput = TRUE;
file_put_contents("readable-groups.xml",$groupsDoc->saveXML());
$xpath = new DOMXpath($groupsDoc);
/*******************************************************************************
drush sql-sync --no-ordered-dump -y @demo2store @seleniumstore
You will destroy data from seleniumstore and replace with data from store.
You might want to make a backup first, using the sql-dump command.
Do you really want to continue? (y/n): y
drush @seleniumstore upwd `drush @selenium vget apci_store_user | grep -P -o "(?<=\").*(?=\")"` --password=`drush @selenium vget apci_store_pass | grep -P -o "(?<=\").*(?=\")"`
require_once(/mnt/apci/selenium-store/www/profiles/apci_store/modules/contrib/memcache/memcache.inc): failed to open stream: No such file or directory [warning]
bootstrap.inc:2297