There is a test, but games and phones do not count in it. A screen delivers new input every second and rewards immediately — a child whose attention is weak can still stay with it. Look instead at a calm activity the child chose itself: Lego, drawing, a jigsaw. If it stays with that and the problem shows only with schoolwork, this is more about motivation. If it drifts away from that too, it is about attention itself.
Staying with a game on a phone for a long time is not evidence that attention is fine — it is more a picture of how much input the child needs in order to stay engaged. Attention is not one ability but several. Staying with one thing is different from switching to another, and both differ from not being pulled away. A child may have just one of them weakened and be fine in the rest — which is why it can build Lego for an hour and not last five minutes over homework.
The attention screening questionnaire covers five parts — sustaining, organisation, behaviour while learning, emotions and activity — and shows which is weakest. Only then can you tell whether a change of environment will help or whether targeted exercises are needed.