Skip to content
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

Added script to support video recording add to extent report #231

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mdsapon
Copy link
Collaborator

@mdsapon mdsapon commented Jun 2, 2021

No description provided.

@mdsapon mdsapon linked an issue Jun 2, 2021 that may be closed by this pull request
@@ -101,6 +101,8 @@
<sonar.projectKey>dougnoel_sentinel</sonar.projectKey>
<sonar.organization>dougnoel</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<screen-recorder.version>0.7.7.0</screen-recorder.version>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this up to line 100 with the rest of the version numbers.

@Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elementName will never contain "not"

Suggested change
@Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$")
@Then("^video recording was( not)? attached to the report?$")

@Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$")
public static void addVideoToReport(String elementName, String assertion) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static void addVideoToReport(String elementName, String assertion) {
public static void addVideoToReport(String assertion) {

@Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$")
public static void addVideoToReport(String elementName, String assertion) {
if(Configuration.toString("addVideoToReport")!=null && !elementName.contains("not"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the step exists, you shouldn't have to turn it on in the commandline. Ideally this would happen whether there was a cucumber step or not by adding it to the after step for each method.

Suggested change
if(Configuration.toString("addVideoToReport")!=null && !elementName.contains("not"))
if(Configuration.toString("addVideoToReport")!=null && !assertion.contains("not"))

if(Configuration.toString("addVideoToReport")!=null && !elementName.contains("not"))
ExtentCucumberAdapter.addTestStepLog("<a href='"+System.getProperty("user.dir")+"\\reports\\extent-cucumber.avi'>Click to see video recording</a>");

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete extra line

Then I verify the Error Message contains the text "Sorry, this user has been locked out."
And video recording was not attached to the report

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete extra line

@@ -13,10 +13,13 @@ Feature: 47 Swag Labs Login
And I click the Login Button
Then I am redirected to the Sauce Demo Main Page
And I verify the App Logo exists
And video recording was attached to the report
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if you can add a @record tag at the top of this scenario and then read it in the @after step in the TestRunner instead of doing a Cucumber step here.

@BeforeClass
public static void setUpBeforeClass() {
WebDriverFactory.instantiateWebDriver();
if(Configuration.toString("addVideoToReport")!=null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in a @before step that will run before each Scenario, and then see if you can read a @record tag for the Cucumber step to turn this on. Then this would be on if either the addVideoToReport option is on OR a scenario is tagged AND the record is not explicitly set to off.

If @record tag exists and addVideoToReport is not set (null) = record
If @record tag doesn't exist and addVideoToReport is set true = record
If @record tag exists and addVideoToReport is set true = record
If @record tag exists and addVideoToReport is set off/false = DON'T record
Else = DON'T record

@@ -36,5 +42,7 @@ public static void tearDownAfterClass() throws SentinelException {
if (System.getProperty("leaveBrowserOpen", "false") == "false") {
PageManager.quit();
}
if(Configuration.toString("addVideoToReport")!=null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to an @after method as I mentioned in previous comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Screen Recording
2 participants