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
Get Child WebElements | |
[Arguments] ${locator} ${child_xpath} | |
${element} Get WebElement ${locator} | |
${children} Call Method | |
... ${element} | |
... find_elements | |
... by=xpath value=.${child_xpath} | |
[Return] ${children} |
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
Open Browser Profiled | |
[Arguments] ${url} | |
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver | |
Call Method ${options} add_argument --user-data-dir\=${USER_DATA_PATH} | |
Create WebDriver Chrome chrome_options=${options} | |
Go To ${url} |
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
Click Element When Ready Inner | |
[Arguments] ${locator} | |
Wait Until Element Ready ${locator} | |
${element}= Get WebElement ${locator} | |
Click Element ${element} | |
[Return] ${element} | |
Click Element When Ready | |
[Arguments] ${locator} | |
Wait Until Keyword Succeeds 3 1s Click Element When Ready Inner ${locator} |
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
Wait Until Element Ready Inner | |
[Arguments] ${locator} ${timeout}=None | |
Wait Until Page Contains Element ${locator} ${timeout} | |
Wait Until Element Is Visible ${locator} | |
Wait Until Element Is Enabled ${locator} | |
Scroll Element Into View ${locator} | |
Wait Until Element Is Visible ${locator} | |
Wait Until Element Is Enabled ${locator} |
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
import leadService from './lead-service'; | |
// Define a handler for `PUT /lead/:leadId` that accepts the request body payload | |
// `{ name, email }` | |
const handler = async (event) => { | |
// Parse the request parameters | |
const { name, email } = JSON.parse(event.body); | |
const { leadId } = event.pathParameters; | |
// Assume this is the service-layer code that actually performs the updating of |
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
// Convert from a Lambda to an ExpressJS handler | |
const lambdaToExpress = async (handler) => { | |
return async (req, res) => { | |
// Repackage the express parameters as an event object for the Lambda | |
const event = { | |
body: JSON.stringify(req.body), | |
headers: req.headers, | |
queryStringParameters: req.query, | |
pathParameters: req.params | |
}; |
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
import express from 'express'; | |
import cors from 'cors'; | |
import handler from './lambda'; | |
import lambdaToExpress from './lambda-to-express'; | |
const PORT = 3000; | |
const app = express(); | |
app.use(cors()); | |
app.use(express.json()); // Parse JSON bodies |
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
import express from 'express'; | |
import cors from 'cors'; | |
import handler from './lambda'; | |
import lambdaToExpress from './lambda-to-express'; | |
const PORT = 3000; | |
const app = express(); | |
app.use(cors()); | |
app.use(express.json()); // Parse JSON bodies |
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
import each from 'lodash/each'; | |
const getFirstKeyUsingEach = (obj) => { | |
let firstKey = undefined; | |
each(obj, (value, key) => { | |
firstKey = key; | |
return false; // Exit loop | |
}); | |
return firstKey; | |
}; |
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
import each from 'lodash/each'; | |
const eachDeepInner = (collection, iteratee, key) => { | |
if (key !== undefined) { | |
iteratee(collection, key) | |
} | |
if (collection && typeof collection === 'object') { | |
each(collection, (value, key) => { | |
eachDeepInner(value, iteratee, key); |