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
class Extension | |
# In this example, we have two iframes. The one built into our extension directly, | |
# and the one that renders our actual content. | |
# We would need to jump through two frames to get to our extension code, and we | |
# can also jump out to interact with the main webpage. | |
enterInnerFrame: -> | |
# Enter our extension-provided iframe. | |
@driver.wait(webdriver.until.elementLocated(css: @selectors.extensionFrame), 5000) |
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
extension = new Extension(@driver) | |
... | |
... | |
it 'can do some extension stuff ...', -> | |
extension.enterInnerFrame() | |
# Now we are inside of the extension! Do your assertions here. | |
... | |
# If you need to get back to your main page, just jump out. | |
extension.enterRootFrame() | |
... |
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 the Chrome extension and convert to base64 format. | |
# This is specific to how the node-selenium webdriver sets up its capabilities. | |
# Refer to http://stackoverflow.com/a/27278322/2204868 for more info. | |
data = fs.readFileSync '/tmp/location/of/extension.crx' | |
encodedExtension = data.toString 'base64' | |
capabilities = | |
browserName: 'chrome' | |
chromeOptions: | |
extensions: [encodedExtension] # This needs to be a base64 String array of our extensions. |
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
child_process = require 'child_process' | |
# Get the Chrome Extension download path. | |
# A great explanation of how this works can be found here: | |
# http://chrome-extension-downloader.com/how-does-it-work.php | |
chromeExtensionId = 'lpcaedmchfhocbbapmcbpinfpgnhiddi' | |
downloadUrl = "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=49.0&x=id%3D#{chromeExtensionId}%26installsource%3Dondemand%26uc" | |
# Download your extension through curl. | |
# You can choose where you want your extension to be. This path will be used later when building your driver. |
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
child_process = require 'child_process' | |
# Get the Chrome Extension download path. | |
# A great explanation of how this works can be found here: | |
# http://chrome-extension-downloader.com/how-does-it-work.php | |
chromeExtensionId = 'lpcaedmchfhocbbapmcbpinfpgnhiddi' | |
downloadUrl = "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=49.0&x=id%3D#{chromeExtensionId}%26installsource%3Dondemand%26uc" | |
# Download your extension through curl. | |
# You can choose where you want your extension to be. This path will be used later when building your driver. |
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
// This is the key as well as the cardID. | |
"id_31f6e7046976d442": { | |
cardID: "id_31f6e7046976d442", | |
// These are antiquated terms that are relics of the tree design. | |
// Since we are now using a directed graph, these should be called | |
// lastCardIDs and nextCardIDs in the future. | |
parentCardIDs: [], | |
childrenCardIDs: [], |
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
{ | |
cardID: 'asdf1234', | |
parentCardID: 'qwer3534', | |
childrenCardIDs: ['asdvasv', 'asvvasdv'], | |
speaker: 'ai', | |
message: 'Red or blue?' | |
} |