-
-
Notifications
You must be signed in to change notification settings - Fork 521
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 the video name of selenoid to the report. #2625
Comments
You will need to write a plugin for Selenoid, similar to the browserstack or saucelabs ones. Implement the BeforeAWebdriverSession and/or AfterAWebdriverSession classes use the s.g.
The Once you have a working plugin, you can propose a PR. |
I will try to complete it and then submit a PR thank you very much. |
Dear wakaleo : I read your suggestion and implemented the function I want with the following code. import net.thucydides.core.model.ExternalLink;
import net.thucydides.core.model.TestOutcome;
import net.thucydides.core.steps.StepEventBus;
import net.thucydides.core.webdriver.DriverSource;
import org.apache.commons.lang.StringUtils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.MalformedURLException;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
public class SelenoidRemoteDriver implements DriverSource {
private static final Logger LOGGER = LoggerFactory.getLogger(SelenoidRemoteDriver.class);
@Override
public WebDriver newDriver() {
System.out.println("***********Selenoid remote driver is starting************");
String remoteURL = "";
DesiredCapabilities capabilities = new DesiredCapabilities();
// set selenoid video name
try {
// date (2021-12-07)
String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
StepEventBus eventBus = StepEventBus.getEventBus();
TestOutcome currentTestOutcome = eventBus.getBaseStepListener().getCurrentTestOutcome();
// story file name
String prefix = currentTestOutcome.getUserStory().getId();
// story name (first row in file)
// currentTestOutcome.getUserStory().getName();
// suffix (scenario1)
String suffix = "";
String title = currentTestOutcome.getTitle();
if (StringUtils.isNotBlank(title) && Pattern.matches("scenario(\\d+)-(.*)", title)){
suffix = title.split("-")[0];
}
// stitched video name
String videoName = String.format("%s %s %s.mp4",date,prefix,suffix);
capabilities.setCapability("videoName", videoName);
String videoUrl= "http://IP:8080/video/" + videoName;
currentTestOutcome.setLink(new ExternalLink(videoUrl, "BrowserStack"));
LOGGER.info("set video name {}",videoName);
} catch (Exception e) {
LOGGER.error("Fail to get video name. ",e);
}
RemoteWebDriver driver = null;
try {
driver = new RemoteWebDriver( URI.create(remoteURL).toURL(), capabilities ); }
catch (MalformedURLException e) { // TODO Auto-generated
e.printStackTrace(); }
return driver;
}
@Override
public boolean takesScreenshots() {
// TODO Auto-generated method stub
return false;
}
}
I don't know what the meaning of the plug-in you suggest is, if you can make me the meaning of the plug-in, I would be happy to implement it and submit a PR. I would love to do something for serenity. Thank you so much for your suggestion. |
I need add selenoid video to serenity report.
I find a space to add the video link but I do not know how add and when to add the video link.
I get selenoid video name before story start.
can you help me?
If you need any information please tell me, Thank you.
The text was updated successfully, but these errors were encountered: