How to find upload_protocol for this samd21g18a board?

Boards where the USB serial is implemented by the target chip and is thus is “unstable” in the sense that after flashing it ejects the USB serial device and gets connected after a time needs special care. The first one is while(!Serial){} as the first line in setup() to prevent anything being sent before the serial monitor is opened, second, a delay per point 3 in Redirecting... and before attempting to open the serial monitor, see Teensy 4.1 Unit Testing Issue - #5 by maxgerhardt for the technique.

But on a more basic level, did you test that Serial outputs something in the main firmware before trying to test? Pin mappings might be different.