jonhoo / fantoccini

A high-level API for programmatically interacting with web pages through WebDriver.
Apache License 2.0
1.68k stars 125 forks source link

[WIP] Ergonomic attribute macro for testing #212

Closed jackdfraser closed 1 year ago

jackdfraser commented 1 year ago

This PR is an attempt to introduce an attribute macro for testing with fantoccini as a dev dependency.

Essentially:

#[fantoccini::test(chrome, firefox)]
async fn end_to_end_test(client: Client) -> Result<(), CmdError>{

}

Upon being run the test will duplicate the test logic and run it against both chromedriver and geckodriver.

Ideally generating:

running 2 tests
test end_to_end_test::chrome ... ok
test end_to_end_test::firefox ... ok

Requirements:

Notes:

Areas Of Review Requested:

Future Features:

jonhoo commented 1 year ago

I guess I'm not quite clear on how much value this really provides — it's not as though there's lots of boilerplate to setting up the tests, and it's pretty easy to do it through a regular function (see our own test suite). If anything, I think I'd want this to live in a separate crate in its own repo. I don't think it's something that needs to live in fantoccini itself.

codecov[bot] commented 1 year ago

Codecov Report

Merging #212 (eb4d2fe) into main (377e40b) will decrease coverage by 1.14%. The diff coverage is 0.00%.

Additional details and impacted files | [Impacted Files](https://codecov.io/gh/jonhoo/fantoccini/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jon+Gjengset) | Coverage Δ | | |---|---|---| | [src/common.rs](https://codecov.io/gh/jonhoo/fantoccini/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jon+Gjengset#diff-c3JjL2NvbW1vbi5ycw==) | `0.00% <0.00%> (ø)` | | | [src/lib.rs](https://codecov.io/gh/jonhoo/fantoccini/pull/212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jon+Gjengset#diff-c3JjL2xpYi5ycw==) | `93.10% <ø> (ø)` | |