mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Szenario mit Permlaink IT
This commit is contained in:
parent
b058ee037c
commit
c2475d4983
@ -15,6 +15,7 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
@CssImport("./styles/view/share-dialog.css")
|
||||
public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
||||
|
||||
private static final String SHARE_DIALOG_ID = "shareDialog";
|
||||
private static final String LAYOUT_ID = "share-dialog-layout";
|
||||
private static final String FIELD_CLASS = "share-dialog-field";
|
||||
|
||||
@ -36,6 +37,7 @@ public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
||||
VerticalLayout layout = new VerticalLayout();
|
||||
layout.setId(LAYOUT_ID);
|
||||
add(layout);
|
||||
setId(SHARE_DIALOG_ID);
|
||||
|
||||
heading = new H3();
|
||||
urlField = new TextField();
|
||||
|
@ -4,18 +4,14 @@ import com.vaadin.flow.component.button.testbench.ButtonElement;
|
||||
import com.vaadin.flow.component.orderedlayout.testbench.HorizontalLayoutElement;
|
||||
import com.vaadin.testbench.Parameters;
|
||||
import com.vaadin.testbench.commands.TestBenchCommandExecutor;
|
||||
|
||||
import edu.kit.typicalc.view.pageobjects.ControlPanelElement;
|
||||
import edu.kit.typicalc.view.pageobjects.ExampleDialogElement;
|
||||
import edu.kit.typicalc.view.pageobjects.InputBarElement;
|
||||
import edu.kit.typicalc.view.pageobjects.TypeAssumptionFieldElement;
|
||||
import edu.kit.typicalc.view.pageobjects.TypeAssumptionsAreaElement;
|
||||
import edu.kit.typicalc.view.pageobjects.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* This example contains usage examples of screenshot comparison feature.
|
||||
@ -24,6 +20,7 @@ import static org.junit.Assert.*;
|
||||
public class ScreenshotIT extends AbstractIT {
|
||||
|
||||
private static final String IDENTITY_TERM = "λx.x";
|
||||
private static final String LET_TERM = "let f = λx. g y y in f 3";
|
||||
|
||||
/**
|
||||
* We'll want to perform some additional setup functions, so we override the
|
||||
@ -76,6 +73,42 @@ public class ScreenshotIT extends AbstractIT {
|
||||
testBench().compareScreen("identityView"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createPermalink() throws IOException {
|
||||
InputBarElement inputBar = $(InputBarElement.class).first();
|
||||
inputBar.setCurrentValue(LET_TERM);
|
||||
|
||||
assertEquals(LET_TERM, inputBar.getCurrentValue());
|
||||
|
||||
inputBar.typeInfer();
|
||||
TestBenchCommandExecutor executor = getCommandExecutor();
|
||||
executor.waitForVaadin();
|
||||
|
||||
assertTrue("Screenshot comparison for 'letView' failed, see "
|
||||
+ Parameters.getScreenshotErrorDirectory()
|
||||
+ " for error images",
|
||||
testBench().compareScreen("letView"));
|
||||
|
||||
ControlPanelElement control = $(ControlPanelElement.class).waitForFirst();
|
||||
control.openShareDialog();
|
||||
executor.waitForVaadin();
|
||||
|
||||
assertTrue("Screenshot comparison for 'letShareDialog' failed, see "
|
||||
+ Parameters.getScreenshotErrorDirectory()
|
||||
+ " for error images",
|
||||
testBench().compareScreen("letShareDialog"));
|
||||
|
||||
ShareDialogElement shareDialogElement = $(ShareDialogElement.class).waitForFirst();
|
||||
String permalink = shareDialogElement.getPermalink();
|
||||
getDriver().get(permalink);
|
||||
|
||||
assertTrue("Screenshot comparison for 'letView' from permalink failed, see "
|
||||
+ Parameters.getScreenshotErrorDirectory()
|
||||
+ " for error images",
|
||||
testBench().compareScreen("letView"));
|
||||
// TODO: jeden Schritt durchgehen?
|
||||
}
|
||||
|
||||
@Test
|
||||
public void chooseExample() throws IOException {
|
||||
InputBarElement inputBar = $(InputBarElement.class).first();
|
||||
|
@ -0,0 +1,22 @@
|
||||
package edu.kit.typicalc.view.pageobjects;
|
||||
|
||||
import com.vaadin.flow.component.dialog.testbench.DialogElement;
|
||||
import com.vaadin.flow.component.orderedlayout.testbench.VerticalLayoutElement;
|
||||
import com.vaadin.flow.component.textfield.testbench.TextFieldElement;
|
||||
import com.vaadin.testbench.annotations.Attribute;
|
||||
|
||||
/**
|
||||
* Vaadin TestBench element for {@link edu.kit.typicalc.view.content.typeinferencecontent.ShareDialog}.
|
||||
*/
|
||||
@Attribute(name = "id", value = "shareDialog")
|
||||
public class ShareDialogElement extends DialogElement {
|
||||
|
||||
/**
|
||||
* Get the permalink in the share dialog.
|
||||
*
|
||||
* @return the permalink
|
||||
*/
|
||||
public String getPermalink() {
|
||||
return $(VerticalLayoutElement.class).first().$(TextFieldElement.class).first().getValue();
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 147 KiB |
BIN
src/test/resources/screenshots/letView_linux_firefox_86.png
Normal file
BIN
src/test/resources/screenshots/letView_linux_firefox_86.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
Loading…
Reference in New Issue
Block a user