Files
NeitzelFXDesigner/integration-tests/idea/FolderProfilesWorkflowProbe.java
T

110 lines
4.3 KiB
Java

package qualification;
import static qualification.WorkflowProbe.*;
import com.intellij.openapi.project.Project;
import java.nio.file.Files;
import java.util.List;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.control.*;
import javax.imageio.ImageIO;
/** Saves profile bindings and column declarations in the registered FolderTab editor. */
public final class FolderProfilesWorkflowProbe extends DeclarationWorkflowProbe {
@Override
void verify(Project project) throws Exception {
this.project = project;
open("FolderTab");
build("folder-actions");
interactive("folder-actions", "profiles");
interactive("folder-readonly", "readonly");
interactive("folder-metadata", "metadata");
for (var id : List.of("saveProfile", "clearLayout", "manageProfiles")) commands(id, id, 4);
commands("saveProfile", "saveProfile", 4);
click(pane, "Discover / Validate Commands");
await(
() ->
fx(
() ->
((Label) pane.lookup("#command-status"))
.getText()
.contains("No detected binding errors.")));
fx(
() -> {
var choices =
pane.lookup("#command-path").getParent().getChildrenUnmodifiable().stream()
.filter(
n -> Integer.valueOf(1).equals(javafx.scene.layout.GridPane.getRowIndex(n)))
.filter(ComboBox.class::isInstance)
.map(ComboBox.class::cast)
.filter(
box ->
box.getItems()
.containsAll(List.of("manageProfiles", "saveProfile", "clearLayout")))
.findFirst()
.orElseThrow();
choices.getSelectionModel().select("manageProfiles");
return null;
});
click(pane, "Apply Command binding");
String bound = "control=\"saveProfile\" path=\"manageProfiles\"";
await(() -> source().contains(bound));
inspector(true);
select("DataGridColumn", "mailSent");
applySetting("id", "versand");
select("DataGridColumn", "bookTitle");
combo("declaration-property", "attribute");
choose("declaration-value", "bookPublisher");
edit("Apply setting", "attribute=\"bookPublisher\"");
applySetting("header", "Buchverlag");
reopen("FolderTab", "header=\"Buchverlag\"");
if (!source().contains(bound) || !source().contains("attribute=\"mailSent\""))
throw new AssertionError(source());
build("folder-actions");
choose("preview-example", "folder-actions");
await(
() ->
fx(
() ->
((Label) pane.lookup("#preview-state"))
.getText()
.contains("Suche und Anzeigeprofile")
&& ((javafx.scene.image.ImageView) pane.lookup("#full-preview-image"))
.getImage()
!= null));
commands("saveProfile", "manageProfiles", 4);
fx(
() -> {
ImageIO.write(
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
"png",
output.resolve("intellij.png").toFile());
return null;
});
interactive("folder-actions", "rebound");
interactive("folder-metadata", "renamed");
for (String invalid : List.of("keinFeld", "bookPublisher")) {
inspector(true);
select("DataGridColumn", "versand");
applySetting("attribute", invalid);
click(pane, "Form preview");
click(pane, "Render drafts");
await(
() ->
fx(
() -> {
var message = ((Label) pane.lookup("#preview-state")).getText();
return message.contains("versand")
&& message.contains(invalid)
&& message.contains(
invalid.equals("keinFeld") ? "unbekanntes Zeilenattribut" : "INTEGER");
}));
step("Preview diagnosed " + invalid + " on INTEGER column versand");
click(pane, "Undo");
await(() -> source().contains("attribute=\"mailSent\""));
}
interactive("folder-metadata", "recovered");
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
}
}