You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of our tests have something like [Theory, Chrome] on them. It's extremely rare that we use some other browser than Chrome, and it's practically non-existent that we'd test multiple browsers in the same test suite. So, instead of repeating the same Chrome attribute on all tests, and then pass it to ExecuteTestAfterSetupAsync() or some other method, let's add the ability to configure a default value for it.
Set BrowserConfiguration.Browser to Chrome by default.
Add overloads in OrchardCoreUITestBase<TEntryPoint> that don't accept a browser.
Remove Chrome from all tests but a single sample (use an existing one for it), where we demonstrate it being used and passed on as today.
The UI Testing Toolbox now offers a default for the browser being used. Since in all but a single test in the history of Lombiq this was Chrome, that's now the default. The endless [Theory, Chrome] attributes and passing the browser down the call chain are now while still supported, unnecessary, unless you want to use a different or multiple browsers.
Everything should keep on working, but it's still nicer to remove the now unnecessary code. So, in all projects, please do this:
Update to the latest UI Testing Toolbox. Then code cleanup time! Warning: UITestBase classes should usually remain so check and revert them if they change after the below steps!
Do a Find and Replace in the UI test projects with the following will cover most cases: [Theory, Chrome] → [Fact], (Browser browser) => → () =>, , browser); → );.
Run the following with "Use regular expressions" checked: ,\r\n.*browser\); → );, ,\r\n.*browser, → ,.
Do a Find and Replace of (Browser browser) → ().
Do a reference lookup for Browser.Chrome (Shift+F12) to find any missed cases.
Finally, you'll need to check the formatting of all tests, because e.g. you may be able to make methods a lot more compact with fewer line breaks. All tests will have now unused references too, but if you have cleanup on save configured in VS, then just saving them will get rid of that.
All of our tests have something like
[Theory, Chrome]
on them. It's extremely rare that we use some other browser than Chrome, and it's practically non-existent that we'd test multiple browsers in the same test suite. So, instead of repeating the sameChrome
attribute on all tests, and then pass it toExecuteTestAfterSetupAsync()
or some other method, let's add the ability to configure a default value for it.BrowserConfiguration.Browser
toChrome
by default.OrchardCoreUITestBase<TEntryPoint>
that don't accept a browser.Chrome
from all tests but a single sample (use an existing one for it), where we demonstrate it being used and passed on as today.Jira issue
The text was updated successfully, but these errors were encountered: