Tesla has settled a lawsuit by a former factory employee who says she was fired for complaining about severe sexual harassment, as the electric carmaker faces a series of sex and race discrimination lawsuits.