Skip to content

Instantly share code, notes, and snippets.

@SergeyPirogov
Created January 2, 2020 12:40
Show Gist options
  • Save SergeyPirogov/28a3e51fd0a5d298094834b498235e2a to your computer and use it in GitHub Desktop.
Save SergeyPirogov/28a3e51fd0a5d298094834b498235e2a to your computer and use it in GitHub Desktop.
private fun setToken() {
Selenide.open("/")
val token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsInJvbGUiOiJhZG1pbiIsImlzcyI6Imh0dHA6Ly9kcmlsbC00LWovIiwiaWQiOjEsImV4cCI6MTU3Njg1MzQ4NX0.qwV_dOwrsLo6lDJ8Fd-oWwM6RsPdCYXiBSfq9ML91PuKn6nwAxnlRTc2z2NeNETRa-bBG6D3XFTvWMr10u9CMg"
Selenide.executeJavaScript<Any>("window.localStorage.setItem('auth_token', '$token')")
}
private fun deleteToken() {
Selenide.open("/")
Selenide.executeJavaScript<Any>("window.localStorage.removeItem('auth_token')")
Selenide.refresh()
Thread.sleep(2000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment