Fix basepath for headless tests and correctly load %20 encoded paths