The application I am testing has a 'Copy to clipboard' button which copies two strings, 'Work Instruction Order' and 'Summary'. When you paste it should look like following:
---------------------------------
Work Order Instructions
LineOne
LineTwo
Summary
LineThree
LineFour
----------------------------------
This is what I have in code:
Code: Select all
string work_order_instructions_txt = "LineOne\r\nLineTwo";
string summary_txt = "LineThree\r\nLineFour"";
//one string combining these two strings
string total_string = "Work Order Instructions"+"\r\n" + work_order_instructions_txt + "\r\n"+"Summary"+"\r\n" + summary_txt + "";
string new_total_string = total_string.Trim();
//capture clipboard
string clipboardText= System.Windows.Forms.Clipboard.GetText();
string new_clipboardText = clipboardText.Trim();
if (new_clipboardText.Equals(new_total_string))
Report.Success("Copy to clipboard text has matched");
else
{
Report.Failure("Copy to clipboard text has not matched");
Report.Error("Actual Text:\r\n" + new_clipboardText + "");
Report.Error("Expected Text:\r\n" + new_total_string + "");
}
Copy to clipboard text has not matched
Actual Text:
Work Order Instructions
LineOne
LineTwo
Summary
LineThree
LineFour
Expected Text:
Work Order Instructions
LineOne
LineTwo
Summary
LineThree
LineFour
(Exact same actual and expect result, still test is failing).
Any idea why this is happening? Please help.
Thanks in advance.