Wash the green beans, tip both ends and boil in hot salted water for 5 to 10 minutes (or according to your own preference). Please note the will still continue cooking a bit in the oven once we bake the casserole.
Peel the outer skin of the onions and finely slice them. Add the onions to a pan with 1 tablespoon of olive oil and cook on high heat for 7 to 10 minutes, stirring, until soft and well coloured. Set aside.
For the white sauce: melt the plant based butter (or margarine) into a pan, add the flour. Remove from the heat and stir with a whisk until they come together into a paste. Gently add the plant milk a bit at a time. Do not add more milk until you have nicely incorporated the previous portion with the flour and butter mixture. This will prevent creating unpleasing lumps. Put the pan back on the heat, season with the spices, and cook on low until it start thickening (should be required 2 to 5 minutes at very least). If you happen to have formed lumps, do not worry, you can use an hand blender to save it and turn it to smooth.
Assemble the casserole. Place the cooked green beans at the bottom of a 20x30cm (7x11'') tray that is at least 5 cm (2 inches) deep. Pour the white sauce over the beans, and spread it evenly with a spatula. Cover with a generous layer of caramelized onions.
Finally top the casserole with some panko bread (or normal breadcrumbs*), spray with some olive oil and bake in the oven at 190°C (375°F) for 30 minutes. In the last five minutes turn the grill mode on if you'd like to have an even crispier top.
Serve the vegan green bean casserole ideally warm.