After having been asked by many folks just what fry till the oil leaves the masala / mixture / pan means in Indian recipes that call for an onion-tomato base, I figured a primer is in order.
Well, to begin with, the oil is not going anywhere, so rest easy. It's just a literal translation and what it means is that you need to have sweated the onions (and/or tomatoes) until most of the water content has evaporated and you are left with a fibrous mass, and the oil in which it was being cooked separates and spreads out to the sides of the pan.
Start your onions in oil, as much as the recipe calls for.
Next, sweat the onions until there is next to no moisture left in them. If you do this on low to medium heat, it could take well up to half hour. On high heat, you are essentially sautéing the onions and you need to make sure that the onions don't burn.
Add your tomatoes. In the picture below, I have used tomato paste and some water to wash the tomato paste out of the can. No waste policy!
Continue cooking on low heat until..yes, you guessed it, the oil leaves the mixture...