{"id":22115922,"url":"https://github.com/vanessaklee/stbernard","last_synced_at":"2025-06-10T19:09:06.086Z","repository":{"id":44112578,"uuid":"195306616","full_name":"vanessaklee/stbernard","owner":"vanessaklee","description":"Bare bones series of webpages to demonstrate testing Elixir code with Hound","archived":false,"fork":false,"pushed_at":"2023-01-04T03:42:44.000Z","size":34041,"stargazers_count":3,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T11:15:51.736Z","etag":null,"topics":["elixir","testing"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vanessaklee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T22:21:02.000Z","updated_at":"2021-12-17T16:17:11.000Z","dependencies_parsed_at":"2023-02-01T19:15:59.388Z","dependency_job_id":null,"html_url":"https://github.com/vanessaklee/stbernard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanessaklee%2Fstbernard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanessaklee%2Fstbernard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanessaklee%2Fstbernard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanessaklee%2Fstbernard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanessaklee","download_url":"https://codeload.github.com/vanessaklee/stbernard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245214274,"owners_count":20578782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","testing"],"created_at":"2024-12-01T12:18:18.798Z","updated_at":"2025-03-24T05:27:44.525Z","avatar_url":"https://github.com/vanessaklee.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# St Bernard\n\nSt Bernard is a simple series of webpages used to demonstrate the howling success of the Hound testing tool.\n\nWhatever you call it, UI testing/End-to-End Testing/End-to-User Testing/Acceptance Testing--it is often an intensely manual and time-consuming process. Hound carries some of the load through browser automation. Browser automations means that I can automate my user interactions — clicks, fill inputs, file uploads, selecting options, radio buttons, etc. I use this app to demonstrate an overview of Hound and it’s helpers, as well as an example of how Hound tests saved me days of manual end-user testing. \n\n## Bone Simple Creation\n\nCreate a simple Phoenix called St Bernard.\n\n\n    $ mix phx.new stbernard --no-ecto\n\n\nAdd Hound as a dependency in `mix.exs`.\n\n```elixir\n{:hound, \"~\u003e 1.0\"}\n```\n\nHound requires a webdriver for browser automation. We will use selenium. Install and run:\n\n    $ brew install selenium-server-standalone\n    $ selenium-server\n\nStart Hound in `test/test_helpers.exs`. Add this above `ExUnit.start()`\n\n```elixir\nApplication.ensure_all_started(:hound)\n```\n\nIn `config/test.exs` add:\n\n```elixir\nconfig :hound, browser: \"chrome\"\n```\n\n. . . and set `server` to true: \n\n```elixir\nconfig :stbernard, StbernardWeb.Endpoint,\n  http: [port: 4001],\n  server: true\n```\n\nStart the Phoenix server\n\n  * install dependencies with `mix deps.get`\n  * install Node.js dependencies with `cd assets \u0026\u0026 npm install`\n  * start interactive elixir: `iex -S mix phx.server`\n  * visit [`localhost:4000`](http://localhost:4000) from your browser.\n\nRun tests (in this demo app, Hound is used as a part of ExUnit tests) \n\n    $ mix test\n\n## Lab-ra-cadabra!\n\nThe acceptance tests live in `test/stbernard_web/integration/` \n\n```\n- test/\n  - stbernard_web/\n    - acceptance/\n      - form_test.exs\n      - charge_test.exs\n      - welcome_test.exs\n  - test_helper.exs\n```\n\n#### Simple `welcome_test.exs`\n  \n  * [navigate_to/2][navigate_to]\n    * navigates to a url or relative path\n  * [find_element/3][find_element] \n    * accepts a strategy, selector, and optional retries value\n  * [visible_text/1][visible_text]\n    * gets the visible text of an element\n  * [page_title/0][page_title]\n    * gets the title of the current page\n\n#### Complex `form_test.exs`\n\n  * the `:xpath` strategy \n  * [click/1][click]\n    * clicks on an element\n  * [current_url/0][current_url]\n    * gets url of the current page\n  * uses [execute_script/2][execute_script] to select value from a select list\n    * executes javascripts \n  * [fill_field/2][fill_field]\n    * sets a field's value\n  * uses [change_session_to/2][change_session_to] to use multiple browser sessions for permutations\n  * [take_screenshot/1][take_screenshot]\n    * takes a screenshot of the current page\n  * slow down tests with `:timer.sleep()`\n\n[navigate_to]: https://hexdocs.pm/hound/Hound.Helpers.Navigation.html#navigate_to/2\n[find_element]: https://hexdocs.pm/hound/Hound.Helpers.Page.html#find_element/3\n[visible_text]: https://hexdocs.pm/hound/Hound.Helpers.Element.html#visible_text/1\n[page_title]: https://hexdocs.pm/hound/Hound.Helpers.Page.html#page_title/0\n[click]: https://hexdocs.pm/hound/Hound.Helpers.Element.html#click/1\n[current_url]: https://hexdocs.pm/hound/Hound.Helpers.Navigation.html#current_url/0\n[execute_script]: https://hexdocs.pm/hound/Hound.Helpers.ScriptExecution.html#execute_script/2\n[fill_field]: https://hexdocs.pm/hound/Hound.Helpers.Element.html#fill_field/2\n[take_screenshot]: https://hexdocs.pm/hound/Hound.Helpers.Screenshot.html#take_screenshot/1\n\n#### TODO\n\n  * demonstrate how to select a value from an autocomplete input field with [Awesomplete][awesomplete]\n  * demonstrate [Metadata][metadata] in Hound session \n  * demonstrate [change_session_to/2][change_session_to] to use multiple browser sessions for permutations\n\n[awesomplete]: https://nico-amsterdam.github.io/awesomplete-util/phoenix.html\n[metadata]: https://hexdocs.pm/hound/Hound.Metadata.html\n[change_session_to]: https://hexdocs.pm/hound/Hound.Helpers.Session.html#change_session_to/2\n\n## Go Fetch!\n\n  * Hound [Helpers][helpers], in particular \n    * Hound [Navigation][nav] Helpers\n    * Hound [Element][el] Helpers\n    * Hound [Javascript Execution][je] Helpers\n    * Hound [Screenshot][ss] Helpers\n  * Configuring Hound: https://github.com/HashNuke/hound/blob/master/notes/configuring-hound.md\n  * Official website: http://www.phoenixframework.org/\n  * Guides: http://phoenixframework.org/docs/overview\n  * Docs: https://hexdocs.pm/phoenix\n  * Mailing list: http://groups.google.com/group/phoenix-talk\n  * Source: https://github.com/phoenixframework/phoenix\n\n[helpers]: https://hexdocs.pm/hound/readme.html#helpers\n[nav]: http://hexdocs.pm/hound/Hound.Helpers.Navigation.html\n[el]: http://hexdocs.pm/hound/Hound.Helpers.Element.html\n[je]: http://hexdocs.pm/hound/Hound.Helpers.ScriptExecution.html\n[ss]: http://hexdocs.pm/hound/Hound.Helpers.Screenshot.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanessaklee%2Fstbernard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanessaklee%2Fstbernard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanessaklee%2Fstbernard/lists"}