Skip to content

Commit

Permalink
(#47) Added e2e testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
svettwer committed Jun 25, 2020
1 parent 60616f6 commit 5b87ee7
Show file tree
Hide file tree
Showing 13 changed files with 990 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .test/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.png
*.steps.cache
_logs/
3 changes: 3 additions & 0 deletions .test/e2e/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src
tsconfig.json
tsconfig.tsbuildinfo
31 changes: 31 additions & 0 deletions .test/e2e/e2e-suite/FryAnEgg/fryMe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(async () => {
const testCase = new TestCase("Fry an egg");
const url = "https://sakuli.io/e2e-pages/fryed-egg";
const screen = new Region();
const env = new Environment();
try {
await _navigateTo(url);
await _highlight(_heading1(/LET'S FRY AN EGG/), 2000);
await env.setSimilarity(0.95);
await screen
.find("source_egg.png")
.highlight(1)
.mouseMove()
.mouseDown(MouseButton.LEFT);
await testCase.endOfStep("Search egg");
await env.setSimilarity(0.6);
await screen
.find("target_pan.png")
.highlight(1)
.mouseMove()
.mouseUp(MouseButton.LEFT);
await testCase.endOfStep("Drop egg");
await new Region(0, 0, 10, 10).highlight(1).mouseMove();
await screen.waitForImage("result.png", 5).highlight(1);
await testCase.endOfStep("Check result");
} catch (e) {
await testCase.handleException(e);
} finally {
await testCase.saveResult();
}
})();
Binary file added .test/e2e/e2e-suite/FryAnEgg/result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .test/e2e/e2e-suite/FryAnEgg/source_egg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .test/e2e/e2e-suite/FryAnEgg/target_pan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions .test/e2e/e2e-suite/FryAnEgg/typedEgg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(async () => {
const testCase = new TestCase("Fry a typed egg");
const url = "https://sakuli.io/e2e-pages/fryed-egg";
const screen = new Region();
const env = new Environment();
try {
await _navigateTo(url);
await _highlight(_heading1(/LET'S FRY AN EGG/), 2000);
await env.setSimilarity(0.95);
await screen
.find("source_egg.png")
.highlight(1)
.mouseMove()
.mouseDown(MouseButton.LEFT);
await testCase.endOfStep("Search egg");
await env.setSimilarity(0.6);
await screen
.find("target_pan.png")
.highlight(1)
.mouseMove()
.mouseUp(MouseButton.LEFT);
await testCase.endOfStep("Drop egg");
await new Region(0, 0, 10, 10).highlight(1).mouseMove();
await screen.waitForImage("result.png", 5).highlight(1);
await testCase.endOfStep("Check result");
} catch (e) {
await testCase.handleException(e);
} finally {
await testCase.saveResult();
}
})();
4 changes: 4 additions & 0 deletions .test/e2e/e2e-suite/testsuite.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testsuite.id=integrationtest
testsuite.browser=chrome
log.level=debug
selenium.chrome.arguments=--incognito --disable-dev-shm-usage --no-sandbox
2 changes: 2 additions & 0 deletions .test/e2e/e2e-suite/testsuite.suite
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FryAnEgg/fryMe.js https://sakuli.io
FryAnEgg/typedEgg.ts https://sakuli.io
Loading

0 comments on commit 5b87ee7

Please sign in to comment.