Skip to content

Flaky tests around Input simulation inside Scene Runner #581

Answered by placer14
placer14 asked this question in Q&A
Discussion options

You must be logged in to vote

For the benefit of others, my flaky tests were due to my input handling. I had a singleton checking Input.get_vector twice... inside _process and in _process_physics. Unfortunately, I believe the input was being flushed before either of those hooks were called. As such, those inputs were never seen or acted upon.

Here's an overview of the changes applied. Before:

func test_player__input_movement__right() -> void:
	var _runner = scene_runner("res://tests/integration/player/actions_fixture.tscn")
	var _player = _runner.find_child(_player_class)
	var original_position = _player.position

	_runner.simulate_action_pressed(Constants.INPUT_RIGHT)
	await _runner.await_input_processed()
	
	assert_…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@placer14
Comment options

@MikeSchulze
Comment options

@MikeSchulze
Comment options

@placer14
Comment options

Answer selected by placer14
@placer14
Comment options

@MikeSchulze
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants