61 lines
2.2 KiB
Java
61 lines
2.2 KiB
Java
package qualification;
|
|
|
|
import static qualification.WorkflowProbe.*;
|
|
|
|
import com.intellij.openapi.project.Project;
|
|
import com.intellij.openapi.vfs.LocalFileSystem;
|
|
import java.nio.file.*;
|
|
import javafx.embed.swing.SwingFXUtils;
|
|
import javafx.scene.control.*;
|
|
import javafx.scene.image.ImageView;
|
|
import javax.imageio.ImageIO;
|
|
|
|
/**
|
|
* Opens the production ArchiveWindow in the registered editor and selects its real document tabs.
|
|
*/
|
|
public final class DocumentTabsWorkflowProbe extends FormWorkflowProbe {
|
|
@Override
|
|
void verify(Project project) throws Exception {
|
|
var path =
|
|
Path.of(
|
|
project.getBasePath(), "src/main/resources/de/neitzel/archiver/ui/ArchiveWindow.fxml");
|
|
file = edt(() -> LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path));
|
|
pane = openDesigner(project, file);
|
|
click(pane, "Form preview");
|
|
click(pane, "Build and Refresh");
|
|
await(
|
|
() ->
|
|
fx(
|
|
() ->
|
|
((ComboBox<?>) pane.lookup("#preview-example"))
|
|
.getItems().stream()
|
|
.anyMatch(
|
|
item -> item.toString().contains("archive-window-documents"))));
|
|
choose("preview-example", "archive-window-documents");
|
|
await(
|
|
() ->
|
|
fx(
|
|
() -> {
|
|
var status = ((Label) pane.lookup("#preview-state")).getText();
|
|
if (status.startsWith("Preview failed") || status.startsWith("Preview blocked"))
|
|
throw new AssertionError(status);
|
|
return ((ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
|
&& status.contains("HTML-Dokumenttabs");
|
|
}));
|
|
step("Production ArchiveWindow rendered the document tabs");
|
|
fx(
|
|
() -> {
|
|
ImageIO.write(
|
|
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
|
|
"png",
|
|
output.resolve("intellij.png").toFile());
|
|
return null;
|
|
});
|
|
click(pane, "Interactive preview");
|
|
awaitTarget("document-tabs-result");
|
|
click(pane, "Stop preview");
|
|
Files.writeString(
|
|
output.resolve("SUCCESS.txt"), Files.readString(output.resolve("document-tabs-result")));
|
|
}
|
|
}
|