{"id":15270329,"url":"https://github.com/jfinkhaeuser/unobtainium-cucumber","last_synced_at":"2025-10-06T11:30:35.908Z","repository":{"id":59158694,"uuid":"73173777","full_name":"jfinkhaeuser/unobtainium-cucumber","owner":"jfinkhaeuser","description":"Cucumber specific extensions to unobtainium.","archived":true,"fork":false,"pushed_at":"2018-04-09T11:22:38.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-13T16:13:15.503Z","etag":null,"topics":["appium","bdd","cucumber","ruby","selenium","unobtainium"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfinkhaeuser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-08T10:11:31.000Z","updated_at":"2023-01-28T00:34:43.000Z","dependencies_parsed_at":"2022-09-13T17:50:50.516Z","dependency_job_id":null,"html_url":"https://github.com/jfinkhaeuser/unobtainium-cucumber","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfinkhaeuser%2Funobtainium-cucumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfinkhaeuser%2Funobtainium-cucumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfinkhaeuser%2Funobtainium-cucumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfinkhaeuser%2Funobtainium-cucumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfinkhaeuser","download_url":"https://codeload.github.com/jfinkhaeuser/unobtainium-cucumber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219877263,"owners_count":16554853,"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":["appium","bdd","cucumber","ruby","selenium","unobtainium"],"created_at":"2024-09-30T07:08:16.658Z","updated_at":"2025-10-06T11:30:35.567Z","avatar_url":"https://github.com/jfinkhaeuser.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unobtainium-cucumber\n*Cucumber specific extensions to unobtainium.*\n\nInstead of requiring [unobtainium](https://github.com/jfinkhaeuser/unobtainium)\nin your [cucumber](https://cucumber.io/) project, just require this gem. It'll\nautomatically some cucumber specific features to your project:\n\n- Reset the driver after each scenario.\n- Take screenshots on failures.\n\nOf course, each of these can be configured.\n\n[![Gem Version](https://badge.fury.io/rb/unobtainium-cucumber.svg)](https://badge.fury.io/rb/unobtainium-cucumber)\n[![Build status](https://travis-ci.org/jfinkhaeuser/unobtainium-cucumber.svg?branch=master)](https://travis-ci.org/jfinkhaeuser/unobtainium-cucumber)\n\n# Usage\n\nThe project's own *cucumber*-based test suite demonstrates most of the details.\n\nIn brief, all the setup happens in the `features/support/env.rb` file:\n\n```ruby\nrequire \"unobtainium-cucumber\"\n```\n\nAnd that's it.\n\n## Configuration\n\nAll configuration for this gem happens in the `config.yml` read in by\n*unobtainium*. All configuration keys respected in this gem live under the\ntop-level `cucumber` key, i.e.:\n\n```yaml\n# config.yaml\ncucumber:\n  # this gem's keys go here\n```\n\n## Driver Reset\n\nBy default, the driver's `#reset` function is called after each scenario for\ndrivers that respond to such a function.\n\nYou can switch this off with the `cucumber.driver_reset` flag:\n\n```yaml\n# config.yaml\ncucumber:\n  driver_reset: false\n```\n\n- If the flag is `false`, driver reset is switched off.\n- If the flag is undefined (i.e. `nil`) or any other value, driver reset is\n  switched on. The recommended value to switch it on explicitly is, of course,\n  `true`.\n\n## Status Actions\n\nOne of the convenient features of this gem is that it allows you to cleanly\ndefine callbacks for a particular scenario status.\n\nIt's an extension of the [After hook](https://github.com/cucumber/cucumber/wiki/Hooks)\nthat allows you to specify whether your callback is invoked after a `Scenario`\nor `Scenario Outline` (or both), and only it has `#passed?` or is `#failed?`\n(or both). Status actions thus are actions triggered by a scenario status.\n\nStatus actions can be any function or block that takes two arguments, the\ncucumber [World](https://github.com/cucumber/cucumber/wiki/A-Whole-New-World)\nobject, and the scenario itself (for further querying).\n\nYou can register them by including the `StatusActions` module in `World`, and\nthen calling `#register_action`:\n\n```ruby\n\nWorld(StatusActions)\n\n# ...\n\nGiven(/I foo/) do\n  # Registers #some_func for passed scenarios and outlines\n  register_action(:passed?, method(:some_func))\n\n  # Limits registration to outlines\n  register_action(:failed?, method(:some_func), type: :outline)\n\n  # Registers a block\n  register_action(:failed?) do |world, scenario|\n    # ...\n  end\nend\n```\n\nThere are a number of other methods in the `StatusActions` module that you\ncan use, but this is by far the most important.\n\n### Configuration\n\nOf course, the above is for programmatically adding actions. But `unobtainium`\nis configuration driven, so it makes sense to configure status actions in this\ngem:\n\n```yaml\n# config.yaml\ncucumber:\n  status_actions:\n    passed?:\n      - global_action\n    failed?:\n      outline:\n        - dummy_action\n      scenario:\n        - method_from_own_extension\n```\n\nNote how you can either provide an `Array` of method names to a status key,\nor further divide the status key into individual lists for outlines and\nscenarios.\n\n### Builtin Status Actions\n\nThere are not many status actions built into this gem, although that number\nmay rise. Currently, there is:\n\n- `#store_screenshot` writes a browser screenshot to the `screenshots`\n  directory.\n- `#store_content` writes a dump of the page content to the `content`\n  directory.\n\nFile names are timestamped, and include the scenario name. That should\nmake debugging a failed scenario easier.\n\nIf you do not configure any actions, the default is to take screenshots after\nany failure.\n\n### Custom Actions\n\nAs demonstrated earlier, custom actions are easy to define. If they are\nresolvable before a scenario starts (i.e. files are appropriately required),\nthen you can configure them as string names in the configuration.\n\nYou can specify any method of the `World` object, so any from your own\nexentsions to `World`. Alternatively, any function that is resolvable works.\nYou might have to use fully qualified names.\n\nCustom actions have limited support facilities in the `Action::Support` module.\nCheck it out if you write your own.\n\n### Cucumber Events\n\nCucumber provides an event bus which lets you register handlers for [cucumber's\nown events](http://www.rubydoc.info/gems/cucumber/Cucumber/Events). While that\nis going to be very helpful for hooking into the flow of execution, this gem\nadds [octiron](https://github.com/jfinkhaeuser/octiron) for further event\nprocessing, by publishing all cucumber events on octiron's event bus.\n\nRequire `unobtainium-cucumber` as before, but also require the event processing\ncode:\n\n```ruby\n# env.rb\nrequire 'unobtainium-cucumber'\nrequire 'unobtainium-cucumber/octiron_events'\n\nWorld(Octiron::World)\n```\n\nYou can now register transmogrifiers for any of the cucumber event classes,\nand use the power of octiron's event processing pipeline.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfinkhaeuser%2Funobtainium-cucumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfinkhaeuser%2Funobtainium-cucumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfinkhaeuser%2Funobtainium-cucumber/lists"}