C# Protractor test frame work does not work on Angular pages after migrating the application to Docker on Linux

230 views Asked by At

I have used the following framework for UI tests of an angular application and both version worked perfectly. Test code and app source code were on TFS, Windows virtual machines.

  • Version 1: SpecFlow, SpecFlow + SpecRun3, C# selenium web driver, Page Object Model, protractor.
  • Version 2: Spec Flow, Nunit, C# selenium web driver, Page Object Model, protractor.

Environment : Framework="net461", Docker 2.2.0.5 (43884), Ubuntu 18.04

Note: protractor is a Nuget package to test angular pages and works as perfect as Protractor itself without using any explicit waits.

Protractor stopped locating webelements on the angular pages after moving the the application to Linux - Docker containers and the error is "Message: script timeout".

public class HomePage 
{

    public HomePage()
    {
        PageFactory.InitElements(Driver.GetNgDriver(), this);         
    }

    [FindsBy(How = How.XPath, Using = " //button[@class='button-asd']")]
    public IWebElement HomeButton { get; set; }

}

When I cahange the driver type in the constructor of the angular page as "PageFactory.InitElements(Driver.GetDriver(), this);" then it becomes ordinary C# + selenium and we have to deal with all web elements individually by using explicit waits. The problem repeated in the same manner on these conditions.

  • Application is on Linux - Docker & test code is on windows machine
  • Application is on Linux - Docker & test code is on Linux -Docker

I want to use my simple, clear code without explicit waits as before.

pages.HomePage().HomeButton.Click();

Thanks for your ideas.

0

There are 0 answers