At the request of the moderator I have deleted my comment and moved it here to an answer.
It is important to keep in mind that owning a condo brings with it costs over and above the cost of maintaining a mortgage. In particular, typical monthly maintenance fees on a $300,000 condo will be $300-$400 per month. Then there are property taxes to consider - say, $100-$120 per month. Over a period of 10 years, one should also budget for at least one "special assessment". Depending on the age of the build, this unexpected "special assessment" could be upwards of $10,000. My sister was hit with a $42,000 sp assessment on a 2 bedroom condo here in Vancouver. Finally, maintenance fees will include building insurance, but in addition one is legally obliged to take out "condo insurance" which will add another $30-$40 per month.
When all of this is taken into account we are adding about $500 per month in known expenses to the cost of condo ownership. This needs to be added to the cost of maintaining the mortgage when considering affordability. Also keep in mind that maintenance fees, taxes, and insurance have a habit of increasing each year.
Regarding the issue of unknown expenses - i.e., special assessments - if one is mortgaged up to the limit of affordability, then where does the money to pay the special assessment come from. It would have to come from renegotiating the mortgage by adding these expenses to the capital. This brings with it new risks. In addition to the considerable expense of renegotiation, one will be adding a significant amount to the capital outstanding and therefore the monthly payment. In addition, there is the risk that interest rates have increased since the original mortgage was negotiated. A 1% increase on an original 5% rate is a 20% increase in the monthly payment, and that is without taking into account the extra capital amount.
Thus, one can compute the mortgage amount corresponding to $1500 per month at a rate of 5%, but this is a dangerous oversimplification of the measure of affordability. As a minimum, one should compute the mortgage amount corresponding to rent at $1500/month less the known expenses (say, $500/month) and then knock off 10% for good measure. Once this is all taken into account, then one can use online models to look at break-even points.