static X getScreenshotToWorkspace()

in src/main/java/com/microsoft/appcenter/appium/DriverHelper.java [15:37]


    static <X> X getScreenshotToWorkspace(Object result, OutputType<X> outputType, java8.util.function.Consumer<Path> reporter) {
        if (result instanceof String) {
            String base64EncodedPng = (String) result;
            File file = OutputType.FILE.convertFromBase64Png(base64EncodedPng);
            Path target = copyToWorkspace(file);

            reporter.accept(target);

            return outputType.convertFromBase64Png(base64EncodedPng);
        } else if (result instanceof byte[]) {
            byte[] buffer = (byte[]) result;
            File file = OutputType.FILE.convertFromPngBytes(buffer);
            Path target = copyToWorkspace(file);

            reporter.accept(target);

            return outputType.convertFromPngBytes(buffer);
        } else {
            throw new RuntimeException(String.format("Unexpected result for %s command: %s",
                    DriverCommand.SCREENSHOT,
                    result == null ? "null" : result.getClass().getName() + " instance"));
        }
    }