Improve regression tests

This commit is contained in:
Andrea Fazzi 2020-02-11 10:10:10 +01:00
parent c6c790345d
commit b21ceace3f
3 changed files with 61 additions and 5 deletions

View file

@ -5,7 +5,8 @@ test:
docker exec -d oef_regression_test_selenium_1 ffmpeg -y -video_size 1360x1020 -framerate 15 -f x11grab -i :99.0 /tmp/recording.mp4
go test
docker exec oef_regression_test_selenium_1 killall -s SIGINT ffmpeg
docker exec oef_regression_test_selenium_1 MP4Box -isma -inter 500 -out /tmp/recording_cleaned_up.mp4 /tmp/recording.mp4
docker exec oef_regression_test_selenium_1 ffmpeg -y -i /tmp/recording.mp4 -filter:v "setpts=5*PTS" /tmp/recording_slow.mp4
docker exec oef_regression_test_selenium_1 MP4Box -isma -inter 500 -out /tmp/recording_cleaned_up.mp4 /tmp/recording_slow.mp4
docker cp oef_regression_test_selenium_1:/tmp/recording_cleaned_up.mp4 recordings/recording.mp4
all: test

View file

@ -172,8 +172,57 @@ func (t *testSuite) TestSchoolSubscription() {
t.Contain(expected[i], text)
}
// Open the participant view
first := findElements("#partecipanti_list_group a")[0]
err = first.Click()
if err != nil {
panic(err)
}
// Remove the participant
err = findElement("button.karmen-ajax-delete").Click()
if err != nil {
panic(err)
}
err = findElement("#karmen-modal-btn-confirm").Click()
if err != nil {
panic(err)
}
// Subscribe a participant of the same existing category
addParticipantAsSchool(&orm.Participant{
Firstname: "Luigi",
Lastname: "VERDI",
FiscalCode: "VRDLGSR1234567",
Category: &orm.Category{Name: "Senior"},
})
alert, err = findElement(".alert").Text()
t.Nil(err)
t.Contain("partecipante di questa categoria", alert)
err = findElement(".alert a").Click()
if err != nil {
panic(err)
}
// Subscribe a participant with the same fiscal code
populateParticipantForm(&orm.Participant{
Firstname: "Luigi",
Lastname: "VERDI",
FiscalCode: "BNCSR1234567",
Category: &orm.Category{Name: "Senior"},
})
alert, err = findElement(".alert").Text()
t.Nil(err)
t.Contain("codice fiscale è già presente", alert)
removeSchoolAsAdmin("Liceo GALILEI")
removeParticipantAsAdmin("ROSSI")
removeParticipantAsAdmin("BIANCA")
}
@ -341,8 +390,12 @@ func addParticipantAsSchool(participant *orm.Participant) {
if err != nil {
panic(err)
}
populateParticipantForm(participant)
clickPrimaryButton()
}
err = findElement("#participant_firstname").SendKeys(participant.Firstname)
func populateParticipantForm(participant *orm.Participant) {
err := findElement("#participant_firstname").SendKeys(participant.Firstname)
if err != nil {
panic(err)
}
@ -371,8 +424,10 @@ func addParticipantAsSchool(participant *orm.Participant) {
if err != nil {
panic(err)
}
}
err = findElement("button.btn.btn-primary").Click()
func clickPrimaryButton() {
err := findElement("button.btn.btn-primary").Click()
if err != nil {
panic(err)
}

View file

@ -60,7 +60,7 @@
{{if le (len .Data) 1}}
<p>
E' possibile iscrivere fino a due partecipanti alla gara (di diversa categoria).
<a href="{{create "Participant"}}" class="float-right btn btn-success btn-sm">
<a id="new_participant_subscribe" href="{{create "Participant"}}" class="float-right btn btn-success btn-sm">
<span class="fa fa-plus-circle" aria-hidden="true"></span>
Iscrivi un nuovo partecipante
</a>