You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
817 B
37 lines
817 B
package webapp
|
|
|
|
import (
|
|
"testing"
|
|
"context"
|
|
"time"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/chromedp/chromedp"
|
|
)
|
|
|
|
func TestHelloName(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
assert.Equal(123, 123, "should be equal")
|
|
assert.NotEqual(123, 456, "should not be equal")
|
|
}
|
|
|
|
func TestChromeDPWorks(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
ctx, cancel := chromedp.NewContext(context.Background())
|
|
defer cancel()
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, 15 * time.Second)
|
|
defer cancel()
|
|
|
|
var example string
|
|
|
|
err := chromedp.Run(ctx,
|
|
chromedp.Navigate(`http://127.0.0.1:5002`),
|
|
chromedp.WaitVisible(`body > footer`),
|
|
chromedp.Click(`#example`, chromedp.NodeVisible),
|
|
chromedp.Value(`#example textarea`, &example),
|
|
)
|
|
|
|
assert.NoError(err)
|
|
}
|
|
|