@Override public Object screenshot(String url, String description) { Screenshot screenshot = factory.createScreenshot(); screenshot.setUrl(url); screenshot.setDescription(description); return screenshot; }
@Override public Object comment(Object... comment) { Comment complexComment = factory.createComment(); for (Object c : comment) { complexComment.getContent().add(c); } complexComment.setType(Blockstyle.DEFAULT); return complexComment; }
@Override public Object link(String url, String description) { Link link = factory.createLink(); link.setUrl(url); link.setDescription(description); return link; }
@Override public Object textArea(String name, String content) { Textarea textarea = factory.createTextarea(); textarea.setName(name); textarea.setContent(content); return textarea; }
/** * Create action with specified name for webelement self. * * @param self - instance of class that support DescribedElement * @param name - name of returned Action * @return created Action instance */ protected Action getAction(DescribedElement self, String name) { Action action = factory.createAction(); action.setName(name); action.setWebelement((Webelement) element(self)); return action; }
@Override public Object element(DescribedElement element) { Webelement webelement = factory.createWebelement(); if (element != null && element.getDescription() != null) { webelement.setName(element.getDescription().getName()); webelement.setType(element.getDescription().getType()); } return webelement; }
@Override public Object screenshot(TakesScreenshot takesScreenshot, String description) { Screenshot screenshot = factory.createScreenshot(); screenshot.setDescription(description); File tempFile = takesScreenshot.getScreenshotAs(OutputType.FILE); File attachmentFile = null; try { attachmentFile = LogFileAttachment.getAttachmentFile("", "png"); FileUtils.copyFile(tempFile, attachmentFile); } catch (IOException e) { e.printStackTrace(); } if (attachmentFile != null) screenshot.setUrl(attachmentFile.getName()); return screenshot; }
@Override public Object comment(List<Object> comment) { Comment complexComment = factory.createComment(); for (Object c : comment) { complexComment.getContent().add(c); } complexComment.setType(Blockstyle.DEFAULT); return complexComment; }
@Override public Object comment(String comment) { Comment simpleComment = factory.createComment(); simpleComment.getContent().add(comment); simpleComment.setType(Blockstyle.DEFAULT); return simpleComment; }
@Override public Object comment(List<Object> comment, LogStyle style) { Comment complexComment = factory.createComment(); for (Object c : comment) { complexComment.getContent().add(c); } if (style == LogStyle.HIGHLIGHT) complexComment.setType(Blockstyle.HIGHLIGHT); else complexComment.setType(Blockstyle.DEFAULT); return complexComment; }
@Override public Object comment(String comment, LogStyle style) { Comment simpleComment = factory.createComment(); simpleComment.getContent().add(comment); if (style == LogStyle.HIGHLIGHT) simpleComment.setType(Blockstyle.HIGHLIGHT); else simpleComment.setType(Blockstyle.DEFAULT); return simpleComment; }