Added script to support video recording add to extent report#231
Added script to support video recording add to extent report#231
Conversation
| <sonar.organization>dougnoel</sonar.organization> | ||
| <sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
|
|
||
| <screen-recorder.version>0.7.7.0</screen-recorder.version> |
There was a problem hiding this comment.
Move this up to line 100 with the rest of the version numbers.
| } | ||
|
|
||
| } No newline at end of file | ||
| @Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$") |
There was a problem hiding this comment.
elementName will never contain "not"
| @Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$") | |
| @Then("^video recording was( not)? attached to the report?$") |
|
|
||
| } No newline at end of file | ||
| @Then("^video recording (.*?)( was not)?(?: was)? attached to the report?$") | ||
| public static void addVideoToReport(String elementName, String assertion) { |
There was a problem hiding this comment.
| public static void addVideoToReport(String elementName, String assertion) { | |
| public static void addVideoToReport(String assertion) { |
| } No newline at end of file | ||
| @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")) |
There was a problem hiding this comment.
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.
| if(Configuration.toString("addVideoToReport")!=null && !elementName.contains("not")) | |
| if(Configuration.toString("addVideoToReport")!=null && !assertion.contains("not")) |
| public static void addVideoToReport(String elementName, String assertion) { | ||
| 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>"); | ||
|
|
| Then I verify the Error Message contains the text "Sorry, this user has been locked out." No newline at end of file | ||
| 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 | ||
|
No newline at end of file |
| 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 |
| @BeforeClass | ||
| public static void setUpBeforeClass() { | ||
| WebDriverFactory.instantiateWebDriver(); | ||
| if(Configuration.toString("addVideoToReport")!=null) |
There was a problem hiding this comment.
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
| if (System.getProperty("leaveBrowserOpen", "false") == "false") { | ||
| PageManager.quit(); | ||
| } | ||
| if(Configuration.toString("addVideoToReport")!=null) |
There was a problem hiding this comment.
Move this to an @after method as I mentioned in previous comments.
No description provided.