2019-11-25 03:27:59 +07:00
|
|
|
package suites
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
2020-12-16 08:47:31 +07:00
|
|
|
|
2021-11-05 20:14:42 +07:00
|
|
|
"github.com/go-rod/rod"
|
2020-12-16 08:47:31 +07:00
|
|
|
"github.com/stretchr/testify/require"
|
2019-11-25 03:27:59 +07:00
|
|
|
)
|
|
|
|
|
2021-11-05 20:14:42 +07:00
|
|
|
func (rs *RodSession) doChangeMethod(t *testing.T, page *rod.Page, method string) {
|
|
|
|
err := rs.WaitElementLocatedByCSSSelector(t, page, "methods-button").Click("left")
|
2020-12-16 08:47:31 +07:00
|
|
|
require.NoError(t, err)
|
2021-11-05 20:14:42 +07:00
|
|
|
rs.WaitElementLocatedByCSSSelector(t, page, "methods-dialog")
|
|
|
|
err = rs.WaitElementLocatedByCSSSelector(t, page, fmt.Sprintf("%s-option", method)).Click("left")
|
2020-12-16 08:47:31 +07:00
|
|
|
require.NoError(t, err)
|
2019-11-25 03:27:59 +07:00
|
|
|
}
|
2021-12-01 10:32:58 +07:00
|
|
|
|
|
|
|
func (rs *RodSession) doChangeDevice(t *testing.T, page *rod.Page, deviceID string) {
|
|
|
|
err := rs.WaitElementLocatedByCSSSelector(t, page, "selection-link").Click("left")
|
|
|
|
require.NoError(t, err)
|
|
|
|
rs.doSelectDevice(t, page, deviceID)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rs *RodSession) doSelectDevice(t *testing.T, page *rod.Page, deviceID string) {
|
|
|
|
rs.WaitElementLocatedByCSSSelector(t, page, "device-selection")
|
|
|
|
err := rs.WaitElementLocatedByCSSSelector(t, page, fmt.Sprintf("device-%s", deviceID)).Click("left")
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rs *RodSession) doClickButton(t *testing.T, page *rod.Page, buttonID string) {
|
|
|
|
err := rs.WaitElementLocatedByCSSSelector(t, page, buttonID).Click("left")
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|