TestStack / White

DEPRECATED - no longer actively maintained
Other
1.02k stars 486 forks source link

Silverlight Support #134

Open JakeGinnivan opened 11 years ago

JakeGinnivan commented 11 years ago

Silverlight has no running tests on the build server, so I have no idea the state of it.

I am considering removing Silverlight support in White as there are commercial tools which support Silverlight.

For the moment, I will leave the projects in the repository, but if someone from the community cannot contribute to the Silverlight support in White (by introducing tests/sample applications) then it will be dropped.

csharsha commented 11 years ago

hi Jake, I am trying to download and view TestStack.White for my Silverlight web application automation, I downloaded the latest version from NuGet(0.11.0.207) but I am unable to find any web related APIs, such as TestStack.White.WebBrowser and also Silverlight related APIs. Please help me in this regard, as I am looking seriously in Silverlight automation. Hope you will reply soon.

Thanks

Harsha C S

JakeGinnivan commented 11 years ago

Hey,

I am happy to release this NuGet package, but I do not have time to maintain/bugfix issues with silverlight at the moment. I am happy to help you fix any issues, review pull requests and release new versions to NuGet :)

csharsha commented 11 years ago

Jake, the issue. For the Instance of TestStack.White I am unable to find the WebBrowser API. I even checked in .Net Reflector for TestStack.White.dll, it does not have API to support Web API. Please help

N1t1nA commented 11 years ago

Hi csharsha and Jake

I want to perform Silverlight Application Testing using TestStack.White

First Page is Login Page (aspx Page) when I login into Application? Silverlight starts in Web Browser

Please let me know how to Start Testing with White.. Any Sample Tests is really appreciated..

Thanks Nitin

JakeGinnivan commented 11 years ago

Hi @N1t1nA

Unfortunately White does not support automating web pages at the moment, once the UIAComWrapper branch is fully functioning, White will actually be able to automate web pages in internet explorer.

You will have to use selenium or similar to login, then you can get the TestStack.White.WebBrowser NuGet from http://teamcity.ginnivan.net/viewType.html?buildTypeId=TestStack_White_Ci (it is not published yet)

csharsha commented 11 years ago

Hi Jake, so as you are telling there is no current support for Web browser in White, but I found a link which explains about automation web APIs. Please look into this link http://leobartnik.blogspot.com/2010/01/silverlight-uiautomation-testing-using.html

JakeGinnivan commented 11 years ago

White can attach to a web broweser (internet explorer, not sure if firefox works), then get a silverlight document from the webpage.

The link you provided describes the approach I recommended where you use Selenium (or in this case Watin) to do the web automation, then use White to attach to the silverlight document and then you can use WHite to automate your silverlight application.

csharsha commented 11 years ago

Yes you are correct, but as you said, to attach the process to White to get the Silverlight document is not possible as it is done using White.WebBrowser method, please help on this.

There they are using

White.WebBrowser.InternetExplorer white = new White.WebBrowser.InternetExplorer(); white.Attach(watin.ProcessID, "browser window title");

in the downloaded dll from NuGet, I didn't have this methods

JakeGinnivan commented 11 years ago

InternetExplorer.Launch("URL", "TITLE").SilverlightDocument will give you the silverlight document. You can get the nuget package off the build server.

Is that what you are after?

csharsha commented 11 years ago

Please tell me to which class does this InternetExplorer belongs and you are telling about NuGet package off build server, I didn't understand. Please help

N1t1nA commented 11 years ago

Hi Jake

Could you please provide an example using Selenium Webdriver and White to attach the Silverlight Document and Automate the Application

using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; using OpenQA.Selenium.IE; using Selenium;

namespace RM_Framework { [TestFixture] public class Driver { private Driver selenium; private const string URL = "http://localhost/Portal?forms=1&sl=1";

