Giter VIP home page Giter VIP logo

q2ebanking / boa-constrictor Goto Github PK

View Code? Open in Web Editor NEW
116.0 12.0 43.0 10.42 MB

Boa Constrictor is a C# implementation of the Screenplay Pattern. Its primary use case is Web UI and REST API test automation. Boa Constrictor helps you make better interactions for better automation!

Home Page: https://q2ebanking.github.io/boa-constrictor/

License: Other

C# 100.00%
screenplay-pattern selenium-webdriver rest-api restsharp webdriver csharp test-automation page-object-model page-object screenplay

boa-constrictor's People

Contributors

amnahkhatun avatar andylpk247 avatar automationpanda avatar chasecastaldo avatar coffeeatbedtime avatar dependabot[bot] avatar egottliebq2 avatar hard-coder05 avatar kapros avatar kashifsoofi avatar kathuria avatar michizhou avatar otoniel-isidoro avatar pl-aknight avatar pl-shernandez avatar pressacco avatar r0secr01x avatar sabotageandi avatar shack05 avatar soofm avatar swatkins18 avatar tomerpacific avatar toniis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boa-constrictor's Issues

Write unit tests for WebDriver Questions

Use Moq to write unit tests for WebDriver Questions. These unit tests should not initialize a real WebDriver. Instead, they should mock WebDriver and make sure calls are successful.

There are multiple WebDriver Questions, so this issue might require multiple pull requests.

Write unit tests for WebDriver Tasks

Use Moq to write unit tests for WebDriver Tasks. These unit tests should not initialize a real WebDriver. Instead, they should mock WebDriver and make sure calls are successful.

There are multiple WebDriver Tasks, so this issue might require multiple pull requests.

Run unit tests for each pull request

We should create a GitHub Action to run the unit tests in Boa.Constrictor.UnitTests for every pull request.

Note: Do not include Boa.Constrictor.Example tests in this issue. (We could include them in a separate issue, but they require more dependencies because they need a WebDriver + a browser.)

Nuget package doesn't include XML docs

The current Nuget package (0.2.2) doesn't include the XML documentation:

image

Assuming you want the docs included, they can be enabled by adding <GenerateDocumentationFile>true</GenerateDocumentationFile> to the <PropertyGroup> in the csproj file.

However, after enabling the above, quite a few warnings of different types are raised such as codes 1591, 1572, 1573, ...
Specific codes can be ignored at a project level by adding another PropertyGroup item: <NoWarn>$(NoWarn);1591;1572;1573</NoWarn>

If you like I can submit a PR, but I'm not sure how you would like the warnings to be handled.

Make unit testing a required check for pull requests

PR #23 added a GitHub Action to automatically run unit tests for pull requests. However, the unit test check is not "Required" like the other checks:
Screen Shot 2020-10-23 at 6 24 31 PM

I'd like to make it required for main. I read this guide, but it looks like I don't have the ability to do so:
https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/enabling-required-status-checks

@dnunez32, are you able to help with this once #23 gets approved and merged? Is this just a feature that certain users don't have, or is it unavailable for the project?

Create a change log file

Background

Boa Constrictor should maintain a change log file for every released version. This issue was created as the result of #17 for exploring release notes.

TODO

  • Name it CHANGELOG.md
  • Put it in the project root directory
  • Follow the conventions from this web page: https://keepachangelog.com/en/1.0.0/
  • Add a line in the file denoting that the file should follow that format
  • Use an Unreleased section for upcoming changes
  • Add instructions to the contribution guidelines to update the Unreleased section for any changes
  • Update the change log file for every version released
  • Make a one-time update to the .csproj file's PackageReleaseNotes setting to say "read the change log"

Versioning

Furthermore, Boa Constrictor should use semantic versioning. Add documentation about this in the contribution guidelines.

Suggestions

It might make sense to complete #30 (making a CONTRIBUTING.md file) before making the change log file.

Standardize ToString methods for WebDriver Tasks

ToString methods for Screenplay interactions vary in format. We should standardize them.

