Skip to content

Instantly share code, notes, and snippets.

View xsalefter's full-sized avatar

xsalefter xsalefter

View GitHub Profile
public void should_resize_chrome_automatically() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\xsalefter\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");
environmentVariables.setProperty("thucydides.browser.height", "200");
environmentVariables.setProperty("thucydides.browser.width", "400");
driver = factory.newInstanceOf(SupportedWebDriver.CHROME);
page = new StaticSitePage(driver, 1000);
page.open();
int width = ((Long)(((JavascriptExecutor)driver).executeScript("return window.innerWidth"))).intValue();
@xsalefter
xsalefter / gist:3269011
Created August 6, 2012 01:51
Can't execute JavaScript before a page has been loaded
org.openqa.selenium.WebDriverException: Can't execute JavaScript before a page has been loaded!
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_27'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.getPageToInjectScriptInto(HtmlUnitDriver.java:505)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.executeScript(HtmlUnitDriver.java:450)
at net.thucydides.core.webdriver.javascript.JavascriptExecutorFacade.executeScript(JavascriptExecutorFacade.java:27)
at net.thucydides.core.pages.jquery.JQueryEnabledPage.isJQueryEnabled(JQueryEnabledPage.java:41)
at net.thucydides.core.pages.PageObject.addJQuerySupport(PageObject.java:686)
at net.thucydides.core.pages.PageObject.openPageAtUrl(PageObject.java:588)
-------------------------------------------------------------------------------
Test set: net.thucydides.core.output.WhenRecordingTestOutputInASpreadsheet
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.719 sec <<< FAILURE!
should_record_a_test_result_in_a_designated_excel_spreadsheet(net.thucydides.core.output.WhenRecordingTestOutputInASpreadsheet) Time elapsed: 0.024 sec <<< ERROR!
java.io.FileNotFoundException: C:\Users\XSALEF~1\AppData\Local\Temp\junit7790989382124503264\junit8518512803167233515\testresults.xls (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at jxl.Workbook.createWorkbook(Workbook.java:301)
-------------------------------------------------------------------------------
Test set: net.thucydides.core.screenshots.WhenScreenshotsAreTaken
-------------------------------------------------------------------------------
Tests run: 12, Failures: 0, Errors: 12, Skipped: 0, Time elapsed: 0.026 sec <<< FAILURE!
the_driver_should_capture_the_image(net.thucydides.core.screenshots.WhenScreenshotsAreTaken) Time elapsed: 0.001 sec <<< ERROR!
java.lang.NoClassDefFoundError: net/thucydides/core/screenshots/ScreenshotSequence
at net.thucydides.core.screenshots.Photographer.<clinit>(Photographer.java:44)
at net.thucydides.core.screenshots.WhenScreenshotsAreTaken.initMocks(WhenScreenshotsAreTaken.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-------------------------------------------------------------------------------
Test set: net.thucydides.core.screenshots.WhenScreenshotsAreTaken
-------------------------------------------------------------------------------
Tests run: 12, Failures: 2, Errors: 6, Skipped: 0, Time elapsed: 0.079 sec <<< FAILURE!
the_photographer_should_return_the_stored_screenshot_filename(net.thucydides.core.screenshots.WhenScreenshotsAreTaken) Time elapsed: 0.004 sec <<< ERROR!
java.lang.NullPointerException
at net.thucydides.core.screenshots.WhenScreenshotsAreTaken.the_photographer_should_return_the_stored_screenshot_filename(WhenScreenshotsAreTaken.java:133)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
// Part of your business logic code (using JPA). In this case, 'entityClass' is @Entity class,
// and 'restrictions' is list of org.dynamicfinder.Restriction instance passed from
// contoller/presesentation layer.
QueryBuilder queryBuilder = new JpaQueryBuilder(entityClass).where(restrictions);
// What we really need is query string based on restriction defined in
// controller.
final String queryString = queryBuilder.getQueryString();
final String countQueryString = queryBuilder.getCountQueryString();
final String firstName = super.getString("firstName"); // same as request.getParameter() in servlet
final String lastName = super.getString("lastName"); // same as request.getParameter() in servlet
List<Restriction> restrictions = Arrays.asList(
$("firstName").like(firstName).or(),
$("lastName").like(lastName).or()
);
<!DOCTYPE html>
<html>
<head>
<title>
Xero | Error
</title>
<!-- CSS -->
<link href="/Content/Style/XERO/base/xero.base.Controls.css" rel="stylesheet" type="text/css" />
.form-all {
font-family: "Lucida Grande", sans-serif;
}
.form-all {
width: 690px;
}
.form-label-left,
.form-label-right {
width: 150px;
}
package ca.visdom.mailsync;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.junit.Test;