{"id":23266147,"url":"https://github.com/raphiz/spring-playwright-feature-specs","last_synced_at":"2025-08-20T22:30:33.375Z","repository":{"id":72307121,"uuid":"584503829","full_name":"raphiz/spring-playwright-feature-specs","owner":"raphiz","description":"A small, opinionated library to write readable feature specs for your Spring web applications in Kotlin.","archived":false,"fork":false,"pushed_at":"2024-06-05T14:29:54.000Z","size":177,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-05T16:35:13.567Z","etag":null,"topics":["kotlin-library","playwright","playwright-java","spring-boot","spring-mvc","testing"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/raphiz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-02T18:53:12.000Z","updated_at":"2024-06-05T14:25:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a017bb5-3d93-4d38-833e-1c2adf724ca5","html_url":"https://github.com/raphiz/spring-playwright-feature-specs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphiz%2Fspring-playwright-feature-specs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphiz%2Fspring-playwright-feature-specs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphiz%2Fspring-playwright-feature-specs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphiz%2Fspring-playwright-feature-specs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphiz","download_url":"https://codeload.github.com/raphiz/spring-playwright-feature-specs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230462827,"owners_count":18229862,"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":["kotlin-library","playwright","playwright-java","spring-boot","spring-mvc","testing"],"created_at":"2024-12-19T15:52:50.764Z","updated_at":"2024-12-19T15:52:51.329Z","avatar_url":"https://github.com/raphiz.png","language":"Kotlin","readme":"# Spring Playwright Feature Specs\n\nSpring Playwright Feature Specs is a **small, opinionated library to write readable feature specs for your Spring web applications in Kotlin**.\n\nIt's just a bit of setup code and syntactic sugar.\n\nThis style of testing is inspired by Ruby's [Capybara with RSpec](https://thoughtbot.com/blog/how-we-test-rails-applications#feature-specs). Read more about testing with [feature specs](https://thoughtbot.com/blog/how-we-test-rails-applications#feature-specs) in the [Testing Rails book](https://books.thoughtbot.com/books/testing-rails.html).\n\n## Example Usage\n\nAnnotate your test class with `@FeatureSpec`. This will add the `@SpringBootTest` and enable the jUnit 5 `SpringWithPlaywrightExtension`, which will prepare a real browser (chromium) for the tests.\n\nEach test method (annotated with jUnits `@Test`) uses the `withPage` helper function. This function opens up a new [browser context](https://playwright.dev/java/docs/api/class-browsercontext) for each test and provides access to playwrights [Page interface](https://playwright.dev/java/docs/api/class-page).\n\n```kotlin\n@FeatureSpec\nclass UserCreatesRecipe {\n\n    @Test\n    fun `they see the page for the created recipe`() = withPage {\n        val recipeTitle = \"Chicken Masala\"\n\n        navigate(\"/\")\n\n        getByText(\"Create new Recipe\").click()\n\n        getByLabel(\"Recipe Title\").fill(recipeTitle)\n\n        getByText(\"Submit!\").click()\n\n        assertThat(locator(\"body\")).containsText(recipeTitle)\n    }\n\n    @Test\n    fun `they see a useful error message when the form is invalid`() = withPage {\n        navigate(\"/\")\n\n        getByText(\"Create new Recipe\").click()\n\n        getByText(\"Submit!\").click()\n\n        assertThat(locator(\"body\")).containsText(\"title cannot be blank\")\n    }\n\n}\n```\n\n[Here is a full minimal working example](https://github.com/raphiz/spring-playwright-feature-specs/blob/main/src/test/kotlin/io/github/raphiz/springplaywrightfeaturespecs/ExampleSpec.kt).\n\n## Install\n\nJust add `spring-playwright-feature-specs` as a test dependency to you project.\n\nWhen using Gradle, I highly recommend to create a separate [test suite](https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html) for feature spec tests.\n\n**Gradle Kotlin DSL**\n```kotlin\ntestImplementation(\"io.github.raphiz:spring-playwright-feature-specs:0.2.0\")\n```\n\n**Gradle**\n```groovy\ntestImplementation 'io.github.raphiz:spring-playwright-feature-specs:0.2.0'\n```\n\n\n**Maven**\n\u003cdetails\u003e\u003cp\u003e\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.raphiz\u003c/groupId\u003e\n  \u003cartifactId\u003espring-playwright-feature-specs\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n## Configuration\n\nThe scope of this project is very small and not intended to be configurable.\n\nIf you have different needs, consider implementing your own version of the `withPage` function or the `@FeatureSpec` annotation. If you need even more, it's probably best to integrate this code into your own code base.\n\n## Contribution\n\nIf you have any suggestions, feedback or questions, feel free to open a [GitHub issue](https://github.com/raphiz/spring-playwright-feature-specs/issues). ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiz%2Fspring-playwright-feature-specs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphiz%2Fspring-playwright-feature-specs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiz%2Fspring-playwright-feature-specs/lists"}