A lot depends on how serious the problem is. If the gears are just a little stiff, then you should top up the gearbox oil and live with it. If it wont change gear at all, then you should give the dealer a suitable chance to put things right and, if they refuse or fail to do this, then you are entitled to a refund. The hardest situation is if the gears fail occasionally but you can descride the problem accurately and suggest that the dealer gives the bike a suitable road test.
You have the option to take your dispute to the credit card company if you get nowhere with the dealer.
Assuming that the problem is serious, in your shoes, as the bike is with the dealer now, I would state clearly that there was a serious problem, you found this problem by driving the bike not by technical inspection and, if there is still a problem after you collect the bike, you will be asking for a refund.