-
Notifications
You must be signed in to change notification settings - Fork 9
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
perpetualglow
wants to merge
6
commits into
master
Choose a base branch
from
JonasBaes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
739f3b0
selenium tests, only works in VB I think, but the tests work at least
perpetualglow 1635889
further tests and implemented remarks
perpetualglow bd8b63d
further tests, merging with master
perpetualglow 936b7cd
conformance tests
perpetualglow 26642e5
Merge branch 'master' of https://github.com/dubious-developments/UnSH…
perpetualglow 8de9d5c
merge with master again'
perpetualglow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,4 +100,6 @@ bin/ | |
obj/ | ||
|
||
# MonoDevelop preferences | ||
*.userprefs | ||
*.userprefs | ||
|
||
.vs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 readonly IEnumerable<TestCase> TestCases = (ConformanceTests.All); | ||
|
||
public static int Main(string[] args) | ||
{ | ||
// Acquire a log for printing output. | ||
var rawLog = new RecordingLog(TerminalLog.Acquire()); | ||
var rawLog = new RecordingLog(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
// Create a derived log for printing diagnostics. | ||
var log = CreateDiagnosticLog(rawLog); | ||
|
@@ -78,6 +78,7 @@ public static int Main(string[] args) | |
return 0; | ||
} | ||
|
||
|
||
string testUrl = parsedOptions.GetValue<string>(Options.Url); | ||
bool noUrl = string.IsNullOrWhiteSpace(testUrl); | ||
|
||
|
@@ -190,6 +191,7 @@ public static int Main(string[] args) | |
return new SafariDriver(options); | ||
} | ||
} | ||
|
||
}; | ||
|
||
/// <summary> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<StartArguments>"http://192.168.1.12:5000"</StartArguments> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using System.Collections.Generic; | ||
using OpenQA.Selenium; | ||
using System; | ||
using System.Windows.Forms; | ||
using static System.Diagnostics.Stopwatch; | ||
using static System.Threading.Thread; | ||
using System.Diagnostics; | ||
|
||
namespace SeleniumTests.Tests | ||
{ | ||
public static class ConformanceTests | ||
{ | ||
public static readonly TestCase CheckGreenWhenConforming = | ||
new TestCase( | ||
"Header remains green when there are no conformance errors", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
Sleep(100); | ||
//Open data file | ||
driver.OpenDataFile("demo_data_conforming.ttl"); | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
Sleep(1000); | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.XPath("//*[@fill='#a1e44d']"), 10); | ||
Assert.IsTrue(elements.Count == 2); | ||
}); | ||
|
||
public static readonly TestCase CheckRedWhenNotConforming = | ||
new TestCase( | ||
"Header turns red when there are conformance erros", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
Sleep(100); | ||
//Open data file | ||
driver.OpenDataFile("demo_data_non-conforming.ttl"); | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
Sleep(1000); | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.XPath("//*[@fill='#c10000']"), 10); | ||
Assert.IsTrue(elements.Count == 1); | ||
}); | ||
|
||
public static readonly TestCase CheckTimeForConformanceError = | ||
new TestCase( | ||
"Check that the time for the header turning red is less than 1000ms", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
Sleep(100); | ||
//Open data file | ||
Stopwatch stopwatch = new Stopwatch(); | ||
driver.OpenDataFile("demo_data_non-conforming.ttl"); | ||
var header = driver.FindElement(By.XPath("//*[@fill='#a1e44d']"), 10); | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
stopwatch.Start(); | ||
Sleep(200); | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.XPath("//*[@fill='#c10000']")); | ||
while(elements.Count == 0) | ||
{ | ||
elements = driver.FindElements(By.XPath("//*[@fill='#c10000']")); | ||
} | ||
stopwatch.Stop(); | ||
long time = stopwatch.ElapsedMilliseconds; | ||
Assert.IsTrue(elements.Count == 1); | ||
Assert.IsTrue(time < 1000); | ||
}); | ||
|
||
|
||
public static readonly TestCase CheckReportConforming = | ||
new TestCase( | ||
"No errors are reported when the data is conforming", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
Sleep(100); | ||
//Open data file | ||
driver.OpenDataFile("demo_data_conforming.ttl"); | ||
var header = driver.FindElement(By.XPath("//*[@fill='#a1e44d']"), 10); | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
Sleep(200); | ||
var conformanceButton = driver.FindElement(By.Id("conformance")); | ||
conformanceButton.Click(); | ||
Sleep(200); | ||
var conformanceReport = driver.FindElement(By.XPath("/html/body/div[2]/div/label"),10); | ||
Assert.IsTrue(conformanceReport.Text.Equals("No conformance errors")); | ||
|
||
|
||
}); | ||
|
||
public static readonly TestCase CheckReportNotConforming = | ||
new TestCase( | ||
"Errors are reported when data is not conforming", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
Sleep(100); | ||
//Open data file | ||
driver.OpenDataFile("demo_data_non-conforming.ttl"); | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
Sleep(200); | ||
var conformanceButton = driver.FindElement(By.Id("conformance")); | ||
conformanceButton.Click(); | ||
Sleep(200); | ||
var conformanceReport = driver.FindElement(By.XPath("//*[contains(text(),'The data value')]"), 10); | ||
Assert.IsTrue(conformanceReport.Text.Contains("The data value: http://example.com/ns#Bob,")); | ||
}); | ||
|
||
|
||
|
||
public static readonly ICollection<TestCase> All = | ||
new[] | ||
{ | ||
CheckGreenWhenConforming, | ||
CheckRedWhenNotConforming, | ||
CheckTimeForConformanceError, | ||
CheckReportConforming, | ||
CheckReportNotConforming | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using System.Collections.Generic; | ||
using OpenQA.Selenium; | ||
using System; | ||
using System.Windows.Forms; | ||
using static System.Diagnostics.Stopwatch; | ||
|
||
namespace SeleniumTests.Tests | ||
{ | ||
public static class EditGraphTests | ||
{ | ||
public static readonly TestCase DeleteSHACLShape = | ||
new TestCase( | ||
"SHACL shapes can be deleted", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
//Open a SHACL file | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
IWebElement shaclElement = driver.FindElement(By.XPath("//*[contains(text(),'PersonShape')]"), 10); | ||
String shaclElementID = shaclElement.GetAttribute("id"); | ||
shaclElement.Click(); | ||
SendKeys.SendWait("{DEL}"); | ||
System.Threading.Thread.Sleep(500); | ||
try | ||
{ | ||
|
||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.Id(shaclElementID)); | ||
Assert.IsTrue(elements.Count == 0); | ||
} | ||
catch (StaleElementReferenceException) { | ||
Assert.IsTrue(true); | ||
} | ||
}); | ||
|
||
public static readonly TestCase DeleteDataShape = | ||
new TestCase( | ||
"Data shapes can be deleted", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
//Open a SHACL file | ||
driver.OpenDataFile("demo_data_conforming.ttl"); | ||
var dataElement = driver.FindElement(By.XPath("//*[contains(text(),'Alice')]"), 10); | ||
String elementID = dataElement.GetAttribute("id"); | ||
dataElement.Click(); | ||
SendKeys.SendWait("{DEL}"); | ||
System.Threading.Thread.Sleep(500); | ||
try | ||
{ | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.Id(elementID)); | ||
Assert.IsTrue(elements.Count == 0); | ||
} | ||
catch (OpenQA.Selenium.StaleElementReferenceException) { | ||
Assert.IsTrue(true); | ||
} | ||
}); | ||
|
||
public static readonly TestCase DeleteSHACLProperty = | ||
new TestCase( | ||
"SHACL properties can be deleted", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
|
||
//Open a SHACL file | ||
driver.OpenSHACLFile("demo_shacl.ttl"); | ||
var shaclElement = driver.FindElement(By.XPath("//*[contains(text(),'sh:targetClass')]"), 10); | ||
String elementID = shaclElement.GetAttribute("id"); | ||
Assert.IsTrue(shaclElement.Text == "sh:targetClass : ex:Person"); | ||
//Element is selected | ||
shaclElement.Click(); | ||
SendKeys.SendWait("{DEL}"); | ||
System.Threading.Thread.Sleep(500); | ||
try | ||
{ | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.Id(elementID)); | ||
Assert.IsTrue(elements.Count == 0); | ||
} | ||
catch (OpenQA.Selenium.StaleElementReferenceException) | ||
{ | ||
Assert.IsTrue(true); | ||
} | ||
|
||
}); | ||
|
||
public static readonly TestCase DeleteDataAttribute= | ||
new TestCase( | ||
"SHACL properties can be deleted", | ||
(driver, log) => | ||
{ | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); | ||
//Log in | ||
driver.ByPassLogin(); | ||
|
||
//Open a SHACL file | ||
driver.OpenDataFile("demo_data_conforming.ttl"); | ||
var dataElement = driver.FindElement(By.XPath("//*[contains(text(),'Person')]"), 10); | ||
String elementID = dataElement.GetAttribute("id"); | ||
Assert.IsTrue(dataElement.Text.Contains("Person")); | ||
//Element is selected | ||
dataElement.Click(); | ||
SendKeys.SendWait("{DEL}"); | ||
System.Threading.Thread.Sleep(500); | ||
try | ||
{ | ||
IReadOnlyCollection<IWebElement> elements = driver.FindElements(By.Id(elementID)); | ||
Assert.IsTrue(elements.Count == 0); | ||
} | ||
catch (OpenQA.Selenium.StaleElementReferenceException) | ||
{ | ||
Assert.IsTrue(true); | ||
} | ||
|
||
}); | ||
|
||
public static readonly ICollection<TestCase> All = | ||
new[] | ||
{ | ||
DeleteSHACLShape, | ||
DeleteDataShape, | ||
DeleteSHACLProperty, | ||
DeleteDataAttribute | ||
}; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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"
.