Added e2e tests for #rewrite and #clear_rewrites