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

selenium tests, only works in VB I think, but the tests work at least #47

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

perpetualglow
Copy link

No description provided.

Copy link
Contributor

@jonathanvdc jonathanvdc left a comment

Choose a reason for hiding this comment

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

Looks like a promising start! 👍 Just needs some polishing before it can get merged in. See my remarks for a list of things that can be improved.

General remark: add .vs/ to your .gitignore and commit a deletion of all files in selenium/.vs/. These Visual Studio files are personal. You don't want to share them.

Also: CI build seems to be failing for this PR. Don't know why because I haven't checked it out yet. Will do that later. You're welcome to take a look at that in the meantime.

@@ -17,6 +17,7 @@
"jsonld": "^0.4.5",
"material-ui": "^0.20.0",
"n3": "^0.11.2",
"nuget": "^2.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually useful or is this just dead code?

Installing NuGet as a separate global dependency shouldn't be a problem at all for people who already installed a C# compiler and an MSBuild-like build system. But maybe you've got a different perspective on that and this line is warranted anyway.

Regardless, please don't put NuGet in the package.json's "dependencies"—if you really do need it, put it in the "devDependencies".


public static int Main(string[] args)
{
// Acquire a log for printing output.
var rawLog = new RecordingLog(TerminalLog.Acquire());
var rawLog = new RecordingLog();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why'd you change this? This'll secretly eat up all error messages, making it impossible to tell what happened when something went wrong. The tests will still fail by exiting with a nonzero exit code, but that will be obscured now.

@@ -78,7 +78,8 @@ public static int Main(string[] args)
return 0;
}

string testUrl = parsedOptions.GetValue<string>(Options.Url);
//string testUrl = parsedOptions.GetValue<string>(Options.Url);
string testUrl = "http://192.168.1.12:5000";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change this back. You can specify http://192.168.1.12:5000 as a command-line argument in the project configuration. Here's a relevant StackOverflow question.

/// <summary>
/// A list of all sanity check tests.
/// </summary>
public static readonly IEnumerable<TestCase> All =
public static readonly ICollection<TestCase> All =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why'd you change this to ICollection<TestCase>? Shared mutable collections are kind of bad. Consider using IReadOnlyCollection<TestCase> or even IReadOnlyList<TestCase>.

Assert.IsTrue(dataElement.Text == "ex:Alice");
});

public static readonly ICollection<TestCase> All =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why'd you use ICollection<TestCase> here? Shared mutable collections are kind of bad. Consider using IReadOnlyCollection<TestCase> or even IReadOnlyList<TestCase>.

@@ -25,12 +25,12 @@ public static class Program
/// <summary>
/// A sequence of all test cases to run.
/// </summary>
private static readonly IEnumerable<TestCase> TestCases = SanityChecks.All;
private static ICollection<TestCase> TestCases = UploadFileTests.All;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why'd you use ICollection<TestCase> here? Shared mutable collections are kind of bad. Consider using IReadOnlyCollection<TestCase> or even IReadOnlyList<TestCase>. Or better yet: IEnumerable<TestCase>, as before.

Also, why exclude the sanity check tests? You can include them like so:

using System.Linq;

// ...

private static readonly IEnumerable<TestCase> TestCases =
    SanityChecks.All
    .Concat(UploadFileTests.All);

Copy link
Contributor

Choose a reason for hiding this comment

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

You might also want to include all the other tests here.


namespace SeleniumTests.Tests
{
class EditGraphTests
Copy link
Contributor

Choose a reason for hiding this comment

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

These test classes contain public static members only. Consider making the classes themselves public static as well.

driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
//Log in
driver.Login();
String currentPath = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not insert a using System.IO; directive at the top of the file and drop the qualifiers here? Directory.GetParent is just as clear as System.IO.Directory.GetParent and a lot shorter.

String currentPath = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName;
String path = currentPath + @"\testfiles\demo_shacl.ttl";
//Open a SHACL file
driver.OpenFile(path);
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the following getting duplicated over and over again.

String currentPath = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName;
String path = currentPath + @"\testfiles\demo_shacl.ttl";
// Open a SHACL file
driver.OpenFile(path);

You might want to refactor that pattern into a specialized (extension?) method, so you can just call driver.OpenTestFile("demo_shacl.ttl"); Also see my comment below w.r.t. the Windows-style paths: you should use Path.Combine instead.


namespace SeleniumTests.Tests
{
static class Help
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename this class to WebDriverHelpers to better express what's going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants