Open Closed

Playwright Compatibility #7132


User avatar
0
ben.shelton created
  • ABP Framework version: v7.2.2
  • UI Type: MVC
  • Database System: EF Core
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

Hello,

We are attempting to implement Playwright for end-to-end testing in our application. Prior to adding playwright, we are able to run the sample tests included in startup solutions from abp successfully and in non-abp applications we are able to add Playwright per their documentation for Visual Studio and test successfully. However once we add the Playwright into an abp generated solution, then the tests will not complete and seem to get hung up.

I see in the abp docs (https://docs.abp.io/en/abp/latest/Testing), it says that xUnit, NSubstitute, and Shoudly are the libraries already installed for startup projects for testing, but it also says these can be replaced. However, I did not find any resources on how to accomplish this.

Is there any guidance we can get for adding Playwright and having it work with our abp application? Additionally if Playwright is not recommended for end-to-end testing with abp applications, then do you have any recommended ones?


18 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    have you checked this community video https://community.abp.io/events/ui-testing-with-playwright-upcoming-abp-7.0-exppajuj please do check if it helps you,

    thanks.

  • User Avatar
    0
    ben.shelton created

    Hello,

    I did watch the video, but the the example used in there did not seem to be using an abp generated application like we are attempting to add Playwright to.

    The issue seems to be that once we add Playwright per the instructions in their documentation. The included testing structure from an abp startup project and Playwright are interfering with each other and causing all testing to not run (even if it is only the sample tests). Is there any recommendation or guidance on how to get Playwright added and working in an abp generated application?

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    Please have look to this example once https://github.com/microsoft/playwright if find helpful.

    thanks

  • User Avatar
    0
    ben.shelton created

    Hello,

    I have taken a look at the link you sent. As previously stated, we can successfully install Playwright using the information in their documentation. When we do this on non-Abp generated projects, it works as intended and as their documentation shows. However, when we add it to projects we generated from an Abp startup template via Abp Suite, we cannot get any tests to run. This seemingly points to Playwright and the pre-installed testing libraries from the Abp template are interfering with each other in some way.

    Is their any guidance or recommendations on getting Playwright working in an Abp generated project?

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    please check this https://playwright.dev/docs/intro if it helps you.

    Thanks

  • User Avatar
    0
    ben.shelton created

    Hello,

    I have taken a look at the link you sent, but unfortunately it was not able to help. Would it be possible for you to send a sample abp generated project that has Playwright added and working so I can see how it is implemented?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    When we do this on non-Abp generated projects, it works as intended and as their documentation shows. However, when we add it to projects we generated from an Abp startup template via Abp Suite, we cannot get any tests to run. This seemingly points to Playwright and the pre-installed testing libraries from the Abp template are interfering with each other in some way.

    Can you share the project that uses abp and Playwright? I will download and check it . liming.ma@volosoft.com

  • User Avatar
    0
    ben.shelton created

    Hello,

    I sent a sample project to your email.

    Please let me know if you need anything further from me.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, I will check it.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please try to remove the typeof(Microsoft.Playwright.NUnit.PlaywrightTest) from AbpPlaywrightTestTestBaseModule

    [DependsOn(
        typeof(AbpAutofacModule),
        typeof(AbpTestBaseModule),
        typeof(AbpAuthorizationModule),
        typeof(AbpPlaywrightTestDomainModule)
        // typeof(Microsoft.Playwright.NUnit.PlaywrightTest)
        )]
    public class AbpPlaywrightTestTestBaseModule : AbpModule
    
  • User Avatar
    0
    ben.shelton created

    Hello,

    I removed the typeof(Microsoft.Playwright.NUnit.PlaywrightTest) where you advised, but I am still unable to run the tests. It continuously spins on Starting Test discovery.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The ABP's unit tests all are works

    The class Tests : PageTest has nothing with abp.

  • User Avatar
    0
    ben.shelton created

    Does the Playwright sample test under AbpPlaywrightTest.TestBase.TestExample run for you?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I haven't tried it.

  • User Avatar
    0
    ben.shelton created

    The Playwright test is what we are more concerned with since that is what we will be using for our testing and we have not been able to get it to run playwright tests successfully in an abp generated project, only in non-abp projects.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I ran the test, and it worked.

  • User Avatar
    0
    ben.shelton created

    Can you tell me what version of Visual Studio that you are running this in? We are trying to rule that out as a possibility for why it's not working on our end.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I'm using the Rier.

    https://www.jetbrains.com/rider/

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11