This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, cors = require('cors') | |
, app = express(); | |
var fs = require('fs'); | |
app.use(cors()); | |
app.post('/post', function(req, res, next){ | |
var body = []; | |
req.on('data', function(chunk) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send GLOBALS.saveData to external server | |
$.ajax({ | |
url: "https://example.com:8000/post", | |
error: function(x, err){ | |
callback("Save timed out with "+err); | |
}, | |
success: function(){ | |
callback(true); | |
}, | |
type: "POST", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomDate(start, end) { | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
} | |
// getting a random date picked between 1/1/2012 and today | |
var date = randomDate(new Date(2012, 0, 1), new Date()); | |
// assign the date in format MM/DD/YYYY to a GLOBALS variable "date" for later use | |
GLOBALS.date = (date.getMonth() + 1)+'/'+date.getDate()+'/'+date.getFullYear(); | |
callback(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//separate username part from email address and set it up as a variable "randomEmail" for later use | |
GLOBALS.randomEmail = GLOBALS['random.myuniquestring@mail.usetrace.com'] | |
callback(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clicking link with the text "Click link" | |
var links = [].filter.call(document.querySelectorAll("a"), el => el.textContent.indexOf("Click Link") === 0); | |
if (links.length == 0) { | |
return callback(new Error("No link found")); | |
} | |
links[0].click() | |
callback(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!GLOBALS.poll_time) { | |
var poll_timeout_seconds = 3; | |
} else { | |
var poll_timeout_seconds = GLOBALS.poll_time; | |
} | |
var element = "iframe.iframe-book"; | |
var element_text = "Text on the page we want to find"; | |
var poll_frequency_ms = 500; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load jquery into jQuery-variable. | |
// You need to load this in the js step you want to use it. | |
(function(jqueryUrl, callback) { | |
if (typeof jqueryUrl != 'string') { | |
jqueryUrl = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; | |
} | |
if (typeof jQuery == 'undefined') { | |
var script = document.createElement('script'); | |
var head = document.getElementsByTagName('head')[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add js step before this step which defines | |
// - GLOBALS.download_file_link CSS locator to an element with src for the file | |
// - GLOBALS.expected_download_status optionally expected some other response status than 200 | |
if (!GLOBALS.download_file_link) { | |
callback("JS-step GLOBALS.download_file_link not set"); | |
} | |
if (!GLOBALS.expected_download_status) { | |
var expected_status = 200; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add js step before this step which defines | |
// - GLOBALS.not_showing CSS locator | |
// - GLOBALS.poll_time to optionally wait a different time than 3 seconds | |
if (!GLOBALS.not_showing) { | |
callback("JS-step GLOBALS.not_showing not set"); | |
} | |
var locator = GLOBALS.not_showing; | |
if (!GLOBALS.poll_time) { | |
var poll_timeout_seconds = 3; |
NewerOlder