-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add video display in tests #400
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f608606
Add video display in tests
grass-hopper-moc 7db89aa
Resolve conflicts
anshooarora 549e296
Fix tests
anshooarora 42f25ca
Fix template spacing (for minify)
anshooarora bb9937d
Fix GherkinDialect related tests
anshooarora d460ce8
Update maven.yml (remove update dependency graph)
anshooarora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/aventstack/extentreports/append/MediaTypeAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.aventstack.extentreports.append; | ||
|
||
import java.io.IOException; | ||
|
||
import com.aventstack.extentreports.model.Media; | ||
import com.aventstack.extentreports.model.service.MediaService; | ||
import com.google.gson.TypeAdapter; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonToken; | ||
import com.google.gson.stream.JsonWriter; | ||
|
||
public class MediaTypeAdapter extends TypeAdapter<Media> { | ||
|
||
@Override | ||
public void write(JsonWriter out, Media value) throws IOException { | ||
} | ||
|
||
@Override | ||
public Media read(JsonReader reader) throws IOException { | ||
reader.beginObject(); | ||
String fieldName = null; | ||
int cycle = 0; | ||
|
||
String type = null; | ||
String path = null; | ||
String resolvedPath = null; | ||
String title = null; | ||
String base64 = null; | ||
|
||
while (reader.hasNext()) { | ||
JsonToken token = reader.peek(); | ||
if (token.equals(JsonToken.NAME)) { | ||
fieldName = reader.nextName(); | ||
} | ||
if ("string".equalsIgnoreCase(token.name()) && fieldName.equalsIgnoreCase("type")) { | ||
token = reader.peek(); | ||
type = reader.nextString(); | ||
} | ||
if ("string".equalsIgnoreCase(token.name()) && fieldName.equalsIgnoreCase("path")) { | ||
token = reader.peek(); | ||
path = reader.nextString(); | ||
} | ||
if ("string".equalsIgnoreCase(token.name()) && fieldName.equalsIgnoreCase("resolvedPath")) { | ||
token = reader.peek(); | ||
resolvedPath = reader.nextString(); | ||
} | ||
if ("string".equalsIgnoreCase(token.name()) && fieldName.equalsIgnoreCase("title")) { | ||
token = reader.peek(); | ||
title = reader.nextString(); | ||
} | ||
if ("string".equalsIgnoreCase(token.name()) && fieldName.equalsIgnoreCase("base64")) { | ||
token = reader.peek(); | ||
base64 = reader.nextString(); | ||
} | ||
if (cycle++ > 10) | ||
return MediaService.createMedia(type, path, resolvedPath, title, base64); | ||
} | ||
reader.endObject(); | ||
return MediaService.createMedia(type, path, resolvedPath, title, base64); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/aventstack/extentreports/model/Video.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.aventstack.extentreports.model; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class Video extends Media implements Serializable { | ||
private static final long serialVersionUID = -6874043323709622353L; | ||
|
||
public static final String BASE64_ENCODED = "data:video/mp4;base64,"; | ||
|
||
private String base64; | ||
|
||
@Builder | ||
public Video(String path, String title, String resolvedPath, String base64) { | ||
super(MediaType.VIDEO, path, title, resolvedPath, new HashMap<String, Object>()); | ||
this.base64 = base64; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing tests for this :)