mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rdct-tests] do not throw error on modal window on test shudown, it does more harm than good
GitOrigin-RevId: 129e248da31b1ef7ea3081f740c77ce7209ccf3b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cb3ef90d5e
commit
e18f0be314
@@ -61,7 +61,7 @@ class DistributedTestModel private constructor(
|
||||
|
||||
private val __RdTestSessionNullableSerializer = RdTestSession.nullable()
|
||||
|
||||
const val serializationHash = -2661619799941496807L
|
||||
const val serializationHash = -8976769733834761447L
|
||||
|
||||
}
|
||||
override val serializersOwner: ISerializersOwner get() = DistributedTestModel
|
||||
@@ -662,7 +662,7 @@ class RdTestSession private constructor(
|
||||
private val _stopAllureStep: RdSignal<RdAllureStopStepInfo>,
|
||||
private val _exitApp: RdSignal<Unit>,
|
||||
private val _showNotification: RdSignal<String>,
|
||||
private val _forceLeaveAllModals: RdCall<Boolean, Unit>,
|
||||
private val _forceLeaveAllModals: RdCall<Unit, Boolean>,
|
||||
private val _closeAllOpenedProjects: RdCall<Unit, Boolean>,
|
||||
private val _runNextAction: RdCall<RdTestActionParameters, String?>,
|
||||
private val _requestFocus: RdCall<Boolean, Boolean>,
|
||||
@@ -694,7 +694,7 @@ class RdTestSession private constructor(
|
||||
val _stopAllureStep = RdSignal.read(ctx, buffer, RdAllureStopStepInfo)
|
||||
val _exitApp = RdSignal.read(ctx, buffer, FrameworkMarshallers.Void)
|
||||
val _showNotification = RdSignal.read(ctx, buffer, FrameworkMarshallers.String)
|
||||
val _forceLeaveAllModals = RdCall.read(ctx, buffer, FrameworkMarshallers.Bool, FrameworkMarshallers.Void)
|
||||
val _forceLeaveAllModals = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
val _closeAllOpenedProjects = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
val _runNextAction = RdCall.read(ctx, buffer, RdTestActionParameters, __StringNullableSerializer)
|
||||
val _requestFocus = RdCall.read(ctx, buffer, FrameworkMarshallers.Bool, FrameworkMarshallers.Bool)
|
||||
@@ -747,7 +747,7 @@ class RdTestSession private constructor(
|
||||
val stopAllureStep: IAsyncSignal<RdAllureStopStepInfo> get() = _stopAllureStep
|
||||
val exitApp: IAsyncSignal<Unit> get() = _exitApp
|
||||
val showNotification: ISignal<String> get() = _showNotification
|
||||
val forceLeaveAllModals: RdCall<Boolean, Unit> get() = _forceLeaveAllModals
|
||||
val forceLeaveAllModals: RdCall<Unit, Boolean> get() = _forceLeaveAllModals
|
||||
val closeAllOpenedProjects: RdCall<Unit, Boolean> get() = _closeAllOpenedProjects
|
||||
val runNextAction: RdCall<RdTestActionParameters, String?> get() = _runNextAction
|
||||
val requestFocus: RdCall<Boolean, Boolean> get() = _requestFocus
|
||||
@@ -822,7 +822,7 @@ class RdTestSession private constructor(
|
||||
RdSignal<RdAllureStopStepInfo>(RdAllureStopStepInfo),
|
||||
RdSignal<Unit>(FrameworkMarshallers.Void),
|
||||
RdSignal<String>(FrameworkMarshallers.String),
|
||||
RdCall<Boolean, Unit>(FrameworkMarshallers.Bool, FrameworkMarshallers.Void),
|
||||
RdCall<Unit, Boolean>(FrameworkMarshallers.Void, FrameworkMarshallers.Bool),
|
||||
RdCall<Unit, Boolean>(FrameworkMarshallers.Void, FrameworkMarshallers.Bool),
|
||||
RdCall<RdTestActionParameters, String?>(RdTestActionParameters, __StringNullableSerializer),
|
||||
RdCall<Boolean, Boolean>(FrameworkMarshallers.Bool, FrameworkMarshallers.Bool),
|
||||
|
||||
@@ -93,7 +93,7 @@ object DistributedTestModel : Ext(TestRoot) {
|
||||
signal("stopAllureStep", RdAllureStopStepInfo).async
|
||||
signal("exitApp", void).async
|
||||
signal("showNotification", string)
|
||||
call("forceLeaveAllModals", bool, void).async
|
||||
call("forceLeaveAllModals", void, bool).async
|
||||
call("closeAllOpenedProjects", void, bool).async
|
||||
call("runNextAction", RdTestActionParameters, string.nullable).async
|
||||
call("requestFocus", bool, bool).async
|
||||
|
||||
+8
-10
@@ -266,35 +266,33 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun leaveAllModals(throwErrorIfModal: Boolean) {
|
||||
suspend fun makeSureNoModals(): Boolean =
|
||||
withContext(Dispatchers.EDT + ModalityState.any().asContextElement() + NonCancellable) {
|
||||
repeat(10) {
|
||||
if (ModalityState.current() == ModalityState.nonModal()) {
|
||||
return@withContext
|
||||
return@withContext true
|
||||
}
|
||||
delay(1.seconds)
|
||||
}
|
||||
if (throwErrorIfModal) {
|
||||
LOG.error("Unexpected modality: " + ModalityState.current())
|
||||
}
|
||||
LOG.warn("Unexpected modality: " + ModalityState.current())
|
||||
LaterInvocator.forceLeaveAllModals("DistributedTestHost - leaveAllModals")
|
||||
repeat(10) {
|
||||
if (ModalityState.current() == ModalityState.nonModal()) {
|
||||
return@withContext
|
||||
return@withContext true
|
||||
}
|
||||
delay(1.seconds)
|
||||
}
|
||||
LOG.error("Failed to close modal dialog: " + ModalityState.current())
|
||||
return@withContext false
|
||||
}
|
||||
}
|
||||
|
||||
session.forceLeaveAllModals.setSuspend(sessionBgtDispatcher) { _, throwErrorIfModal ->
|
||||
leaveAllModals(throwErrorIfModal)
|
||||
session.forceLeaveAllModals.setSuspend(sessionBgtDispatcher) { _, _ ->
|
||||
makeSureNoModals()
|
||||
}
|
||||
|
||||
session.closeAllOpenedProjects.setSuspend(sessionBgtDispatcher) { _, _ ->
|
||||
try {
|
||||
leaveAllModals(throwErrorIfModal = true)
|
||||
makeSureNoModals()
|
||||
|
||||
ProjectManagerEx.getOpenProjects().forEach { waitProjectInitialisedOrDisposed(it) }
|
||||
withContext(Dispatchers.EDT + NonCancellable) {
|
||||
|
||||
Reference in New Issue
Block a user