Skip to content

Instantly share code, notes, and snippets.

View elgalu's full-sized avatar

Leo Gallucci elgalu

View GitHub Profile
@elgalu
elgalu / capabilities.js
Last active May 18, 2021 14:41
Protractor Browser Capabilities Extensions
////////////////////////////////////////////////
// Protractor Browser Capabilities Extensions //
////////////////////////////////////////////////
"use strict";
module.exports = browser.getCapabilities().then(function(s) {
var browserName, browserVersion;
var shortName, shortVersion;
var ie, ff, ch, sa;
var platform;
@elgalu
elgalu / toHaveClass.js
Last active August 2, 2019 21:38
toHaveClass custom Jasmine 1.3.1 html class matcher
"use strict";
var maxWaitTimeoutMs = 5000; // 5secs
var webdriver = require('selenium-webdriver');
var flow = webdriver.promise.controlFlow();
/**
* Custom Jasmine matcher builder that waits for an element to have
* or not have an html class.
* @param {String} expectation The html class name
@elgalu
elgalu / .jhbuildrc
Created July 25, 2014 20:41
Install gnome-terminal from source
# -*- mode: python -*-
#
# policy for modules to build, options are:
# - all: build everything requested
# - updated: build only modules that have changed
# - updated-deps: build modules that have changed, or their dependencies
# have changed.
build_policy = 'updated'
# moduleset settings:
@elgalu
elgalu / customMatchers.js
Last active August 6, 2017 04:08
Some Protractor - Jasmine 1.3.x custom matchers
//////////////////////////
// Some Custom Matchers //
//////////////////////////
"use strict";
// Usage:
// Add `require('./customMatchers.js');` in your onPrepare block or file
// Config
var specTimeoutMs = 10000; // 10 secs
@elgalu
elgalu / onPrepare.conf.js
Created June 3, 2014 20:45
Easily ask for current browser capability
browser.getCapabilities().then(function(s) {
var browserName, browserVersion;
var shortName, shortVersion;
var ie, ff, ch, sa;
var platform;
platform = s.caps_.platform;
browserName = s.caps_.browserName;
browserVersion = s.caps_.version;
shortVersion = browserVersion.split('.')[0];
@elgalu
elgalu / _etc_init.d_headless
Last active August 29, 2015 14:02
headless_with_vnc4server
#!/bin/bash
unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/headless/vncservers.conf ] && . /etc/headless/vncservers.conf
prog=$"VNC server"
start() {
. /lib/lsb/init-functions
REQ_USER=$2
node node lib/cli.js spec/basicConf.js
Using the selenium server at http://satellite.dev:4555/wd/hub
[launcher] Running 1 instances of WebDriver....warning: more than one element found for locator by.binding("item.reusedBinding")- you may need to be more specific
...............................F................................................F.........
Failures:
1) protractor library should allow a mix of using protractor and using the driver directly
Message:
Expected 'http://portege.dev:8000/index.html' to match '#/form'.
/**
* @name waitForUrlToChangeTo
* @description Wait until the URL changes to match a provided regex
* @param {RegExp} urlRegex wait until the URL changes to match this regex
* @returns {!webdriver.promise.Promise} Promise
*/
function waitForUrlToChangeTo(urlRegex) {
var currentUrl;
return browser.getCurrentUrl().then(function storeCurrentUrl(url) {
@elgalu
elgalu / osx_linux.sh
Last active August 29, 2015 13:59
Create OSX user and group with specific IDs to fix VMWare shared folders agains a Linux host
# Within Mac VM
sudo -s
# Create user with id 1000 and group with id 1000
dscl . -create /Groups/mygroup
dscl . -create /Groups/mygroup name mygroup
dscl . -create /Groups/mygroup passwd "clave"
dscl . -create /Groups/mygroup gid 1000
dscl . -create /Users/myuser
dscl . -create /Users/myuser UserShell /bin/bash
dscl . -create /Users/myuser RealName "myuser"