Working on regression test for participant responses
This commit is contained in:
parent
7884ca84cb
commit
105e852039
4 changed files with 77 additions and 3 deletions
|
@ -231,6 +231,79 @@ func (t *testSuite) TestSchoolSubscription() {
|
|||
|
||||
}
|
||||
|
||||
func (t *testSuite) TestParticipantResponse() {
|
||||
login("WINBOXGUF", "GUf3wIP0DF7")
|
||||
|
||||
err := findElement("a.btn-primary").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = findElement("#update-response").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
correct := []string{
|
||||
"97", "129", "105", "113", "93", "89", "109", "141", "157",
|
||||
"85", "133", "153", "121", "117", "101", "149", "81", "145",
|
||||
"125", "137",
|
||||
}
|
||||
|
||||
for _, answerId := range correct {
|
||||
err = findElement("#answer_" + answerId).Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
err = findElement("button.btn-primary").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
logout()
|
||||
|
||||
login("admin", "admin")
|
||||
|
||||
err = findElement("#responses_navbar_link").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = findElement("#myInput").SendKeys("BOXILL")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = findElement("a.oef-selected-by-search").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
scoreEl := findElement("#score")
|
||||
score, err := scoreEl.Text()
|
||||
|
||||
t.Nil(err)
|
||||
t.Equal("20", score)
|
||||
|
||||
err = findElement("a.btn-primary").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = findElement("#reset_responses").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = findElement("button.btn-primary").Click()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
logout()
|
||||
}
|
||||
|
||||
func findElement(selector string) selenium.WebElement {
|
||||
element, err := wd.FindElement(selenium.ByCSSSelector, selector)
|
||||
if err != nil {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<a class="nav-item nav-link {{.Options|active "Answer"}}" href="{{all "Answer"}}">Risposte</a>
|
||||
<a id="schools_navbar_link" class="nav-item nav-link {{.Options|active "School"}}" href="{{all "School"}}">Scuole</a>
|
||||
<a id="participants_navbar_link" class="nav-item nav-link {{.Options|active "Participant"}}" href="{{all "Participant"}}">Partecipanti</a>
|
||||
<a class="nav-item nav-link {{.Options|active "Response"}}" href="{{all "Response"}}">Prove</a>
|
||||
<a id="responses_navbar_link" class="nav-item nav-link {{.Options|active "Response"}}" href="{{all "Response"}}">Prove</a>
|
||||
{{- end -}}
|
||||
{{- if $isSchool -}}
|
||||
<a id="school_navbar_link" class="nav-item nav-link {{.Options|active "School"}}" href="{{.Claims|modelId|show "School"}}">Scuola</a>
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
{{- end -}}
|
||||
</dl>
|
||||
<button type="submit" class="btn btn-primary" form="{{$form}}">Salva</button>
|
||||
{{if $isAdmin}}<button id="reset_responses" type="reset" class="btn btn-outline-secondary" form="{{$form}}">Cancella risposte</button>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<dd class="col-sm-9">nessuna risposta fornita</dd>
|
||||
{{end}}
|
||||
<dt class="col-sm-3">Punteggio</dt>
|
||||
<dd class="col-sm-9">{{.Data.Score}}</dd>
|
||||
<dd id="score" class="col-sm-9">{{.Data.Score}}</dd>
|
||||
{{if $creatorUser:=.Data.CreatedBy}}
|
||||
<dt class="col-sm-3">Creato da</dt>
|
||||
<dd class="col-sm-9">{{$creatorUser.Username}}[{{$creatorUser.Role}}] {{$.Data.CreatedAt|prettyDateTime}} da {{.Data.CreatorIP}}</dd>
|
||||
|
@ -76,7 +76,7 @@
|
|||
{{if .Data.IsActive}}
|
||||
<p>
|
||||
Per iniziare o riprendere la gara clicca sul pulsante a destra.
|
||||
<a id="new_participant_subscribe" href="{{.Data.ID | update "Response"}}" class="float-right btn btn-primary btn-sm">
|
||||
<a id="update-response" href="{{.Data.ID | update "Response"}}" class="float-right btn btn-primary btn-sm">
|
||||
<span class="fa fa-edit" aria-hidden="true"></span>
|
||||
Vai alla gara!
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue