diff --git a/src/test/java/edu/kit/typicalc/view/ScreenshotIT.java b/src/test/java/edu/kit/typicalc/view/ScreenshotIT.java index caa5610..0454f1f 100644 --- a/src/test/java/edu/kit/typicalc/view/ScreenshotIT.java +++ b/src/test/java/edu/kit/typicalc/view/ScreenshotIT.java @@ -157,4 +157,35 @@ public class ScreenshotIT extends AbstractIT { assertTrue("Screenshot comparison for 'exportLatexWithAssumptions' (stage 3) failed", testBench().compareScreen("exportLatexWithAssumptions3")); } + + @Test + public void testScenario1() throws IOException { + InputBarElement inputBar = $(InputBarElement.class).first(); + String term = "λx. f x"; + inputBar.setCurrentValue(term); + + // check if the correct term is entered + Assert.assertEquals(term, inputBar.getCurrentValue()); + inputBar.typeInfer(); + + ControlPanelElement controlPanelElement = $(ControlPanelElement.class).first(); + + assertTrue(testBench().compareScreen("testScenario1_step0")); + controlPanelElement.nextStep(); + assertTrue(testBench().compareScreen("testScenario1_step1")); + controlPanelElement.nextStep(); + assertTrue(testBench().compareScreen("testScenario1_step2")); + controlPanelElement.nextStep(); + assertTrue(testBench().compareScreen("testScenario1_step3")); + controlPanelElement.nextStep(); + assertTrue(testBench().compareScreen("testScenario1_step4")); + controlPanelElement.previousStep(); + assertTrue(testBench().compareScreen("testScenario1_step3")); + controlPanelElement.previousStep(); + assertTrue(testBench().compareScreen("testScenario1_step2")); + controlPanelElement.firstStep(); + assertTrue(testBench().compareScreen("testScenario1_step0")); + controlPanelElement.lastStep(); + assertTrue(testBench().compareScreen("testScenario1_step4gi")); + } } diff --git a/src/test/java/edu/kit/typicalc/view/pageobjects/ControlPanelElement.java b/src/test/java/edu/kit/typicalc/view/pageobjects/ControlPanelElement.java index 285d455..43180f3 100644 --- a/src/test/java/edu/kit/typicalc/view/pageobjects/ControlPanelElement.java +++ b/src/test/java/edu/kit/typicalc/view/pageobjects/ControlPanelElement.java @@ -6,7 +6,19 @@ import com.vaadin.testbench.annotations.Attribute; @Attribute(name = "id", value = "control-panel") public class ControlPanelElement extends HorizontalLayoutElement { - + + public void firstStep() { + $(ButtonElement.class).get(1).click(); + } + + public void previousStep() { + $(ButtonElement.class).get(2).click(); + } + + public void nextStep() { + $(ButtonElement.class).get(3).click(); + } + public void lastStep() { $(ButtonElement.class).get(4).click(); } diff --git a/src/test/resources/screenshots/testScenario1_step0_linux_firefox_86.png b/src/test/resources/screenshots/testScenario1_step0_linux_firefox_86.png new file mode 100644 index 0000000..21697f3 Binary files /dev/null and b/src/test/resources/screenshots/testScenario1_step0_linux_firefox_86.png differ diff --git a/src/test/resources/screenshots/testScenario1_step1_linux_firefox_86.png b/src/test/resources/screenshots/testScenario1_step1_linux_firefox_86.png new file mode 100644 index 0000000..36beb02 Binary files /dev/null and b/src/test/resources/screenshots/testScenario1_step1_linux_firefox_86.png differ diff --git a/src/test/resources/screenshots/testScenario1_step2_linux_firefox_86.png b/src/test/resources/screenshots/testScenario1_step2_linux_firefox_86.png new file mode 100644 index 0000000..e5cf82a Binary files /dev/null and b/src/test/resources/screenshots/testScenario1_step2_linux_firefox_86.png differ diff --git a/src/test/resources/screenshots/testScenario1_step3_linux_firefox_86.png b/src/test/resources/screenshots/testScenario1_step3_linux_firefox_86.png new file mode 100644 index 0000000..8e3ef5c Binary files /dev/null and b/src/test/resources/screenshots/testScenario1_step3_linux_firefox_86.png differ diff --git a/src/test/resources/screenshots/testScenario1_step4_linux_firefox_86.png b/src/test/resources/screenshots/testScenario1_step4_linux_firefox_86.png new file mode 100644 index 0000000..234dc36 Binary files /dev/null and b/src/test/resources/screenshots/testScenario1_step4_linux_firefox_86.png differ