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

Fix some nightly tests flakiness #1165

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ class RumMonitorBackgroundE2ETests {
val testMethodName = "rum_rummonitor_add_background_non_custom_action_with_outcome"
val actionName = forge.anActionName()
val attributes = defaultTestAttributes(testMethodName)
// BACK has no action.name (only action.target.name), so we need to exclude it, because
// assertion is relying on action.name
val actionType = forge.aValueFrom(
RumActionType::class.java,
exclude = listOf(RumActionType.CUSTOM)
exclude = listOf(RumActionType.CUSTOM, RumActionType.BACK)
)
measure(testMethodName) {
GlobalRum.get().addUserAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ class RumMonitorE2ETests {
val viewName = forge.aViewName()
val actionName = forge.anActionName()
val attributes = defaultTestAttributes(testMethodName)
val actionType = forge.aValueFrom(RumActionType::class.java)
// BACK has no action.name (only action.target.name), so we need to exclude it, because
// assertion is relying on action.name
val actionType =
forge.aValueFrom(RumActionType::class.java, exclude = listOf(RumActionType.BACK))
executeInsideView(viewKey, viewName, testMethodName) {
measure(testMethodName) {
GlobalRum.get().startUserAction(
Expand Down Expand Up @@ -342,7 +345,9 @@ class RumMonitorE2ETests {
val viewKey = forge.aViewKey()
val viewName = forge.aViewName()
val actionName = forge.anActionName()
val type = forge.aValueFrom(RumActionType::class.java)
// BACK has no action.name (only action.target.name), so we need to exclude it, because
// assertion is relying on action.name
val type = forge.aValueFrom(RumActionType::class.java, exclude = listOf(RumActionType.BACK))
val stopActionAttributes = forge.exhaustiveAttributes()
executeInsideView(viewKey, viewName, testMethodName) {
GlobalRum.get().startUserAction(
Expand Down Expand Up @@ -419,7 +424,12 @@ class RumMonitorE2ETests {
val viewName = forge.aViewName()
val actionName = forge.anActionName()
val attributes = defaultTestAttributes(testMethodName)
val actionType = forge.aValueFrom(RumActionType::class.java)
// BACK has no action.name (only action.target.name), so we need to exclude it, because
// assertion is relying on action.name
val actionType = forge.aValueFrom(
RumActionType::class.java,
exclude = listOf(RumActionType.BACK)
)
executeInsideView(viewKey, viewName, testMethodName) {
measure(testMethodName) {
GlobalRum.get().addUserAction(
Expand All @@ -444,7 +454,12 @@ class RumMonitorE2ETests {
val viewName = forge.aViewName()
val activeActionName = forge.anActionName(prefix = "rumActiveAction")
val customActionName = forge.anActionName()
val actionType = forge.aValueFrom(RumActionType::class.java)
// BACK has no action.name (only action.target.name), so we need to exclude it, because
// assertion is relying on action.name
val actionType = forge.aValueFrom(
RumActionType::class.java,
exclude = listOf(RumActionType.BACK)
)
val attributes = defaultTestAttributes(testMethodName)
executeInsideView(viewKey, viewName, testMethodName) {
GlobalRum.get().startUserAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.datadog.android.nightly.webview

import androidx.test.core.app.ActivityScenario.launch
import androidx.test.espresso.web.model.Atoms.script
import androidx.test.espresso.web.sugar.Web.onWebView
import androidx.test.espresso.web.webdriver.DriverAtoms.findElement
import androidx.test.espresso.web.webdriver.DriverAtoms.webClick
Expand Down Expand Up @@ -102,7 +103,12 @@ internal class WebViewTrackingE2ETests {
initSdk()
launch(WebViewTrackingActivity::class.java)

onWebView().withElement(findElement(Locator.ID, "display-image")).perform(webClick())
// with https://github.com/DataDog/browser-sdk/pull/1731 pointerdown event is required
// before emitting click event for the RUM action to be registered
with(onWebView().withElement(findElement(Locator.ID, "display-image"))) {
perform(script("arguments[0].dispatchEvent(new PointerEvent('pointerdown'))"))
perform(webClick())
}
}

/**
Expand Down