Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ContainsEmptyListOrNullTest sproadic failures #14946

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ namespace DynamoCoreWpfTests
{
public class GraphNodeManagerViewExtensionTests : DynamoTestUIBase
{
protected override void GetLibrariesToPreload(List<string> libraries)
{
libraries.Add("VMDataBridge.dll");
libraries.Add("DesignScriptBuiltin.dll");
libraries.Add("DSCoreNodes.dll");
base.GetLibrariesToPreload(libraries);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are needed by some of the graphs opened during GraphNodeManagerViewExtensionTests tests



private string PackagesDirectory { get { return Path.Combine(GetTestDirectory(this.ExecutingDirectory), "pkgs"); } }

protected override DynamoModel.IStartConfiguration CreateStartConfiguration(IPathResolver pathResolver)
Expand Down Expand Up @@ -59,7 +68,6 @@ private void LoadExtension(GraphNodeManagerViewExtension v)
[Test]
public void ViewExtensionOpenTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExtension = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -82,7 +90,6 @@ public void ViewExtensionOpenTest()
[Test]
public void CorrectNumberNodeItemsTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -102,7 +109,6 @@ public void CorrectNumberNodeItemsTest()
Open(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");

hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
Utility.DispatcherUtil.DoEvents();

int loadedGraphNodes = hwm.Nodes.Count();
int loadedExtensionNodes = dataGridItems.Count;
Expand All @@ -121,13 +127,13 @@ public void CorrectNumberNodeItemsTest()
Assert.AreEqual(loadedGraphNodes, loadedExtensionNodes);
Assert.AreEqual(deleteGraphNodes, deleteExtensionNodes);
}

/// <summary>
/// Test if using the IsFrozen filter yields correct results
/// </summary>
[Test]
public void FilterFrozenItemsTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -136,8 +142,7 @@ public void FilterFrozenItemsTest()
// Arrange
LoadExtension(viewExt);

Open(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");
Utility.DispatcherUtil.DoEvents();
OpenAndRun(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");

// Get number of frozen Nodes in the graph
var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
Expand Down Expand Up @@ -174,28 +179,23 @@ public void FilterFrozenItemsTest()
[Test]
public void ContainsEmptyListOrNullTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
as GraphNodeManagerViewExtension;

var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;

// Arrange
LoadExtension(viewExt);

var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;

var view = viewExt.ManagerView;

Open(@"pkgs\Dynamo Samples\extra\GraphNodeManagerTestGraph_NullsEmptyLists.dyn");
OpenAndRun(@"pkgs\Dynamo Samples\extra\GraphNodeManagerTestGraph_NullsEmptyLists.dyn");

hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
hwm.Run();
var images = WpfUtilities.ChildrenOfType<Image>(view.NodesInfoDataGrid);

Utility.DispatcherUtil.DoEvents();

var images = WpfUtilities.ChildrenOfType<Image>(view.NodesInfoDataGrid);

int nullNodesImageCount = GetImageCount(images, "Null");
int emptyListNodesImageCount = GetImageCount(images, "EmptyList");

Expand All @@ -214,7 +214,6 @@ public void ContainsEmptyListOrNullTest()
[Test]
public void ViewExtensionOpensWithDynamoWhenRememberedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = true;

//assert that option is enabled
Expand Down Expand Up @@ -247,7 +246,6 @@ public void ViewExtensionOpensWithDynamoWhenRememberedTest()
[Test]
public void ViewExtensionDoesNotOpensWithDynamoWhenClosedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = true;

//assert that option is enabled
Expand Down Expand Up @@ -284,7 +282,6 @@ public void ViewExtensionDoesNotOpensWithDynamoWhenClosedTest()
[Test]
public void ViewExtensionDoesNotOpenWhenNotRememberedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = false;

//assert that option is disabled
Expand Down
Loading