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