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