{"id":22072935,"url":"https://github.com/unruly/flick","last_synced_at":"2025-07-24T11:30:56.818Z","repository":{"id":57727559,"uuid":"89485456","full_name":"unruly/flick","owner":"unruly","description":"Modern Java DSL for Acceptance Tests using the screenplay pattern","archived":false,"fork":false,"pushed_at":"2018-12-13T05:29:28.000Z","size":22,"stargazers_count":6,"open_issues_count":10,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-03-25T13:10:24.639Z","etag":null,"topics":["acceptance-testing","java","java8","screenplay-pattern","tdd"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unruly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-26T13:42:44.000Z","updated_at":"2024-03-25T13:10:24.640Z","dependencies_parsed_at":"2022-09-26T21:51:28.493Z","dependency_job_id":null,"html_url":"https://github.com/unruly/flick","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fflick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fflick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fflick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unruly%2Fflick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unruly","download_url":"https://codeload.github.com/unruly/flick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227432290,"owners_count":17775894,"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":["acceptance-testing","java","java8","screenplay-pattern","tdd"],"created_at":"2024-11-30T21:16:05.495Z","updated_at":"2024-11-30T21:16:06.177Z","avatar_url":"https://github.com/unruly.png","language":"Java","readme":"# flick\n\n[![Build Status](https://travis-ci.org/unruly/flick.svg?branch=master)](https://travis-ci.org/unruly/flick)\n[![Release Version](https://img.shields.io/maven-central/v/co.unruly/flick.svg)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22co.unruly%22%20AND%20a%3A%22flick%22)\n\nFlick is an acceptance testing library for Java that implements the Screenplay Pattern, an improvement over the Page Object pattern for UI testing.\n\nAt Unruly, we use this to drive our [monitoring-in-production](https://vimeo.com/channels/pipelineconf/123629954) specs against our customer-facing Reporting UI.\n\n## Getting started with Flick\n\nInstall from Maven Central\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eco.unruly\u003c/groupId\u003e\n  \u003cartifactId\u003eflick\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Using Flick in your tests\n\nA test that implements the FlickDSL interface has access to the given/when/then methods to build a coherent and clean test - these are _default_ methods so classes need not override them. FlickDSL is actually more like a mixin.\n\n```java\npublic class ExampleTest implements FlickDSL {\n   // Tests go here\n}\n```\n\n## Screenplay Pattern\n\nFlick abstracts away notions of WebDriver/UI specific code from the test. You can find more detail on the Screenplay Pattern [here](https://ideas.riverglide.com/page-objects-refactored-12ec3541990)\n\n### Example Test\n\n```java\n@Test\npublic void shouldRestrictToDateRange() {\n  InternalUser actor = new InternalUser();  // Actor\n\n  final Page page = given(actor.using(browser, \"acme-reporting-ui.com\"))\n    .wasAbleTo(loginWith(actor.user(), actor.password())) // Logging in as an Action\n    .hasHappened();\n\n  when(actor.using(browser, page))\n    .attemptsTo(generateReport()) // Generating a report as Action\n    .enact();\n\n  then(actor.using(browser, page))\n    .should(haveTotalWithValue(\"LOTS\"))) // Inspecting the output as an Assertion\n    .check();\n}\n```\n\n## Why would I use Flick/the Screenplay pattern?\n\nThe Screenplay pattern guides us towards higher-level abstractions and decoupling from implementation - by encapsulating interactions and validations within interfaces that only expose the Browser.\n\nThe implementation can then be refactored without changing the tests outside of swapping in new actions/assertions, leading to less brittle, more robust tests.\n\n## Concepts in Flick\n\nA test consists of an *Actor* interacting with a *Stage* - we phrase this as *Given* (an Action is performed), *When* (an Action is performed), *Then* (an Assertion must be valid).\n\n### Actions\n\nAn [Action](./src/main/java/co/unruly/flick/dsl/Action.java) is a function that takes a Browser (to interact with) and returns nothing.\n\nFor example\n```java\nclass NavigateToPage implements Action {\n\n  private final String url;\n\n  private NavigateToPage(String url) { this.url = url; }\n\n  @Override\n  public void performOn(Browser browser) {\n    browser.load(url);\n  }\n}\n```\n\nIn a more functional style:\n\n```java\npublic static Action navigateToPage(final String url) {\n  return browser -\u003e browser.load(url);\n}\n```\n\n### Assertions\n\nAn [Assertion](./src/main/java/co/unruly/flick/dsl/Assertion.java) is a function that takes a Browser (to interact with) and returns nothing.\n\n```java\npublic class HasHeader implements Assertion {\n    @Override\n    public void check(Browser browser) {\n        browser.waitUntil(browser.findElement(By.xpath(\"//*h1\"))::isPresent);\n    }\n}\n```\n\nIn a more functional style:\n\n```java\npublic static Assertion hasHeader() {\n  return browser -\u003e browser.waitUntil(browser.findElement(By.xpath(\"//*h1\"))::isPresent);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funruly%2Fflick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funruly%2Fflick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funruly%2Fflick/lists"}