GithubHelp home page GithubHelp logo

echo's Introduction

Echo

This is an example project to demonstrate testing a Rack application (in this case using Sinatra) using Capybara and Selenium with various options, I wrote an accompanying blog article here: https://without-brains.net/2020/10/25/capybara-with-selenium-and-vagrant-without-rails/

This project runs on ruby 2.7.x (but will likely function with 2.6.x too).

If you have any issues, suggestions, improvements, etc. then please log them using GitHub issues.

Usage

This project comes with a very basic Vagrant box.

To run the Rack application run "bundle exec rackup", if you then visit the root you will see a webpage with a text input and button. Entering a text and clicking the button will refresh the page echoing back the message that you entered.

To run the tests run "bundle exec rake test", by default this will run against a headless Firefox (this will require you to have the geckodriver installed).

The following environemnt variables influence how the tests are run:

  • CAPYBARA_DRIVER[=selenium_headless] is the Capybara driver to use, besides the defaults you can also use selenium_remote here to run against a Selenium instance running elsewhere
  • CAPYBARA_SAVE_PATH[=tmp/] is where Capybara saves its pages, screenshots, etc.
  • CAPYBARA_SERVER_HOST is the IP address to which Capybara binds the Rack server that it starts to run the tests against
  • CAPYBARA_SERVER_PORT is the portnumber to which Capybara binds the Rack server that it starts to run the tests against
  • SELENIUM_REMOTE_BROWSER[=firefox] is the browser to use when selecting the selenium_remote driver
  • SELENIUM_REMOTE_HOST[=127.0.0.1] is the hostname or IP address where the Selenium instance is running for the selenium_remote driver
  • SELENIUM_REMOTE_PORT[=4444] is the port on the SELENIUM_REMOTE_HOST where the Selenium instance is running for the selenium_remote driver
  • SELENIUM_SCREEN_SIZE[=desktop] is the screen size that the Selenium browser must use, select a named shortcut or enter a direct resolution in the format WIDTHxHEIGHT. Named options are galaxy_s9, iphone_6, iphone_6_plus, iphone_7, iphone_7_plus, iphone_8, iphone_8_plus, iphone_x, ipad and desktop
  • SELENIUM_SCREEN_TURNED can be set to 1 to emulate turning the screen for named resolution

License

Echo is released under the MIT license.

Author

Mark Cornelissen

echo's People

Contributors

mrkcor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rcorreia

echo's Issues

Vagrantfile requires manual step

Running "vagrant up" reaches a point that requires a password, and I don't know the password. Why isn't sudo being used properly? Please advise.

default] Exporting NFS shared folders...
Preparing to edit /etc/exports. Administrator privileges will be required...
Password:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.