StepUtils(final Feature feature, final Scenario scenario) { this.lifecycle = Allure.getLifecycle(); this.feature = feature; this.scenario = scenario; }
/** * Adds attachment. * * @param name the name of attachment. * @param content the stream that contains attachment content. */ public static void attachment(final String name, final InputStream content) { addAttachment(name, content); }
public static CompletableFuture<byte[]> addByteAttachmentAsync( final String name, final String type, final Supplier<byte[]> body) { return addByteAttachmentAsync(name, type, "", body); }
public static CompletableFuture<InputStream> addStreamAttachmentAsync( final String name, final String type, final Supplier<InputStream> body) { return addStreamAttachmentAsync(name, type, "", body); }
/** * @deprecated use {@link #description(String)} instead. */ @Deprecated public static void addDescription(final String description) { description(description); }
@Override protected AllureLifecycle initialValue() { return Allure.getLifecycle(); } };
/** * Adds attachment. * * @param name the name of attachment. * @param content the attachment content. */ public static void attachment(final String name, final String content) { addAttachment(name, content); }
@Override protected AllureLifecycle initialValue() { return Allure.getLifecycle(); } };
private void takeScreenshot(WebDriver webDriver) throws IOException { File screenshotAs = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE); Allure.addAttachment("Screenshot", FileUtils.openInputStream(screenshotAs)); } }
@SuppressWarnings("unused") public AllureCucumber2Jvm() { this(Allure.getLifecycle()); }
private void takeScreenshot(WebDriver webDriver) throws IOException { File screenshotAs = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE); Allure.addAttachment("Screenshot", FileUtils.openInputStream(screenshotAs)); } }
@SuppressWarnings("unused") public AllureCucumberJvm() { this(Allure.getLifecycle()); }
public DefaultAttachmentProcessor() { this(Allure.getLifecycle()); }
public AllureCucumber3Jvm() { this(Allure.getLifecycle()); }
public AllureSelenide() { this(Allure.getLifecycle()); }
public AllureJunit4() { this(Allure.getLifecycle()); }
@SuppressWarnings("PMD.UseObjectForClearerAPI") public static void addAttachment(final String name, final String type, final String content, final String fileExtension) { getLifecycle().addAttachment(name, type, fileExtension, content.getBytes(StandardCharsets.UTF_8)); }
@SuppressWarnings("PMD.UseObjectForClearerAPI") public static void addAttachment(final String name, final String type, final InputStream content, final String fileExtension) { getLifecycle().addAttachment(name, type, fileExtension, content); }
public static CompletableFuture<byte[]> addByteAttachmentAsync( final String name, final String type, final String fileExtension, final Supplier<byte[]> body) { final String source = getLifecycle().prepareAttachment(name, type, fileExtension); return supplyAsync(body).whenComplete((result, ex) -> getLifecycle().writeAttachment(source, new ByteArrayInputStream(result))); }
public static void stepFinish() { getLifecycle().stopStep(STEP_UUID_STACK.get().removeFirst()); } }