2019-11-02 21:32:58 +07:00
|
|
|
package suites
|
|
|
|
|
2019-11-25 03:27:59 +07:00
|
|
|
import (
|
|
|
|
"fmt"
|
2021-04-13 15:38:12 +07:00
|
|
|
"net/url"
|
2019-11-25 03:27:59 +07:00
|
|
|
"testing"
|
2021-11-05 20:14:42 +07:00
|
|
|
|
|
|
|
"github.com/go-rod/rod"
|
2019-11-25 03:27:59 +07:00
|
|
|
)
|
2019-11-02 21:32:58 +07:00
|
|
|
|
2021-11-05 20:14:42 +07:00
|
|
|
func (rs *RodSession) doLogout(t *testing.T, page *rod.Page) {
|
|
|
|
rs.doVisit(t, page, fmt.Sprintf("%s%s", GetLoginBaseURL(), "/logout"))
|
|
|
|
rs.verifyIsFirstFactorPage(t, page)
|
2019-11-02 21:32:58 +07:00
|
|
|
}
|
2021-04-13 15:38:12 +07:00
|
|
|
|
2021-11-05 20:14:42 +07:00
|
|
|
func (rs *RodSession) doLogoutWithRedirect(t *testing.T, page *rod.Page, targetURL string, firstFactor bool) {
|
|
|
|
rs.doVisit(t, page, fmt.Sprintf("%s%s%s", GetLoginBaseURL(), "/logout?rd=", url.QueryEscape(targetURL)))
|
2021-04-13 15:38:12 +07:00
|
|
|
|
|
|
|
if firstFactor {
|
2021-11-05 20:14:42 +07:00
|
|
|
rs.verifyIsFirstFactorPage(t, page)
|
2021-04-13 15:38:12 +07:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-11-05 20:14:42 +07:00
|
|
|
page.MustElementR("h1", "Public resource")
|
|
|
|
|
|
|
|
rs.verifyURLIs(t, page, targetURL)
|
2021-04-13 15:38:12 +07:00
|
|
|
}
|