@Test
public void lockDoesWaitIfWaitingEventIsNotSatisfiedWhenSubmitted() throws InterruptedException, TimeoutException {

    String jsEvent = "jsEvent";
    WebDriver driver = mock(WebDriver.class);
    SearchContextFunction contextProvider = webDriver1 -> driver;
    ActionWithJSPreconditionBase actionWithJSPreconditionBase = new ActionWithJSPreconditionBase(contextProvider) {
        @Override
        public void executeAfterJSPreconditionHasBeenSatisfied(WebDriver driver, ReplayingState replayingState, Function<SearchContext, SearchContext> contextProvider) {
        }
        @Override
        public String getName() {
            return null;
        }
        @Override
        public boolean expectsHttpRequest() {
            return false;
        }
        @Override
        public String getJSEventToWaitFor() {
            return jsEvent;
        }
    };
    EventSynchronizer eventSynchronizer = mock(EventSynchronizer.class);
    ReplayingState replayingState = mock(ReplayingState.class);
    when(replayingState.isSatisfied(jsEvent)).thenReturn(true);
    actionWithJSPreconditionBase.execute(driver, replayingState, eventSynchronizer);
    verify(eventSynchronizer).awaitUntil(any());
}