Add new subscription form fields to regression tests

This commit is contained in:
Andrea Fazzi 2022-02-03 18:57:48 +01:00
parent 2da0b371bc
commit a6179ecbb3

View file

@ -2,6 +2,7 @@ package regression_test
import ( import (
"fmt" "fmt"
"strconv"
"testing" "testing"
"git.andreafazzi.eu/andrea/oef/orm" "git.andreafazzi.eu/andrea/oef/orm"
@ -105,8 +106,11 @@ func (t *testSuite) TestSchoolSubscription() {
Email: "foo.bar@school.org", Email: "foo.bar@school.org",
SchoolContactPersonFirstname: "Mario", SchoolContactPersonFirstname: "Mario",
SchoolContactPersonLastname: "BROS", SchoolContactPersonLastname: "BROS",
SchoolContactPersonEmail: "mario.bros@nintendo.com",
SchoolContactPersonTelephoneNumber: "123 456 789",
ContestDirectorFirstname: "Luigi", ContestDirectorFirstname: "Luigi",
ContestDirectorLastname: "BROS", ContestDirectorLastname: "BROS",
PreviousParticipantsSelection: 30,
}) })
expected := []string{"Liceo GALILEI", "foo.bar@school.org"} expected := []string{"Liceo GALILEI", "foo.bar@school.org"}
@ -143,6 +147,8 @@ func (t *testSuite) TestSchoolSubscription() {
Firstname: "Mario", Firstname: "Mario",
Lastname: "ROSSI", Lastname: "ROSSI",
FiscalCode: "RSSMR1234567", FiscalCode: "RSSMR1234567",
Year: 2,
StudyField: "Human Science",
Category: &orm.Category{Name: "Junior"}, Category: &orm.Category{Name: "Junior"},
}) })
@ -151,6 +157,8 @@ func (t *testSuite) TestSchoolSubscription() {
Firstname: "Serena", Firstname: "Serena",
Lastname: "BIANCA", Lastname: "BIANCA",
FiscalCode: "BNCSR1234567", FiscalCode: "BNCSR1234567",
Year: 4,
StudyField: "Economics",
Category: &orm.Category{Name: "Senior"}, Category: &orm.Category{Name: "Senior"},
}) })
@ -195,6 +203,8 @@ func (t *testSuite) TestSchoolSubscription() {
Firstname: "Luigi", Firstname: "Luigi",
Lastname: "VERDI", Lastname: "VERDI",
FiscalCode: "VRDLGSR1234567", FiscalCode: "VRDLGSR1234567",
Year: 4,
StudyField: "Economics",
Category: &orm.Category{Name: "Senior"}, Category: &orm.Category{Name: "Senior"},
}) })
@ -214,6 +224,8 @@ func (t *testSuite) TestSchoolSubscription() {
Firstname: "Luigi", Firstname: "Luigi",
Lastname: "VERDI", Lastname: "VERDI",
FiscalCode: "BNCSR1234567", FiscalCode: "BNCSR1234567",
Year: 4,
StudyField: "Economics",
Category: &orm.Category{Name: "Senior"}, Category: &orm.Category{Name: "Senior"},
}) })
@ -472,7 +484,14 @@ func addSchoolAsSubscriber(school *orm.School) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = findElement("#school_contact_person_email").SendKeys(school.SchoolContactPersonEmail)
if err != nil {
panic(err)
}
err = findElement("#school_contact_person_telephone_number").SendKeys(school.SchoolContactPersonTelephoneNumber)
if err != nil {
panic(err)
}
err = findElement("#school_contest_director_firstname").SendKeys(school.ContestDirectorFirstname) err = findElement("#school_contest_director_firstname").SendKeys(school.ContestDirectorFirstname)
if err != nil { if err != nil {
panic(err) panic(err)
@ -481,7 +500,10 @@ func addSchoolAsSubscriber(school *orm.School) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = findElement("#school_previous_participants_selection").SendKeys(strconv.Itoa(int(school.PreviousParticipantsSelection)))
if err != nil {
panic(err)
}
err = findElement("button.btn.btn-primary").Click() err = findElement("button.btn.btn-primary").Click()
if err != nil { if err != nil {
panic(err) panic(err)
@ -514,6 +536,16 @@ func populateParticipantForm(participant *orm.Participant) {
panic(err) panic(err)
} }
err = findElement("#participant_year").SendKeys(strconv.Itoa(participant.Year))
if err != nil {
panic(err)
}
err = findElement("#participant_study_field").SendKeys(participant.StudyField)
if err != nil {
panic(err)
}
err = findElement("button.dropdown-toggle").Click() err = findElement("button.dropdown-toggle").Click()
if err != nil { if err != nil {
panic(err) panic(err)