    [SetUp]
    public void Setup()
    {
        //selenium = new DefaultSelenium("localhost", 4444, "*iexplore", URL);

        // Create a new instance of the Firefox driver
        selenium = new InternetExplorerDriver(@"C:\Selenium\");
        selenium.Start();
        selenium.Open(URL);
    }

    [TearDown]
    public void Teardown()
    {
        selenium.Stop();
    }

    [Test]
    public void GoogleSearch()
    {
        //Navigate to the site
        //selenium.Navigate().GoToUrl("http://localhost/Portal?forms=1&sl=1");
        // Find the text input element by its name
        IWebElement query = selenium..FindElement(By.Id("txtLogin"));
        // Enter something to search for
        query.SendKeys("basware\\ilkka");
        // Now submit the form
        IWebElement loginButton = driver.FindElement(By.Id("btnLogin"));

        loginButton.Click();
        // Google's search is rendered dynamically with JavaScript.
        // Wait for the page to load, timeout after 5 seconds
        WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(50));
        System.Threading.Thread.Sleep(50000);

// Now my Silver App is injected into the Browser


// get the Silverlight app reference from the white browser reference White.WebBrowser.Silverlight.SilverlightDocument sl = white.SilverlightDocument;

// do stuff sl.Get

csharsha commented 11 years ago

Hi Nitin, from where you downloaded White, the one which I downloaded is not having methods for White.WebBrowser.Silverlight.SilverlightDocument sl = white.SilverlightDocument, I am unable to perform. How did you achieve this?

csharsha commented 11 years ago

Please help us, Jake. we are waiting for your reply.

JakeGinnivan commented 11 years ago

I am on my way to work now, so this will not be 100%.

TeamCity is the build server. Sign in as guest then you can access the artifacts including the TestStack.White.WebBrowser. Or you can pull down source and run build.cmd to get artifacts.

Then you can add a local folder as a nuget source. There are tutorials on the net/nuget site for this.

Now you can use the code you posted (but change whites namespaces to the new TestStack.White.WebBrowser namespace.

As i mentioned in this issue, i do not have time to fully support silverlight, so if you guys could contribute back a sample to help others, or a page on docs.teststack.net that would be great!

Sent from my Windows Phone


From: csharshamailto:notifications@github.com Sent: ý04/ý09/ý2013 08:13 To: TestStack/Whitemailto:White@noreply.github.com Cc: Jake Ginnivanmailto:Jake.Ginnivan@readify.net Subject: Re: [White] Silverlight Support (#134)

Please help us, Jake. we are waiting for your reply.

— Reply to this email directly or view it on GitHubhttps://github.com/TestStack/White/issues/134#issuecomment-23770231.

csharsha commented 11 years ago

Okay Jake, thanks for your reply. Please give me the link as the link you provided earlier for the Build server does not have latest White dlls. Please give the latest link.

Thanks

JakeGinnivan commented 11 years ago

That is the Continuous Integration build, it is newer than the ones on NuGet, it matches the latest source.

Sent from my Windows Phone


From: csharshamailto:notifications@github.com Sent: ý04/ý09/ý2013 08:45 To: TestStack/Whitemailto:White@noreply.github.com Cc: Jake Ginnivanmailto:Jake.Ginnivan@readify.net Subject: Re: [White] Silverlight Support (#134)

Okay Jake, thanks for your reply. Please give me the link as the link you provided earlier for the Build server does not have latest White dlls. Please give the latest link.

Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/TestStack/White/issues/134#issuecomment-23771528.

JakeGinnivan commented 11 years ago

@csharsha did you manage to get a build?

csharsha commented 10 years ago

Jake, I am glad to get the build and using it in a great manner. But white dll is failing to get Silverlight controls in some browser windows. It is working sometimes and it is not working in some other screen of same application. My app is having customized silverlight screens. I am getting the following error. Please refer the screenshot.

JakeGinnivan commented 10 years ago

@csharsha the error and screenshot did not come through?

csharsha commented 10 years ago

Hi Jake, did you get my attachment, I have sent reply to this thread through email. If not please give me your email ID.

JakeGinnivan commented 10 years ago

My email is on my github account details

csharsha commented 10 years ago

Hi Jake, I have sent you an email attaching the error screen shot. Please help.

JakeGinnivan commented 10 years ago

Not sure what the issue is. I suggest you clone the repository and investigate what the issue might be.

Silverlight support in White has been neglected, and I am not willing to invest time in investigating these issue. Sorry. I maintain White in my spare time and cannot justify the investment of time.

If you do not understand concepts in the White code base, or what some code is doing, feel free to ask. But you will have to investigate this issue yourself. If you do find a solution, I am happy to review and merge pull requests to help others in the same position as you.

There are also plenty of commercial offering with Silverlight support

csharsha commented 10 years ago

Hi Jake,

What do you mean by cloning the repository? Please make it clear. I am already using commercial tools for silverlight from past 5 years, but I want to know upto what an extant a free ware or open source tool can support.

JakeGinnivan commented 10 years ago

Hey,

I mean using git to clone the github repository, so you have Whites codebase locally. You can then open the solution in visual studio and try to debug the issue with Whites codebase available. That is the beauty of open source, it is free and when something is wrong you can help out by fixing the issue, and submitting a pull request. Instructions to do that are on the TestStack docs website.

Sent from my Windows Phone


From: csharshamailto:notifications@github.com Sent: ý07/ý10/ý2013 05:22 To: TestStack/Whitemailto:White@noreply.github.com Cc: Jake Ginnivanmailto:jake@ginnivan.net Subject: Re: [White] Silverlight Support (#134)

Hi Jake,

What do you mean by cloning the repository? Please make it clear. I am already using commercial tools for silverlight from past 5 years, but I want to know how a free ware or open source tool can support.

— Reply to this email directly or view it on GitHubhttps://github.com/TestStack/White/issues/134#issuecomment-25784487.

N1t1nA commented 10 years ago

Hi csharsha

Could you share your Test Stack White framework with me at my Email, for Testing Silverlight applications,

I want to see the approach you are following for maintaining Utility Functions and Test Data

Are you using the Page Factory Design Pattern

Thanks N1t1nA

csharsha commented 10 years ago

Hi N1t1nA,

The main problem I am facing with White assemblies is, I can automate/simulate the Silverlight application by getting its instance. When I click on some link in my application, the child window opens which is also a browser window and here I am unable to get the Silverlight instance of the browser window. I did same thing as I did for my parent browser but still the issue exists, I cloned the repository and debugged the source code but still no hope. My application is customized silverlight application. Please help me, if you have some idea.