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

Add video tab #407

Merged
merged 16 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/src/docs/reports/testdetails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ Below this section different tab panes provide more information:
* Sessions - a tab pane which shows the web driver sessions with its capabilities when a web driver session was active.
* Dependencies - a tab pane that shows the dependencies of this test case in case there are any.

== Sessions tab pane
== Browser Info tab pane

image::report-ng-09.png[align="left", alt="Webdriver Sessions"]

== Video tab pane

NOTE: If you are using the (link:https://github.com/telekom/testerra-selenoid-connector[Testerra Selenoid connector]) and a (link:https://github.com/aerokube/selenoid[Selenoid grid]), you can add recorded video streams to your report.

image::report-ng-26.png[align="left", alt="Video tab pane"]

== Dependencies tab pane

image::report-ng-10.png[align="left", alt="Webdriver Sessions"]
Binary file modified docs/src/images/report-ng-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-22.png
selinanatschke-mms marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/images/report-ng-26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/images/report-ng-collected-assertions-01.png
selinanatschke-mms marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public abstract class AbstractReportMethodPage extends AbstractReportPage {
private final UiElement testThreadLink = testMethodCard.find(By.xpath("//li[.//span[contains(text(), 'Thread')]]//a"));
@Check
private final UiElement testStepsTab = testTabBar.find(By.xpath("//mdc-tab[.//span[@class='mdc-tab__text-label' and contains(text(),'Steps')]]"));
private final UiElement testSessionsTab = testTabBar.find(By.xpath("//mdc-tab[.//span[@class='mdc-tab__text-label' and contains(text(),'Sessions')]]"));
private final UiElement testBrowserInfoTab = testTabBar.find(By.xpath("//mdc-tab[.//span[@class='mdc-tab__text-label' and contains(text(),'Browser Info')]]"));
private final UiElement testVideoTab = testTabBar.find(By.xpath("//mdc-tab[.//span[@class='mdc-tab__text-label' and contains(text(),'Video')]]"));

protected final UiElement testLastScreenshot = pageContent.find(By.xpath("//mdc-card[contains(.,'Last Screenshot')]//img"));

Expand All @@ -70,9 +71,14 @@ public ReportStepsTab navigateToStepsTab() {
return createPage(ReportStepsTab.class);
}

public ReportSessionsTab navigateToSessionsTab() {
testSessionsTab.click();
return createPage(ReportSessionsTab.class);
public ReportBrowserInfoTab navigateToBrowserInfoTab() {
testBrowserInfoTab.click();
return createPage(ReportBrowserInfoTab.class);
}

public ReportVideoTab navigateToVideoTab() {
testVideoTab.click();
return createPage(ReportVideoTab.class);
}

private void assertMethodNamesAreCorrect(String methodName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class ReportSessionsTab extends AbstractReportMethodPage {
public class ReportBrowserInfoTab extends AbstractReportMethodPage {

@Check
private final UiElement sessionCard = tabPagesContent.find(By.tagName("mdc-layout-grid-cell"));
private final UiElement sessionCard = tabPagesContent.find(By.tagName("mdc-card"));
@Check
private final UiElement headline = sessionCard.find(By.xpath("//*[contains(text(),'Session')]"));
private final UiElement headline = sessionCard.find(By.xpath("//*[contains(@class, 'card-headline') and contains(text(),'Session')]"));
@Check
private final UiElement id = sessionCard.find(By.xpath("/ul//span[contains(text(),'ID')]"));
private final UiElement id = sessionCard.find(By.xpath("//ul//span[contains(text(),'ID')]"));
@Check
private final UiElement browser = sessionCard.find(By.xpath("//li[./span[contains(text(), 'Browser')]]"));
@Check
private final UiElement userAgent = sessionCard.find(By.xpath("//li[./span[contains(text(), 'User') and contains(text(), 'agent')]]"));
private final UiElement node = sessionCard.find(By.xpath("/ul//span[contains(text(),'Node')]"));
@Check
private final UiElement capabilityHeadline = sessionCard.find(By.xpath("/div[contains(text(),'Capabilities')]"));
private final UiElement capabilityHeadline = sessionCard.find(By.xpath("//div[contains(text(),'Capabilities')]"));
@Check
private final UiElement capabilities = sessionCard.find(By.xpath("/div[contains(@class,'capabilities-view')]"));
private final UiElement capabilities = sessionCard.find(By.xpath("//div[contains(@class,'capabilities-view')]"));

public ReportSessionsTab(WebDriver driver) {
public ReportBrowserInfoTab(WebDriver driver) {
super(driver);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Testerra
*
* (C) 2022, Marc Dietrich, T-Systems Multimedia Solutions GmbH, Deutsche Telekom AG
*
* Deutsche Telekom AG and all other contributors /
* copyright owners license this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

package io.testerra.report.test.pages.report.methodReport;


import eu.tsystems.mms.tic.testframework.pageobjects.Check;
import eu.tsystems.mms.tic.testframework.pageobjects.UiElement;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class ReportVideoTab extends AbstractReportMethodPage {

@Check
private final UiElement videoCard = tabPagesContent.find(By.tagName("mdc-card"));
private final UiElement headline = videoCard.find(By.xpath("//*[contains(@class, 'card-headline') and contains(text(),'Session')]"));
@Check
private final UiElement id = videoCard.find(By.xpath("//ul//span[contains(text(),'ID')]"));
@Check
private final UiElement browser = videoCard.find(By.xpath("//li[./span[contains(text(), 'Browser')]]"));
@Check
private final UiElement video = videoCard.find(By.xpath("//video"));

public ReportVideoTab(WebDriver driver) {
super(driver);
}

public void validateBrowser(String browser) {
this.browser.assertThat().text().contains(browser);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use isContaining() or contains(id).is(true)

}

public void checkSessionId(String id){
this.id.assertThat().text().contains(id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use isContaining() or contains(id).is(true)

}

public void checkVideo(){
this.video.assertThat().displayed();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.testerra.report.test.pretest_status.pageTests;

import eu.tsystems.mms.tic.testframework.common.Testerra;
import eu.tsystems.mms.tic.testframework.logging.Loggable;
import eu.tsystems.mms.tic.testframework.report.model.context.SessionContext;
import eu.tsystems.mms.tic.testframework.report.model.context.Video;
import eu.tsystems.mms.tic.testframework.report.utils.IExecutionContextController;
import io.testerra.report.test.AbstractTestSitesTest;
import io.testerra.report.test.pages.TestPage;
import io.testerra.report.test.pages.pretest.CheckPages.OptionalCheckPage;
Expand Down Expand Up @@ -91,4 +95,15 @@ public void preTest09_priorityMessagesGlobalContentTest() {
new Thread(() -> log().error("Tell me more!", Loggable.prompt)).start();
}

@Test(groups = {Groups.EXT})
public void preTest10_videoTest_passed(){
IExecutionContextController instance = Testerra.getInjector().getInstance(IExecutionContextController.class);
WEB_DRIVER_MANAGER.getWebDriver();
SessionContext sessionContext = instance.getCurrentSessionContext().get();
sessionContext.setVideo(new Video());
WEB_DRIVER_MANAGER.getWebDriver("new session");
SessionContext sessionContext2 = instance.getCurrentSessionContext().get();
sessionContext2.setVideo(new Video());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@

import eu.tsystems.mms.tic.testframework.report.model.steps.TestStep;

import io.testerra.report.test.pages.report.methodReport.ReportBrowserInfoTab;
import org.testng.annotations.Test;

import io.testerra.report.test.AbstractReportTest;
import io.testerra.report.test.pages.ReportSidebarPageType;
import io.testerra.report.test.pages.report.methodReport.ReportDetailsTab;
import io.testerra.report.test.pages.report.methodReport.ReportSessionsTab;
import io.testerra.report.test.pages.report.sideBarPages.ReportDashBoardPage;
import io.testerra.report.test.pages.report.sideBarPages.ReportTestsPage;

public class ReportSessionsTabTest extends AbstractReportTest {
public class ReportBrowserInfoTabTest extends AbstractReportTest {

@Test
public void testT01_checkDisplayedSessionGotContent() {
String preTestWithSessionTab = "test_Failed_WithScreenShot";
public void testT01_checkDisplayedBrowserInfoGotContent() {
String preTestWithBrowserInfoTab = "test_Failed_WithScreenShot";
String usedBrowser = "Chrome";

TestStep.begin("Navigate to dashboard page.");
Expand All @@ -46,10 +46,10 @@ public void testT01_checkDisplayedSessionGotContent() {
TestStep.begin("Navigate to tests page.");
ReportTestsPage reportTestsPage = reportDashBoardPage.gotoToReportPage(ReportSidebarPageType.TESTS, ReportTestsPage.class);

TestStep.begin("Navigate to method sessions page and check for correct content");
TestStep.begin("Navigate to method browser info page and check for correct content");
reportTestsPage = reportTestsPage.clickConfigurationMethodsSwitch();
ReportDetailsTab reportDetailsTab = reportTestsPage.navigateToDetailsTab(preTestWithSessionTab);
ReportSessionsTab reportSessionsTab = reportDetailsTab.navigateToSessionsTab();
reportSessionsTab.validateBrowser(usedBrowser);
ReportDetailsTab reportDetailsTab = reportTestsPage.navigateToDetailsTab(preTestWithBrowserInfoTab);
ReportBrowserInfoTab reportBrowserInfoTab = reportDetailsTab.navigateToBrowserInfoTab();
reportBrowserInfoTab.validateBrowser(usedBrowser);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Testerra
*
* (C) 2022, Marc Dietrich, T-Systems Multimedia Solutions GmbH, Deutsche Telekom AG
*
* Deutsche Telekom AG and all other contributors /
* copyright owners license this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

package io.testerra.report.test.report_test.methodpages;

import eu.tsystems.mms.tic.testframework.common.Testerra;
import eu.tsystems.mms.tic.testframework.report.model.context.SessionContext;
import eu.tsystems.mms.tic.testframework.report.model.steps.TestStep;
import eu.tsystems.mms.tic.testframework.report.utils.IExecutionContextController;
import io.testerra.report.test.AbstractReportTest;
import io.testerra.report.test.pages.ReportSidebarPageType;
import io.testerra.report.test.pages.report.methodReport.ReportStepsTab;
import io.testerra.report.test.pages.report.methodReport.ReportVideoTab;
import io.testerra.report.test.pages.report.sideBarPages.ReportDashBoardPage;
import io.testerra.report.test.pages.report.sideBarPages.ReportTestsPage;
import org.testng.annotations.Test;

public class ReportVideoTabTest extends AbstractReportTest {

@Test
public void testT01_checkDisplayedVideoGotContent() {
String preTestWithVideoTab = "preTest10_videoTest_passed";
String usedBrowser = "Chrome";

TestStep.begin("Navigate to dashboard page.");
ReportDashBoardPage reportDashBoardPage = this.gotoDashBoardOnAdditionalReport(WEB_DRIVER_MANAGER.getWebDriver());

TestStep.begin("Navigate to tests page.");
ReportTestsPage reportTestsPage = reportDashBoardPage.gotoToReportPage(ReportSidebarPageType.TESTS, ReportTestsPage.class);

TestStep.begin("Navigate to method browser info page and check for correct content");
reportTestsPage = reportTestsPage.clickConfigurationMethodsSwitch();
ReportStepsTab reportStepsTab = reportTestsPage.navigateToStepsTab(preTestWithVideoTab);
ReportVideoTab reportVideoTab = reportStepsTab.navigateToVideoTab();

IExecutionContextController instance = Testerra.getInjector().getInstance(IExecutionContextController.class);
SessionContext sessionContext = instance.getCurrentSessionContext().get();

reportVideoTab.validateBrowser(usedBrowser);
reportVideoTab.checkSessionId(sessionContext.getId());
reportVideoTab.checkVideo();
}
}
82 changes: 82 additions & 0 deletions report-ng/app/src/components/method-details/browser-info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!--
~ Testerra
~
~ (C) 2020, Mike Reiche, T-Systems Multimedia Solutions GmbH, Deutsche Telekom AG
~
~ Deutsche Telekom AG and all other contributors /
~ copyright owners license this file to you under the Apache
~ License, Version 2.0 (the "License"); you may not use this
~ file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<template>
<mdc-layout-grid class="pt0">
<mdc-card class="mb1" repeat.for="session of _sessionInformationArray" mdc-body1 id="${session.sessionId}">
<div mdc-subtitle2 class="card-headline">Session: ${session.sessionName}</div>
<mdc-list-divider></mdc-list-divider>
<div class="card-content">
<mdc-layout-grid-inner>
<mdc-layout-grid-cell span="6">
<ul class="mdc-list mdc-list--dense" mdc-caption>
<div mdc-subtitle2>General information</div>
<li class="mdc-custom-list-item">
<span class="secondary sr1">ID</span>${session.sessionId}
</li>
<li class="mdc-custom-list-item">
<span class="secondary sr1">Browser</span>${session.browserName}:${session.browserVersion}
</li>
<li class="mdc-custom-list-item">
<span class="secondary sr1">User&nbsp;agent</span>${session.userAgent}
</li>
<li class="mdc-custom-list-item" if.bind="session.serverUrl.length>0">
<span class="secondary sr1">Server</span><a href="${session.serverUrl}">${session.serverUrl}</a>
</li>
<li class="mdc-custom-list-item" if.bind="session.nodeUrl.length>0">
<span class="secondary sr1">Node</span><a href="${session.nodeUrl}">${session.nodeUrl}</a>
</li>
<li class="mdc-custom-list-item" if.bind="session.videoId">
<span class="secondary sr1">Video ID</span><a route-href="route: video; params.bind: {id: session.sessionId}">${session.videoId}</a>
</li>

<div mdc-subtitle2 class="mt1">Session metrics</div>
<li class="mdc-custom-list-item" if.bind="session.sessionDuration>0">
<span class="secondary sr1">Session duration</span>${session.sessionDuration}s
</li>
<li class="mdc-custom-list-item" if.bind="session.sessionStartDuration>0">
<span class="secondary sr1">Session start duration</span>${session.sessionStartDuration}s
</li>
<li class="mdc-custom-list-item" if.bind="session.sessionStartTime>0">
<span class="secondary sr1">Session start time</span>${_dateFormatter.toView(Number(session.sessionStartTime))}
</li>

<div mdc-subtitle2 class="mt1" if.bind="session.baseUrl">Base URL metrics</div>
<li class="mdc-custom-list-item" if.bind="session.baseUrl">
<span class="secondary sr1">Base URL</span><a href="${session.baseUrl}">${session.baseUrl}</a>
</li>
<li class="mdc-custom-list-item" if.bind="session.baseurlStartDuration>0">
<span class="secondary sr1">Base URL start duration</span>${session.baseurlStartDuration}s
</li>
<li class="mdc-custom-list-item" if.bind="session.baseurlStartTime>0">
<span class="secondary sr1">Base URL start time</span>${_dateFormatter.toView(Number(session.baseurlStartTime))}
</li>
</ul>
</mdc-layout-grid-cell>
<mdc-layout-grid-cell span="6">
<div mdc-subtitle2>Capabilities</div>
<div class="code-view capabilities-view">${session.capabilities|json}</div>
</mdc-layout-grid-cell>
</mdc-layout-grid-inner>
</div>
</mdc-card>
</mdc-layout-grid>
</template>
Loading