When building a Coded UI Map, I specify the application that needs to be launched as shown below.
When I run the following test, the Coded UI Test passes, having been able to locate the controls I'm specifying. In this case, it's a ListViewItem.
[TestMethod]
public void UserOpensAnExistingDiary()
{
this.UIMap.OpenExistingDiary();
}
public void OpenExistingDiary()
{
#region Variable Declarations
WpfListItem uIPenAppsLogicModelsDiListItem = this.UIPENWindow.UIDiariesGroup.UIItemList.UIDiaryGroup.UIPenAppsLogicModelsDiListItem;
WpfWindow uIDiaryEditorWindow = this.UIDiaryEditorWindow;
#endregion
// Launch '%LOCALAPPDATA%\Pen\app-5.0.6018.18517\Pen.Apps.Desktop.exe'
ApplicationUnderTest penAppsDesktopApplication = ApplicationUnderTest.Launch(this.OpenExistingDiaryParams.ExePath, this.OpenExistingDiaryParams.AlternateExePath);
// Double-Click 'Pen.Apps.Logic.Models.DiaryModels.Diary' list item
Mouse.DoubleClick(uIPenAppsLogicModelsDiListItem, new Point(76, 72));
// Wait for 1 seconds for user delay between actions; Click 'Diary' window
Playback.Wait(1000);
Mouse.Click(uIDiaryEditorWindow, new Point(590, 25));
}
If I delete the Launch UI Action, and programmatically launch the app the test is unable to locate the ListViewItem. The only difference is my removing the Launch action, and adding the following code to my tests, so they're initialized with the window launched.
[TestInitialize]
public void Setup()
{
string appPath = ApplicationPath.GetApplicationPath();
var app = ApplicationUnderTest.Launch(appPath);
}
Does anyone know why this would be the case?
