Skip to content

Instantly share code, notes, and snippets.

View ckenst's full-sized avatar

Chris Kenst ckenst

View GitHub Profile
@ckenst
ckenst / debug_binding_pry.rb
Last active November 29, 2017 22:18
Debugging a Selenium Test using binding.pry
require 'pry' # Add to gemfile if not already there
# Not a functioning test
# Also not the greatest example
def run
setup
yield
teardown
end
@ckenst
ckenst / print_browser_console.rb
Created November 29, 2017 22:20
Print browser console inlcuding JavaScript errors
def run
setup
yield
teardown
end
run do
@driver.get 'http://www.kenst.com/about'
expect(@driver.title).to eql "About โ€“ Chris Kenst's Blog"
@ckenst
ckenst / docker_selenium.rb
Created September 4, 2018 22:42
Selenium Test written in Ruby using the Chrome Docker Container
require 'selenium-webdriver'
require 'rspec/expectations'
include RSpec::Matchers
def setup
caps = Selenium::WebDriver::Remote::Capabilities.send("chrome")
# This url is the local access url of the docker container
@driver = Selenium::WebDriver.for(:remote, url: "http://0.0.0.0:4444/wd/hub", desired_capabilities: caps)
end
@ckenst
ckenst / cypressLogin.js
Created October 30, 2020 02:53
Login Examples
describe('My Login application', () => {
it('Should login with valid credentials', () =>{
cy.visit(`https://the-internet.herokuapp.com/login`);
cy.get('#username')
.type('tomsmith')
cy.get('#password')
.type('SuperSecretPassword!')