This ticket covers ToString method standardization for WebDriver Tasks.

  • Each Question should explicitly define a ToString method instead of relying upon base classes.
  • Questions should fit the phrasing "Actor attempts to ...". The first word should not be capitalized (unless it's a proper noun).

Explore Release Notes

We should learn how to do release notes and add them to every NuGet package release.

Explore Polly

Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.

Should we use Polly for Boa Constrictor's waiting and retries? Maybe. Let's discuss that here in this issue.

GeckoDriver MoveToElement

Hey,

I'm using gecko driver for a number of tests and it doesn't seem to support MoveToElement (probably more).

A number of the tasks use this and I end up with error OpenQA.Selenium.MoveTargetOutOfBoundsException.

I can write my own tasks to run javascript to do the scroll but it's a bit annoying that I can't use Boa's inbuilt tasks.

Am I just missing something?

Using REST API to set up test via code seams

Hi there!

Would there be a recommendation for or against utilizing and creating Abilities/Interactions for the Actor to use RestSharp to set up the environment for a test? I would imagine the use case for the current implementation is for testing the Service/API layer, but it seems to me that it would be OK to use it for setup as well.

There are test automation approaches that encourage the use of code seams to write more efficient tests by setting up the test conditions thru the Service layer and then finish your test in the UI. For example... If I want to test removing a product from my Shopping Basket...

  1. Navigate to web site.
  2. Search for an item.
  3. Add it to my cart.
  4. Go to my cart.
  5. Remove the item from my cart.

Steps 1-4 can all be bypassed (and tested in separate test cases as necessary) by using an API to directly add a product to the cart and then navigating directly to the cart to complete the UI automation of step 5.

Beyond that - are there any Examples kicking around of the RestSharp classes being used?

Standardize ToString methods for WebDriver Questions

ToString methods for Screenplay interactions vary in format. We should standardize them.

This ticket covers ToString method standardization for WebDriver Questions.

  • Each Question should explicitly define a ToString method instead of relying upon base classes.
  • Questions should fit the phrasing "Actor asks for ...". The first word should not be capitalized (unless it's a proper noun).

Running multiple tasks in a single AttemptsTo block

Hello! and thank you for the repo! Really great to see Screenplay making it into the .NET space.

Coming from SerenityBDD, one feature that I'm missing the most in this repo is being able to pass in multiple tasks in a single AttemptsTo() call.

In other words, I want to be able to turn this:

actor.AttemptsTo(SendKeys.To(LoginPage.UserField, userName));
actor.AttemptsTo(SendKeys.To(LoginPage.PasswordField, password));
actor.AttemptsTo(Click.On(LoginPage.LogInButton));

into this:

actor.AttemptsTo(
    SendKeys.To(LoginPage.UserField, userName),
    SendKeys.To(LoginPage.PasswordField, password),
    Click.On(LoginPage.LogInButton)
);

Saves me a few keystrokes, typing out actor.AttemptsTo() over and over again and it's a little more readable imo.

The implementation would look something like this:

public class Actor {

...

public void AttemptsTo(params ITask[] tasks) {
    foreach(ITask task in tasks) {
        AttemptsTo(task);
    }
}

Add Additional Properties to Actor

Hi there,

I was wondering what I would need to do to add additional properties to an Actor? I'd like to currently give them a username/password property, and may also want to describe them with other attributes down the road for other tests.

I can see that there are a Name and Logger property, but as a C# novice, I'm afraid I'm not sure how to build up from the class in the Boa Constrictor NuGet package.

Explore Shadow DOM

Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree. It can be very tricky to handle with test automation. Info about Shadow DOM can be found here: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM.

We should answer these questions:

  • Is Shadow DOM support worth pursuing?
  • Can Boa Constrictor's current Web UI interactions handle Shadow DOM?
  • If not, then can they be updated seamlessly to support Shadow DOM?
  • If not, then how should we handle Shadow DOM?

New "Actor.Calls" method for calling any type of interaction

Problem

Writing interactions for commands is difficult because the existing nomenclature feels clunky:

  • Actor.AsksFor(JavaScriptCall.To(...))
  • Actor.AsksFor(RestApiResponse.From(...))

Solution

It would be nice to have a method named Actor.Calls(...) for any interaction, Task or Question. "Calls" is generic enough to typically work in both cases. It would also be a good fit for command-like interactions.

  • Actor.Calls(Rest.Request(...))
  • Actor.Calls(Rest.Get(...))
  • Actor.Calls(JavaScript.InBrowser(...))

We should think about this a bit more before proceeding.

Record an introduction video

I delivered a talk to introduce Boa Constrictor at the Selenium Day - North America conference on October 16, 2020. However, that talk was not recorded and shared publicly. I'd like to record the talk, upload the video to YouTube, write a blog article about it, and link it from the project README. That way, people can get a higher-level intro to Boa Constrictor than the tutorial.

User Guide: Testing with SpecFlow

Under a doc section named "Usage", write a doc page to show how to use Boa Constrictor with SpecFlow.

The page should include:

  1. Preparing Visual Studio for SpecFlow
  2. Creating a SpecFlow project
  3. Adding the Boa Constrictor NuGet package
  4. Writing a basic test in Gherkin
  5. Writing step definitions with Boa Constrictor

This page should be more of a quick reference than a lengthy tutorial. It should somewhat mirror the structure of the NUnit page for #89.

Add IsNullOrWhitespace Condition

I just needed an IsNullOrWhitespace condition, because I had to wait until an HTML attribute was available.

Would you be interested in adding it to boa itself? I can submit a PR with it later.

Docs: NUnit integration

Under a doc section named "Usage", write a doc page to show how to use Boa Constrictor with NUnit.

The page should include:

  1. Creating an NUnit project
  2. Adding the Boa Constrictor NuGet package
  3. Writing a basic test with Boa Constrictor

Reference the tutorial, since it uses NUnit. The purpose of this page is to be a quick reference, not a lengthy tutorial itself. It should somewhat mirror the SpecFlow page for #88.

File drop task?

It would be nice to have a "file drop" task. I could really use this for my tests.

Logging: wrap long lines

Some messages are very, very long. Perhaps it would be nice to have logs automatically wrap long lines. This could be an optional feature that does not happen by default.

Change the WebDriver instance on the BrowseTheWeb Ability

I have to run tests in a flakey environment. I know I shouldn't but it is what it is.

During login I occasionally get the "The HTTP request to the remote WebDriver server for URL timed out after 60 seconds" error and attempts to re-navigate trying to recover from this fail.

I'd like to be able to close the driver, start a new one and update it on the BrowseTheWeb ability or remove the BrowseTheWeb ability and readd with the new driver.

The Webdriver on BrowseTheWeb has no setter.

Am I missing an easier way of doing this?

Improve RestSharp Support

Improvements:

  1. Move request logging to the CallRestApi Ability.
  2. Improve REST API interaction names using the Actor's new Calls methods.
  3. Possibly add new REST API interactions.

Docs: Shields Metadata Badges

These metadata badges might be of interest to potential users and contributors if included at the top of the project README. Perhaps things like "does it build", downloads, contributions, issues and dependencies could be added for a glanceable impression of the project state. https://shields.io/

Explore Logging Alternatives

Serilog is a popular .NET logging library.

Should we use Serilog as part of Boa Constrictor? Maybe. Let's discuss that possibility here in this issue.

Pros:

  • Serilog is very popular and well supported.
  • Boa Constrictor wouldn't need to maintain its own logging pattern.

Cons:

  • What if projects using Boa Constrictor don't want to use Serilog or already use a different logger?

Update doc site dependencies to resolve kramdown security warning

While updating the doc site on March 29, 2021, GitHub's Dependabot issued an alert for the kramdown package:
https://github.com/q2ebanking/boa-constrictor/security/dependabot/docs/Gemfile.lock/kramdown/open

The Boa Constrictor doc site has a dependency on kramdown 2.3.0. Unfortunately, that version has a security vulnerability. The fix is to update to 2.3.1.

Unfortunately, the github-pages gem, which is required for hosting the site on GitHub Pages, declares an explicit dependency on kramdown (= 2.3.0):

> bundle update kramdown
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies....
Bundler could not find compatible versions for gem "kramdown":
  In Gemfile:
    kramdown (>= 2.3.1)

    github-pages (~> 213) was resolved to 213, which depends on
      kramdown (= 2.3.0)

I verified that explicit dependency here:
https://rubygems.org/gems/github-pages

GitHub Pages requires the following package versions:
https://pages.github.com/versions/

At the time of opening this issue:

  • github-pages --> 213
  • kramdown --> 2.3.0

I do not believe that I can "hack" kramdown 2.3.1 into the doc site. I tried playing with it locally to see if I could make something work cleanly, but that did not work. I think we must wait for GitHub Pages to update the gem versions it supports and to release an update to the github-pages gem that supports the kramdown update.

It looks like kramdown 2.3.1 was released very recently:
https://kramdown.gettalong.org/news.html

I suspect that the Dependabot security alert is very new. Hopefully, if everyone in the world is receiving this alert, GitHub Pages will put an update in place very soon. Once they do, I'll update our doc site.

Add a secret for a NuGet.org API key

Currently, new NuGet packages are built and pushed to NuGet using a private pipeline within Q2. I want to replace that with a GitHub Action to build and push a new NuGet package every time the version is updated in the .csproj file. However, the GitHub Action will need a NuGet API key to authenticate as my NuGet.org user.

This issue covers the work to add that key as a secret to this repository. Instructions for adding secrets are here:
https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets

Please name the key NUGET_API_KEY. I'll send the value for the key via direct message.

Write Docs for the Project

The README and TUTORIAL are great, but we should invest in more comprehensive documentation for the project. GitHub wikis would be great.

Topics to cover:

  • The Screenplay Pattern
  • Using Boa Constrictor
  • Available Questions and Tasks
  • Project information

.NET 5 Support

Update the .NET projects to target .NET 5. We might want to have multiple targets.

Unified interface for dumpers

The IDumper interface doesn't include a shared Dump method. This means that users cannot genuinely make a custom dumper. We should improve that. Users might want to dump in different ways. Update the docs, too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.