@Override public Object link(String url, String description) { Link link = factory.createLink(); link.setUrl(url); link.setDescription(description); return link; }
@Override public String doRender(Object o) { if (!(o instanceof Screenshot)) return null; Screenshot screenshot = (Screenshot) o; return "Screenshot" + " -> " + screenshot.getUrl(); }
/** * Create an instance of {@link Webelement } * */ public Webelement createWebelement() { return new Webelement(); }
@Override public Object screenshot(String url, String description) { Screenshot screenshot = factory.createScreenshot(); screenshot.setUrl(url); screenshot.setDescription(description); return screenshot; }
@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 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 String doRender(Object o) { if (!(o instanceof Comment)) return null; Comment comment = (Comment) o; StringBuilder builder = new StringBuilder(); builder.append("Comment" + " -> "); for (Object c : comment.getContent()) { if(c instanceof String) { builder.append((String)c); } if(c instanceof Textarea) { builder.append(((Textarea)c).getName()); } if(c instanceof Screenshot) { builder.append("Screenshot" + " [" + ((Screenshot)c).getUrl() + "]"); } builder.append("; "); } return builder.toString(); }
@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 String doRender(Object o) { if (!(o instanceof Link)) return null; Link link = (Link) o; if (link.getDescription() == null || link.getDescription().equals("")) return "Link -> " + link.getUrl(); else if (link.getDescription().equals(link.getUrl())) return "Link -> " + link.getUrl(); else return link.getDescription() + " -> " + link.getUrl(); }
/** * Create an instance of {@link Action } * */ public Action createAction() { return new Action(); }
/** * Create an instance of {@link Screenshot } * */ public Screenshot createScreenshot() { return new Screenshot(); }
/** * Create an instance of {@link Textarea } * */ public Textarea createTextarea() { return new Textarea(); }
/** * Create an instance of {@link Comment } * */ public Comment createComment() { return new Comment(); }
/** * Create an instance of {@link Link } * */ public Link createLink() { return new Link(); }
@Override public String doRender(Object o) { if (!(o instanceof Textarea)) return null; Textarea textarea = (Textarea) o; StringBuilder builder = new StringBuilder(); builder.append("TextArea" + " -> " + textarea.getName()); return builder.toString(); }
@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 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, 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; }
@Override public Object comment(String comment) { Comment simpleComment = factory.createComment(); simpleComment.getContent().add(comment); simpleComment.setType(Blockstyle.DEFAULT); return simpleComment; }