This is a migrated thread and some comments may be shown as answers.

[Solved] Test Studio and SharePoint

6 Answers 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Raul Ribeiro
Top achievements
Rank 1
Raul Ribeiro asked on 19 May 2009, 02:11 PM
Greetings!

I am running into a few problems using Test Studio with Microsoft Office Sharepoint Server 2007.

I was trying to record a very simple test, by creating a new item in a Custom Sharepoint list.
Each item contains only two fields: a string (Title) and a rich text field (Description).
The Test Studio seems to have no problems recording all the events leading up to the insertion of text
into the Description rich text field: clicking the list link, the new item button, and the insertion of text into the Title field.
However, it is not capturing what the user inserts into the rich text field.

I have tried to work around this problem by converting the test into a VS unit test and by analysing the Sharepoint HTML source, looking
for a way to "tweak" the test code.

The Sharepoint HTML elements I have identified, regarding the rich text field is similar to

<textarea name="TextField" rows="6" cols="20" id="TextFieldID" title="RichTextTest" class="ms-long" dir="none"></textarea>

Using the DOM Explorer and the Elements Explorer, I created an entity representing this HTML element, and I have tried to inject
the value I want into its "text" property.

            HtmlTextArea  myVar = Pages.CustomList__New_Item.textarea_M_G_Bf__TextField;
            myVar.Wait.ForExists(10000);
            myVar.Click();
            myVar.Text = "Text I want in the rich text field";

However, when I save the item, the rich text field remains empty.

Can someone please help solving this problem?

 - Why can't the Test Studio capture the typing event into the rich text field?
 - Why isn't the workaround effective? Wasn't it suposed to inject the value into the rich text field?
 - Do you have any suggestions regarding this issue?

If you want, I can send you the complete source code, or some other additional information you require.

Thank you very much for your attention,
André Silva.

6 Answers, 1 is accepted

Sort by
0
Missing User
answered on 19 May 2009, 10:03 PM
Hello João Martins,

If you could please try setting the property 'SimulateRealTyping' in the recorded step that does the typing to true. You can also try setting the 'Value' property of the Text Area the same way you did the 'Text' property in the code and see if that works for you also. Please let us know if either of these work out. Hope this helps. 

Sincerely yours,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Raul Ribeiro
Top achievements
Rank 1
answered on 20 May 2009, 02:33 PM

Greetings!

We have followed both your suggestions but the issue remained. We did, however, try a slightly different approach which solved
the main problem.

Suggestion 1:
"please try setting the property 'SimulateRealTyping' in the recorded step that does the typing to true"

This was not possible to implement, as there was no recorded step related to the typing of the text.
The user clicked the rich text box, to give it the focus, and this action was translated into a recorded step.
However, the actual typing was not captured by the recorder and no recorded step was created. Hence, it was not possible
to change its 'SimulateRealTyping' to true. Or maybe I misunderstood the suggestion?

Suggestion 2:
"You can also try setting the 'Value' property of the Text Area the same way you did the 'Text' property in the code"

This was also not possible to implement, as there is no 'Value' property in the HtmlTextArea object. At least, none that
was available to me by using the autocomplete feature of Visual Studio. Did you mean the 'Value' property of another object?

Slightly different approach:
We created a new recorded step, in a normal text field, inserting a test string. Then, we changed that text field's 'SimulateRealTyping'
to true and converted this recorded step into code. We used this code as a template for simulating real typing
in our problematic rich text field.
However, we had to change a small detail in the code template: the MouseClick step in the HtmlTextArea object was not working
and the text was not being inserted correctly.
The code only worked when we changed the MouseClick to a Div object that exists in the text area.
This Div object is highlighted while using Test Studio's Automation Overlay Surface and it seems to represent the first line of the
rich text field.

Hence, the code is something like:

//Approach #3 - Using the "simulate real typing" template code for the rich text field.
HtmlTextArea textArea = Pages.CustomList__New_Item.textarea_M_G_Bf__TextField;
textArea.Wait.ForExists(10000);
textArea.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop);
ActiveBrowser.Window.SetFocus();

//textArea.MouseClick();    didn't work
            
//the div object (represents the first line of the rich text field?)
Pages.CustomList__New_Item.Frame_ctl00_m_g_bf1aecb1_2e24_4d21_a5b2_ae850cf499.div_0.MouseClick();            
            
Manager.Desktop.KeyBoard.TypeText("Descrição muito fantástica", 150);

Using this code, the text is inserted into the rich text field, but some of the special characters are missing.
Thus, the text which is actually stored in the rich text field is "Descriço muito fantstica",
which lacks the "ã" character and the "á" character. Do you have any insight as to why this is happening?

Like I pointed out in the previous post, we've been trying to use Test Studio with Microsoft Sharepoint Server 2007
and we've been running into a few problems regarding Sharepoint's dynamic menus for instance, but we've managed
to work around them by using snipets of code similar to the one above. It would be nice if Test Studio could somehow
capture Sharepoint "related events" in a more automated fashion, though.

If you require further details regarding this issue, please feel free to let us know.

Thank you very much for your attention,
André Silva.

0
Missing User
answered on 20 May 2009, 03:13 PM
Hi João Martins,

I am glad to hear that you were able to resolve the issue and able to share the fix with us. We have not, unfortunately, been able to do as much SharePoint testing as we would like, so my suggestions for a fix were somewhat based on html type input box recording. The special character issue is a bug, we also appreciate you brining this to our attention, and we will look to resolve this issue in future versions of the product.

Thanks again,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Missing User
answered on 29 May 2009, 06:05 PM
Hi João Martins,

After further investigation of the Special Characters issue and if your still interested, instead of the Manager.Desktop.KeyBoard.TypeText method you can try:
 
Manager.Desktop.KeyBoard.SendString("Descrição muito fantástica");

Hope this helps.

Kind regards,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Raul Ribeiro
Top achievements
Rank 1
answered on 01 Jun 2009, 11:09 AM
Greetings!

Your suggestion regarding the special characters worked :)
We were able to use the new method and insert the intended text into the rich text field.

Thank you very much for your attention,
André Silva.
0
Missing User
answered on 01 Jun 2009, 03:19 PM
Hello again João Martins,

I'm glad this was able to help you in your test automation. Please let us know if there are any other issues you may run into with SharePoint. Thanks again for reporting this issue, and we will look into getting the 'Simulate Real Typing' Property to be Unicode safe.

Sincerely yours,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Raul Ribeiro
Top achievements
Rank 1
Answers by
Missing User
Raul Ribeiro
Top achievements
Rank 1
Share this question
or