CHANTELLE, South Africa — Ahead of the general elections on Wednesday in South Africa, Josiah Tsheko found himself in a category now familiar to members of the nation’s growing black middle class: the undecided voter.

He liked the president, Cyril Ramaphosa, a former business tycoon and the leader of the long-governing African National Congress party. But as Mr. Tsheko oversaw workers who were adding an extension to his ranch-style house on a recent morning, he said he had deep misgivings about the party itself.

“My friends like Cyril — I also do,” said Mr. Tsheko, 42, a human resources manager at a mining company. “Remember, the guy knows business. The problem is the guy is surrounded by the party mafia.”