In addition to what have been said above there is another one solution. It is possible to pause a scenario run at any time and run step (cucumber step, not java step) by step. My solution for E2E testing is cucumber hook @AfterStep, local Spark server, Chrome extension and Idea plugin. Hook is for making a loop with wait until state changed, spark is for receiving a commands from buttons, extension is for injecting three buttons on page (pause, one step, resume) and Idea plugin is for same three buttons. The idea is to send a command to the spark, it transfers the command to a class, that handles a state change and waits next command.
I can't share a code due to corporate rules but you can find some details and code fragments in the article in corporate blog on habr.ru (use google translate). Here is the link https://habr.com/ru/companies/mvideo/articles/867178/
And below is key fragment of handler class
public static volatile String breakpointState = STATE_RESUME;
public static void handleBreakpointActions(boolean shouldBeStopped) {
if (shouldBeStopped && isBreakpointFeatureOn()) {
breakpointState = STATE_PAUSE;
}
if (breakpointState.equals(STATE_PAUSE) || breakpointState.equals(STATE_ONE_STEP)) {
breakpointState = STATE_PAUSE;
makePause();
}
else{
waitForMs(waitBetweenSteps);
}
}