-
Notifications
You must be signed in to change notification settings - Fork 34
/
PerformanceMetricsTest.java
36 lines (32 loc) · 1.54 KB
/
PerformanceMetricsTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package tests.usecases.devtools;
import aquality.selenium.browser.AqualityServices;
import aquality.selenium.browser.devtools.DevToolsHandling;
import org.testng.Assert;
import org.testng.annotations.Test;
import tests.BaseTest;
import theinternet.TheInternetPage;
import java.util.Map;
public class PerformanceMetricsTest extends BaseTest {
private static DevToolsHandling devTools() {
return AqualityServices.getBrowser().devTools();
}
@Test
public void getAndCloseDevToolsSessionTest() {
devTools().enablePerformanceMonitoring();
navigate(TheInternetPage.REDIRECTOR);
Map<String, Number> metrics = devTools().getPerformanceMetrics();
Assert.assertFalse(metrics.isEmpty(), "Some metrics should be returned");
devTools().disablePerformanceMonitoring();
getBrowser().refresh();
Assert.assertTrue(devTools().getPerformanceMetrics().isEmpty(),
"Metrics should have not been collected after performance monitoring have been disabled");
devTools().enablePerformanceMonitoring("timeTicks");
getBrowser().refresh();
metrics = devTools().getPerformanceMetrics();
Assert.assertFalse(metrics.isEmpty(), "Some metrics should be returned");
getBrowser().refresh();
Map<String, Number> otherMetrics = devTools().getPerformanceMetrics();
Assert.assertFalse(otherMetrics.isEmpty(), "Some metrics should be returned");
Assert.assertNotEquals(otherMetrics, metrics, "Some additional metrics should have been collected");
}
}