Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal REST testing façade a'la Serenity/JS Web #1876

Closed
2 of 3 tasks
jan-molak opened this issue Aug 25, 2023 · 1 comment
Closed
2 of 3 tasks

Universal REST testing façade a'la Serenity/JS Web #1876

jan-molak opened this issue Aug 25, 2023 · 1 comment
Assignees

Comments

@jan-molak
Copy link
Member

What's the problem you're trying to solve?

At the moment, Serenity/JS provides REST testing capabilities via the @serenity-js/rest module and uses axios under the hood. This is particularly useful in E2E tests for performing data setup/tear down tasks that would've been much slower or impossible to perform via the web UI.

However, some web integration tools, like Playwright Test with its request object also provide a capability to interact with REST APIs, or like WebdriverIO - might provide it in the near future webdriverio/webdriverio#7187

While Serenity/JS REST can be used with Playwright, Protractor, WebdriverIO, or even standalone, it would be nice to reuse the API client provided by Playwright Test so that developers don't have to configure axios from scratch.

How would you like to solve it?

The universal testing façade approach used with Serenity/JS Web could also be applicable here:

  • @serenity-js/rest could be made integration tool-agnostic so that it doesn't have a dependency on Axios
  • @serenity-js/axios module could be introduced to provide Axios-specific implementation
  • @serenity-js/playwright-test module could provide a Playwright-specific implementation compatible with @serenity-js/rest, e.g. CallAnApiWithPlaywright, and provide it automatically to any Serenity/JS actors used with Playwright Test
  • @serenity-js/webdriverio module could provide a WebdriverIO-specific implementation

Are there any alternatives?

Developers can continue to use @serenity-js/rest with the standard axios client, and we could provide more docs around setting it up.

How can we make it happen?

@jan-molak
Copy link
Member Author

There might be an easier way to solve it and avoid introducing new modules; To do that, axios instance used by @serenity-js/rest could be configured automatically by @serenity-js/playwright-test or @serenity-js/webdriverio based on the configuration of their respective web browsers.

jan-molak added a commit that referenced this issue Sep 14, 2023
…ests

error messages now include the URL for which the request has failed

Related tickets: re #1876
@jan-molak jan-molak self-assigned this Sep 24, 2023
jan-molak added a commit that referenced this issue Oct 3, 2023
jan-molak added a commit that referenced this issue Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant