When to enhance a dataset of images with flips and rotations of the images? I am a beginner in machine learning, so I'm sorry if my question is a bit trivial.

Suppose I have a dataset of images and which I want to classify, say using a neural network. It makes sense to me to try to enhance my dataset by e.g. flipping and rotating the images, so to obtain more training observations.

At some point, I want to split my dataset in a training set and a test set, and maybe also to additionally subdivide the training set for cross-validation. My question is: when should I enhance my dataset with the flipped/rotated images? If I do it before I split my dataset in training and test sample, then the test sample will contain e.g. rotations of observations that also are in the training sample, so I have the feeling it might be "contaminated" and under-represent the test error. Same thing with the split for cross-validation. Is there a consensus on how to proceed? Also, is this a valid approach?
Those operations should  be performed on the training data part. We are introducing varieties into the training data set. 

If you were to do the rotation and flipping data and then you split the data set with the possibility of the rotated image of the test data being included in the training procedure. You are giving the model a glimpse of the target that you are going to test later, which defeat the purpose of testing it on new unseen data. 

The cross validation and test data should be examples of real life data that your model works on. Suppose your test data are flipped in the real life regularly (for example, a car facing different way), then perhaps it can be justified but those flipped images of the test data shouldn't be included in the training procedure.