O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Verifying the contact form

The test that we implemented to verify the contact form functionality, can be found in the contactform_test.go source file in the client/tests/go directory.

In this test, we defined the FormParams struct, which represents the form parameters that the contact form should be filled with, when conducting our test steps:

type FormParams struct {  *js.Object  FirstName string `js:"firstName"`  LastName string `js:"lastName"`  Email string `js:"email"`  MessageBody string `js:"messageBody"`}

We've created a JavaScript wait function to ensure that the test runner will wait for the primary content div container to have loaded, prior to running other steps:

var wait = js.MakeFunc(func(this *js.Object, arguments []*js.Object) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required