Direct measurement of the impurity dynamics during an ELM cycle