Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Title:
Add
StarletteClient
to Splinter's list of supported drivers for FastAPI applications and update the importsDescription:
This pull request introduces the
StarletteClient
driver to the Splinter library, enabling users to perform browser-like tests on FastAPI applications using theTestClient
from Starlette.Key Changes:
1. Introduction of the
StarletteClient
Driver:StarletteClient
, to Splinter. This driver utilizes Starlette'sTestClient
to simulate browser requests in FastAPI applications.StarletteClient
interacts with FastAPI applications by using Starlette’sTestClient
, providing the ability to perform HTTP requests and parse responses as if they were browser interactions.2. Updated Import Statements:
StarletteClient
among the list of available drivers.StarletteClient
just like the other existing drivers (e.g.,ChromeDriver
,FirefoxDriver
,FlaskClient
), providing consistency across different testing frameworks.StarletteClient
to the import block, it enables seamless integration with Splinter’s current import structure.Updated import block:
3. Why Web Drivers Were Included:
Consistency and Compatibility: By adding StarletteClient to the same import section as other web drivers like ChromeDriver, FirefoxDriver, and EdgeDriver, we ensure that Splinter remains compatible with its existing structure, making it easy for developers to transition between different types of web frameworks.
Unified Testing Interface: Users familiar with Splinter’s testing style (via Selenium or other drivers) can now write tests for FastAPI applications using the same approach, without needing to learn a new API.
Broad Framework Support: Supporting FastAPI in Splinter expands the utility of the library, catering to the growing demand for FastAPI, which is becoming one of the most popular frameworks for building modern web applications.
Conclusion:
With this update, Splinter now supports testing FastAPI applications using the StarletteClient driver. This allows developers to write tests for API-based apps in a simple, uniform manner. The addition of StarletteClient to Splinter ensures that the library continues to stay relevant by supporting more modern and popular frameworks, keeping it a versatile tool for web application testing.