Skip to content

Instantly share code, notes, and snippets.

@raphaelrodrigues
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphaelrodrigues/1ae4a84866550a670f84 to your computer and use it in GitHub Desktop.
Save raphaelrodrigues/1ae4a84866550a670f84 to your computer and use it in GitHub Desktop.
Snippets Minium
browser.get("http://www.amazon.com/");
var searchBox = $("#twotabsearchtextbox");
var goBtn = $(":submit").withValue("Go");
var results = $(".s-access-title");
var addToCartBtn = $("#add-to-cart-button");
var confirmText = $("#confirm-text");
var cartCount = $("#nav-cart-count");
searchBox.fill("Hubsan X4");
goBtn.click();
results.click();
addToCartBtn.click();
expect(confirmText).to.have.text("1 item added to Cart");
expect(cartCount).to.have.text("1");
browser.configure()
.interactionListeners()
.clear()
.add(minium.interactionListeners.onStaleElementReference().thenRetry())
.done();
browser.get("http://www.easyjet.com/en/");
var frame = $("#tabco-iframe-1").frames();
var origin = frame.find("#acOriginAirport");
var destination = frame.find("#acDestinationAirport");
var autocompletionOpts = frame.find(".acl_results li").visible();
var monthCalendars = frame.find(".ui-datepicker-calendar").visible();
var outboundDatePicker = frame.find("#oDateCalendar").unless(monthCalendars);
var mondayCol = monthCalendars.last().find("th").withText("Mo");
var fridayCol = monthCalendars.first().find("th").withText("Fr");
var calendarDays = monthCalendars.find("td a");
var outboundDay = frame.find(".datesBoxTitle").withText("1. Select outbound date").then(calendarDays.below(mondayCol).eq(2));
var returnDay = frame.find(".datesBoxTitle").withText("2. Select return date").then(calendarDays.rightOf(".ui-state-active").below(fridayCol));
var showFlightsBtn = frame.find("#searchPodSubmitButton").unless(monthCalendars);
var flights = $("li.standard:visible");
// fill origin
origin.fill("Lisbon");
autocompletionOpts.withText("Lisbon LIS, Portugal").click();
// and destination
destination.fill("London");
autocompletionOpts.withText("London Gatwick LGW, United Kingdom").click();
// pick outbound date
outboundDatePicker.click();
outboundDay.click();
// and return date
returnDay.click();
// request flights
showFlightsBtn.click();
// ensure there are results
expect(flights).to.exist();
var keys = require("minium/keys");
browser.configure()
.interactionListeners()
.clear()
.add(minium.interactionListeners.onStaleElementReference().thenRetry())
.done();
browser.get("https://www.ethercalc.org/");
var createBtn = $("#newpadbutton");
createBtn.click();
var cells = $("#te_fullgrid td");
// chrome:
// cells.css("background-image") === "url(https://www.ethercalc.org/static/download.png)"),
// firefox:
// cells.css("background-image") === "url(\"https://www.ethercalc.org/static/download.png\")")
var exportCell = cells.applyWebElements(function() {
return $(this).filter(function () { return $(this).css("background-image").indexOf("download.png") !== -1 });
});
var colC = cells.rightOf(exportCell).withText("C");
var row5 = cells.below(exportCell).withText('5');
var cellC5 = cells.below(colC).rightOf(row5);
cellC5.doubleClick();
var cellInput = $("input").above(exportCell).first();
cellInput.fill("Minium can!").sendKeys(keys.ENTER);
expect(cellC5).to.have.text("Minium can!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment