diff --git a/grails-app/controllers/rgms/publication/ConferenciaController.groovy b/grails-app/controllers/rgms/publication/ConferenciaController.groovy index f0d9fb40..f9052bd8 100644 --- a/grails-app/controllers/rgms/publication/ConferenciaController.groovy +++ b/grails-app/controllers/rgms/publication/ConferenciaController.groovy @@ -43,7 +43,7 @@ class ConferenciaController { alertMessage('created',conferenciaInstance) } - private returnConferenciaInstance(){ + private getConferenciaInstance(){ def conferenciaInstance = Conferencia.get(params.id) boolean isReturned = aux.check(params.id, conferenciaInstance, 'conferencia.label', 'Conferencia'); if(!isReturned){ @@ -52,7 +52,7 @@ class ConferenciaController { } - private returnConferenciaActualVersion() + private getConferenciaActualVersion() { def conferenciaInstance = Conferencia.get(params.id) boolean isReturned = aux.check(params.id, conferenciaInstance, 'conferencia.label', 'Conferencia'); @@ -76,15 +76,15 @@ class ConferenciaController { } def show() { - returnConferenciaInstance() + getConferenciaInstance() } def edit() { - returnConferenciaInstance() + getConferenciaInstance() } def update() { - returnConferenciaActualVersion(); + getConferenciaActualVersion(); } def delete() { diff --git a/test/cucumber/Conferencia.feature b/test/cucumber/Conferencia.feature index 261dc9f4..3fc8c4bb 100644 --- a/test/cucumber/Conferencia.feature +++ b/test/cucumber/Conferencia.feature @@ -1,136 +1,124 @@ -@i9n -Feature: conferencia - As a member of a research group - I want to add, remove and modify conferencias I have published - so that I can generate web pages and reports containing these conferencias - - Scenario: new conferencia - Given the system has no conferencia entitled "IV Conference on Software Product Lines" - When I create the conferencia "IV Conference on Software Product Lines" with file name "SPLC.pdf" - Then the conferencia "IV Conference on Software Product Lines" is properly stored by the system - - Scenario: duplicate conferencia - Given the conferencia "I International Conference on Software Engineering" is stored in the system with file name "IICSE-0.pdf" - When I create the conferencia "I International Conference on Software Engineering" with file name "IICSE-0.pdf" - Then the conferencia "I International Conference on Software Engineering" is not stored twice - - - Scenario: remove conferencia - Given the conferencia "IV Conference on Software Product Lines" is stored in the system with file name "IICSE-1.pdf" - When I remove the conferencia "IV Conference on Software Product Lines" - Then the conferencia "IV Conference on Software Product Lines" is properly removed by the system - - - Scenario: new conferencia web - Given I am at the publications - When I select the conferencia option at the publications menu - And I select the new conferencia option at the conferencia page - Then I can fill the conferencia details - - Scenario: list conferencia web - Given I am at the publications menu - When I select the conferencia option at the publications menu - Then a list of conferencias stored by the system is displayed at the conferencia page by alphabetic order - -#if ($contextualInformation) - - Scenario: new conferencia web has user data filled by default - Given I am at the publications - When I select the conferencia option at the publications menu - And I select the new conferencia option at the conferencia page - Then I see my user listed as an author member of conferencia by default - -#end - - - Scenario: back to main menu web - Given I am at the publications - When I select the conferencia option at the publications menu - And I select the home option at the conferencia page - Then I am back at the publications and conferencias menu - - Scenario: remove conferencia that does not exist - Given the system has no conferencia entitled "IV Conference on Software Product Lines" - When I try to remove the conferencia "IV Conference on Software Product Lines" - Then nothing happens - - Scenario: remove and create the same conferencia - Given the conferencia "V Conference on Software Product Lines" is stored in the system with file name "IICSE-10.pdf" - When I remove the conferencia "V Conference on Software Product Lines" - And I create the conferencia "V Conference on Software Product Lines" with file name "IICSE-12.pdf" - Then the conferencia "V Conference on Software Product Lines" is properly stored by the system - - Scenario: remove conferencia web - Given I am at the publications menu - When I select the conferencia option at the publications menu - And a list of conferencias stored by the system is displayed at the conferencia page - Then I can remove one conferencia - - Scenario: upload conferencia with a file - Given the system has some conferencias stored - When I upload the conferencias of "curriculo_conferencias.xml" - Then the system has all the conferencias of the xml file - - Scenario: upload conferencias without a file - Given I am at the publications menu - When I select the "Conferencia" option at the program menu - And I select the upload button at the conferencia page - Then I'm still on conferencia page - And the conferencias are not stored by the system - - Scenario: edit existing conference - Given the system has conference entitled "IV Conference on Software Product Lines" with file name "SPLC.pdf" - When I change the conference file from "SPLC.pdf" to "SPLC2.pdf" - Then the conference "IV Conference on Software Product Lines" is properly updated by the system - -Scenario: edit existing conference web - Given I am at the conference page - And the conference "IV Conference on Software Product Lines" is stored in the system with file name "SPLC.pdf" - When I select to view "IV Conference on Software Product Lines" in resulting list - And I change the conference file to "SPLC2.pdf" - And I select the "Alterar" option in Conference Registration Page - And A success message is displayed - Then I am at Conference page - -Scenario: new invalid conference web (fields blank) - Given I am at the conference registration page - When I create the conference with some field blank - Then the conference is not stored by the system because it is invalid - And an error menssage is displayed - -Scenario: list existing conference - Given the system has conference entitled "IV Conference on Software Product Lines" with file name "SPLC.pdf" - When I view the conference list - Then my conference list contains "IV Conference on Software Product Lines" - -Scenario: Order conference web by title - Given I am at the conference page - When I click on the column "title" at the conference list table - then a list of conferences stored by the system is displayed at the conference page by ascending alphabetic order - -Scenario: Order conference web by conference data - Given I am at the conference page - When I click on the column "Date" at the conference list table - then a list of conferences stored by the system is displayed at the conference page by publication ascending date order - -Scenario: Order conference web by research line - Given I am at the conference page - When I click on the column "Research Line" at the conference list table - then a list of conferences stored by the system is displayed at the conference page by ascending alphabetic order - -Scenario: Go to search page - Given I am at the conference page - When I select the Search Conference option - Then I am at the search conference page - -Scenario: Search for conference - Given the system has conference entitled "IV Conference on Software Product Lines" - When I search for the conferencia entitled "IV Conference on Software Product Lines" - Then theres no change in the data stored by the system. - -Scenario: Search for conference web by date - Given I am at the Seach Conference page - And the system has conference dated "2007" - When I write "2007" at the date field - And I select the option Serach for Conference at the conference page - then a list of all conferences containing that date will be presented in the conference screen \ No newline at end of file +@i9n +Feature: conferencia + As a member of a research group + I want to add, remove and modify conferencias I have published + so that I can generate web pages and reports containing these conferencias + + Scenario: new conferencia + Given the system has no conferencia entitled "IV Conference on Software Product Lines" + When I create the conferencia "IV Conference on Software Product Lines" with file name "SPLC.pdf" + Then the conferencia "IV Conference on Software Product Lines" is properly stored by the system + + Scenario: duplicate conferencia + Given the conferencia "I International Conference on Software Engineering" is stored in the system with file name "IICSE-0.pdf" + When I create the conferencia "I International Conference on Software Engineering" with file name "IICSE-0.pdf" + Then the conferencia "I International Conference on Software Engineering" is not stored twice + + + Scenario: remove conferencia + Given the conferencia "IV Conference on Software Product Lines" is stored in the system with file name "IICSE-1.pdf" + When I remove the conferencia "IV Conference on Software Product Lines" + Then the conferencia "IV Conference on Software Product Lines" is properly removed by the system + + + Scenario: new conferencia web + Given I am at the publications + When I select the conferencia option at the publications menu + And I select the new conferencia option at the conferencia page + Then I can fill the conferencia details + + Scenario: list conferencia web + Given I am at the publications + When I select the conferencia option at the publications menu + Then a list of conferencias stored by the system is displayed at the conferencia page by ascending alphabetic order + +#if ($contextualInformation) + + Scenario: new conferencia web has user data filled by default + Given I am at the publications + When I select the conferencia option at the publications menu + And I select the new conferencia option at the conferencia page + Then I see my user listed as an author member of conferencia by default + +#end + + + Scenario: back to main menu web + Given I am at the publications + When I select the conferencia option at the publications menu + And I select the home option at the conferencia page + Then I am back at the publications and conferencias menu + + Scenario: remove conferencia that does not exist + Given the system has no conferencia entitled "IV Conference on Software Product Lines" + When I remove the conferencia "IV Conference on Software Product Lines" + Then the conferencia entitled "IV Conference on Software Product Lines" is not found + + Scenario: remove and create the same conferencia + Given the conferencia "V Conference on Software Product Lines" is stored in the system with file name "IICSE-10.pdf" + When I remove the conferencia "V Conference on Software Product Lines" + And I create the conferencia "V Conference on Software Product Lines" with file name "IICSE-12.pdf" + Then the conferencia "V Conference on Software Product Lines" is properly stored by the system + + Scenario: remove conferencia web + Given I am at the publications + When I select the conferencia option at the publications menu + And a list of conferencias stored by the system is displayed at the conferencia page + Then I can remove one conferencia + + Scenario: upload conferencia with a file + Given the system has some conferencias stored + When I upload the conferencias of "curriculo_conferencias.xml" + Then the system has all the conferencias of the xml file + + Scenario: upload conferencias without a file + Given I am at the publications + When I select the conferencia option at the publications menu + And I select the upload button at the conferencia page + Then I'm still on conferencia page + And the conferencias are not stored by the system + + Scenario: edit existing conferencia + Given the system has conferencia entitled "IV Conference on Software Product Lines" with file name "SPLC.pdf" + When I change the conferencia title from "IV Conference on Software Product Lines" to "IV Conference on Software Product Lines REVIEWED" + Then the conferencia "IV Conference on Software Product Lines" is properly stored by the system + +Scenario: edit existing conferencia web + Given I am at the conferencia page + And the conferencia entitled "IV Conference on Software Product Lines" is stored in the system with file name "SPLC.pdf" + When I select to view the conferencia "IV Conference on Software Product Lines" in resulting list + And I change the conferencia title to "IV Conference on Software Product Lines REVIEWED" + And I select the edit option in Conferencia Registration Page + Then I am at the conferencia page + +Scenario: new invalid conferencia web (fields blank) + Given I am at the conferencia create page + When I create the conferencia with some field blank + Then the conferencia is not stored by the system because it is invalid + +Scenario: list existing conferencia + Given the system has conferencia entitled "IV Conference on Software Product Lines" with file name "SPLC.pdf" + When I check the conferencia list + Then the conferencia list contains "IV Conference on Software Product Lines" + +Scenario: Order conferencia web by title + Given I am at the conferencia page + When I click on the column "title" at the conferencia list table + Then a list of conferencias stored by the system is displayed at the conferencia page by ascending alphabetic order + +Scenario: Order conferencia web by conferencia data + Given I am at the conferencia page + When I click on the column "date" at the conferencia list table + Then a list of conferencias stored by the system is displayed at the conferencia page by publication ascending date order + +Scenario: Search for conferencia + Given the system has conferencia entitled "IV Conference on Software Product Lines" + When I search for the conferencia entitled "IV Conference on Software Product Lines" + Then the conferencia entitled "IV Conference on Software Product Lines" is found + +Scenario: Search for conferencia web + Given I am at the conferencia page + And the system has conferencia dated "2007" + When I write "2007" at the date field + And I select the option Search for conferencia at the conferencia page + Then a list of all conferencias containing the date "2007" will be presented in the conferencia screen diff --git a/test/cucumber/steps/ConferenciaSteps.groovy b/test/cucumber/steps/ConferenciaSteps.groovy index f11e0542..a44aa01e 100644 --- a/test/cucumber/steps/ConferenciaSteps.groovy +++ b/test/cucumber/steps/ConferenciaSteps.groovy @@ -1,147 +1,307 @@ -import cucumber.runtime.PendingException -import pages.Conferencia.ConferenciaCreatePage -import pages.Conferencia.ConferenciaPage -import pages.LoginPage -import pages.PublicationsPage -import rgms.member.Member -import rgms.publication.Conferencia -import steps.TestDataAndOperations -import steps.TestDataAndOperationsPublication -import steps.ConferenciaTestDataAndOperations - -import static cucumber.api.groovy.EN.* - -Given(~'^the system has no conferencia entitled "([^"]*)"$') { String title -> - conferencia = Conferencia.findByTitle(title) - assert conferencia == null -} - -When(~'^I create the conferencia "([^"]*)" with file name "([^"]*)"$') { String title, String filename -> - ConferenciaTestDataAndOperations.createConferencia(title, filename) -} - -Then(~'^the conferencia "([^"]*)" is properly stored by the system$') { String title -> - conferencia = Conferencia.findByTitle(title) - assert ConferenciaTestDataAndOperations.conferenciaCompatibleTo(conferencia, title) -} - -Given(~'^the conferencia "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> - ConferenciaTestDataAndOperations.createConferencia(title, filename) - conferencia = Conferencia.findByTitle(title) - assert conferencia != null -} - -Then(~'^the conferencia "([^"]*)" is not stored twice$') { String title -> - conferencia = Conferencia.findAllByTitle(title) - assert conferencia.size() == 1 -} - -When(~'^I remove the conferencia "([^"]*)"$') { String title -> - ConferenciaTestDataAndOperations.removeConferencia(title) -} - -Then(~'^the conferencia "([^"]*)" is properly removed by the system$') { String title -> - conferencia = Conferencia.findByTitle(title) - assert conferencia == null -} - -Given(~'^I am at the publications$') {-> - LogInToPublication() -} - -def LogInToPublication(){ - to LoginPage - at LoginPage - page.fillLoginData("admin", "adminadmin") - at PublicationsPage -} - -Given(~'^I am at the conferencias page$') {-> - LogInToPublication() - page.select("Conferencia") - at ConferenciaPage -} - -When(~'^I select the conferencia option at the publications menu$') {-> - page.select("Conferencia") -} - -When(~'^I select the new conferencia option at the conferencia page$') {-> - at ConferenciaPage - page.selectNewConferencia() -} - -When(~'^I select the home option at the conferencia page$') {-> - at ConferenciaPage - page.selectHome() -} - -When(~'^I select the conferencia "([^"]*)"$') {String title -> - page.select(title) -} - -When(~'^I click on remove$') {-> - page.select("Remove") -} - -Then(~'^I can fill the conferencia details$') {-> - at ConferenciaCreatePage - page.fillConferenciaDetails() -} - -Then(~'^a list of conferencias stored by the system is displayed at the conferencia page$') {-> - at ConferenciaPage - page.listConferencia() -} - -Then(~'^I can remove one conferencia$') {-> - at ConferenciaPage - page.removeConferencia() -} - -Then(~'^I see my user listed as an author member of conferencia by default$') {-> - at ConferenciaCreatePage - assert TestDataAndOperationsPublication.containsUser(page.selectedMembers()) -} - -Then(~'^I am back at the publications and conferencias menu$') {-> - at PublicationsPage -} - -When(~'^I try to remove the conferencia "([^"]*)"$') { String title -> - assert Conferencia.findByTitle(title) == null -} - -Then(~'^nothing happens$') {-> - -} - -Given(~'^the system has some conferencias stored$') {-> - initialSize = Conferencia.findAll().size() -} -When(~'^I upload the conferencias of "([^"]*)"$') { filename -> - String path = "test" + File.separator + "functional" + File.separator + "steps" + File.separator + filename - initialSize = Conferencia.findAll().size() - ConferenciaTestDataAndOperations.uploadConferencias(path) - finalSize = Conferencia.findAll().size() - assert initialSize < finalSize -} -Then(~'^the system has all the conferencias of the xml file$') {-> - assert Conferencia.findByTitle("Latin American Conference On Computing (CLEI 1992)") != null - assert Conferencia.findByTitle("Engineering Distributed Objects Workshop, 21st ACM International Conference on Software Engineering (ICSE 1999)") != null - assert Conferencia.findByTitle("6th International Conference on Software Reuse (ICSR 2000)") != null - -} - -And(~'^I select the upload button at the conferencia page$') {-> - at ConferenciaPage - page.uploadWithoutFile() -} -Then(~'^I\'m still on conferencia page$') {-> - at ConferenciaPage -} -And(~'^the conferencias are not stored by the system$') {-> - at ConferenciaPage - page.checkIfConferenciaListIsEmpty() - -} \ No newline at end of file +import cucumber.runtime.PendingException +import pages.Conferencia.ConferenciaCreatePage +import pages.Conferencia.ConferenciaPage +import pages.LoginPage +import pages.PublicationsPage +import rgms.member.Member +import rgms.publication.Conferencia +import steps.TestDataAndOperations +import steps.TestDataAndOperationsPublication +import steps.ConferenciaTestDataAndOperations + +import static cucumber.api.groovy.EN.* + +Given(~'^the system has no conferencia entitled "([^"]*)"$') { String title -> + conferencia = Conferencia.findByTitle(title) + assert conferencia == null +} + +Given(~'^the system has conferencia entitled "([^"]*)" with file name "([^"]*)"$') { String title, String filename -> + ConferenciaTestDataAndOperations.createConferencia(title, filename) + conferencia = Conferencia.findByTitle(title) + assert ConferenciaTestDataAndOperations.conferenciaCompatibleTo(conferencia, title) +} + + + + When(~'^I change the conferencia title from "([^"]*)" to "([^"]*)"$') { String title -> + ConferenciaTestDataAndOperations.editConferencia(title) +} + + + + And(~'^I change the conferencia title to "([^"]*)"$') { String newtitle -> + page.select('a', 'edit') + at ConferenceEditPage + page.edit(path + newtitle) +} + + + + Given(~'^I am at the conferencia page$') {-> + at ConferenciaPage +} + + + +And(~'^the conferencia entitled "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> + ConferenciaTestDataAndOperations.createConferencia(title, filename) + conferencia = Conferencia.findByTitle(title) + assert conferencia != null +} + + + +When(~'^I select to view the conferencia "([^"]*)" in resulting list$') { String title -> + page.selectViewConference(title) + at ConferenceShowPage +} + + + + +And(~'^I select the edit option in Conferencia Registration Page$') { String newfile -> + page.select('a', 'edit') + at ConferenciaEditPage +} + + + +Given(~'^I am at the conferencia create page$') {-> + at ConferenciaCreatePage +} + + + +Then(~'^the conferencia is not stored by the system because it is invalid$') { + finalSize = Conferencia.findAll().size() + assert initialSize == finalSize +} + + + +When(~'^I create the conferencia with some field blank$') { + at ConferenciaCreatePage + page.fillConferenciaDetailsPartially() + assert page.isSomeConferenciaFildsBlank() == true +} + + + +When(~'^I create the conferencia "([^"]*)" with file name "([^"]*)"$') { String title, String filename -> + ConferenciaTestDataAndOperations.createConferencia(title, filename) + conferencia = Conferencia.findByTitle(title) + assert conferencia != null +} + +Then(~'^the conferencia "([^"]*)" is properly stored by the system$') { String title -> + conferencia = Conferencia.findByTitle(title) + assert ConferenciaTestDataAndOperations.conferenciaCompatibleTo(conferencia, title) +} + +Given(~'^the conferencia "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> + ConferenciaTestDataAndOperations.createConferencia(title, filename) + conferencia = Conferencia.findByTitle(title) + assert conferencia != null +} + +Then(~'^the conferencia "([^"]*)" is not stored twice$') { String title -> + conferencia = Conferencia.findAllByTitle(title) + assert conferencia.size() == 1 +} + +When(~'^I remove the conferencia "([^"]*)"$') { String title -> + def conferencia = Conferencia.findByTitle(title) + assert conferencia != null + ConferenciaTestDataAndOperations.removeConferencia(title) + testRemoveConferencia = Conferencia.findByTitle(title) + assert testRemoveConferencia == null +} + +Then(~'^the conferencia "([^"]*)" is properly removed by the system$') { String title -> + conferencia = Conferencia.findByTitle(title) + assert conferencia == null +} + +Given(~'^I am at the publications$') {-> + LogInToPublication() +} + +def LogInToPublication(){ + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + at PublicationsPage +} + +Given(~'^I am at the conferencias page$') {-> + LogInToPublication() + page.select("Conferencia") + at ConferenciaPage +} + +When(~'^I select the conferencia option at the publications menu$') {-> + page.select("Conferencia") +} + +When(~'^I select the new conferencia option at the conferencia page$') {-> + at ConferenciaPage + page.selectNewConferencia() +} + +When(~'^I select the home option at the conferencia page$') {-> + at ConferenciaPage + page.selectHome() +} + +When(~'^I select the conferencia "([^"]*)"$') {String title -> + page.select(title) +} + +When(~'^I click on remove$') {-> + page.select("Remove") +} + +Then(~'^I can fill the conferencia details$') {-> + at ConferenciaCreatePage + page.fillConferenciaDetails() +} + +Then(~'^a list of conferencias stored by the system is displayed at the conferencia page$') {-> + at ConferenciaPage + page.listConferencia() +} + +Then(~'^I can remove one conferencia$') {-> + at ConferenciaPage + page.removeConferencia() +} + +Then(~'^I see my user listed as an author member of conferencia by default$') {-> + at ConferenciaCreatePage + assert TestDataAndOperationsPublication.containsUser(page.selectedMembers()) +} + +Then(~'^I am back at the publications and conferencias menu$') {-> + at PublicationsPage +} + + +Then(~'^the conferencia entitled "([^"]*)" is found$') {-> + assert ConferenciaTestDataAndOperations.searchConferencia(title) +} + +Given(~'^the system has some conferencias stored$') {-> + assert conferencia != null + initialSize = Conferencia.findAll().size() +} +When(~'^I upload the conferencias of "([^"]*)"$') { filename -> + String path = "test" + File.separator + "functional" + File.separator + "steps" + File.separator + filename + initialSize = Conferencia.findAll().size() + ConferenciaTestDataAndOperations.uploadConferencias(path) + finalSize = Conferencia.findAll().size() + assert initialSize < finalSize +} +Then(~'^the system has all the conferencias of the xml file$') {-> + assert Conferencia.findByTitle("Latin American Conference On Computing (CLEI 1992)") != null + assert Conferencia.findByTitle("Engineering Distributed Objects Workshop, 21st ACM International Conference on Software Engineering (ICSE 1999)") != null + assert Conferencia.findByTitle("6th International Conference on Software Reuse (ICSR 2000)") != null + +} + +And(~'^I select the upload button at the conferencia page$') {-> + at ConferenciaPage + page.uploadWithoutFile() +} +Then(~'^I\'m still on conferencia page$') {-> + at ConferenciaPage +} +And(~'^the conferencias are not stored by the system$') {-> + at ConferenciaPage + page.checkIfConferenciaListIsEmpty() + +} + + +When(~'^I click on the column "([^"]*)" at the conferencia list table$') {String columnName -> + at ConferenciaPage + page.selectColumn(columnName) +} + + + +Then(~'^a list of conferencias stored by the system is displayed at the conferencia page by publication ascending date order$') {-> + at ConferenciaPage + page.checkIfConferenciaListIsOrderedByDate() +} + + +Given(~'^the system has conferencia entitled "([^"]*)"$') { String title -> + def conferencia = Conferencia.findByTitle(title) + assert conferencia != null +} + + + +Then(~'^a list of conferencias stored by the system is displayed at the conferencia page by ascending alphabetic order$') {-> + at ConferenciaPage + page.checkIfConferenciaListIsOrderedByTitle() +} + + + +When(~'^I select the search conferencia option at the conferencia page$') {-> + at ConferenciaPage + page.selectSearchConferencia() +} + + + +When(~'^I search for the conferencia entitled "([^"]*)"$') { String title -> + assert ConferenciaTestDataAndOperations.searchConferencia(title) +} + + + +Then(~'^the conferencia entitled "([^"]*)" is not found$') { String title -> + assert Conferencia.findByTitle(title) == null +} + + + +And(~'^the system has conferencia dated "([^"]*)"$') {String date-> + conferencia = Conferencia.findByDate(date) + assert conferencia !=null +} + + + +When(~'^I write "([^"]*)" at the date field$') {String date-> + at ConferenciaPage + page.fillDateField(date) +} + + + +When(~'^I select the option Search for conferencia at the conferencia page$') {-> + at ConferenciaPage + page.selectSearchConferencia() +} + + + +Then(~'^a list of all conferencias containing the date "([^"]*)" will be presented in the conferencia screen$') { String date-> + at ConferenciaPage + page.FindByDate(date) +} + + +When(~'^I check the conferencia list$') {-> + def conferencias = Conferencia.findAll() + assert conferencias !=null +} + +Then(~'^the conferencia list contains "([^"]*)"$') {String title-> + def conferencia = Conferencia.findByTitle(title) + assert conferencia !=null +} diff --git a/test/functional/pages/Conferencia/ConferenciaCreatePage.groovy b/test/functional/pages/Conferencia/ConferenciaCreatePage.groovy index 613a2f05..cb5eed42 100644 --- a/test/functional/pages/Conferencia/ConferenciaCreatePage.groovy +++ b/test/functional/pages/Conferencia/ConferenciaCreatePage.groovy @@ -31,8 +31,23 @@ class ConferenciaCreatePage extends FormPage { $("form").title = "A theory of Software Product Line Refinement" $("form").create().click() } - - + + def fillConferenciaDetailsPartially(){ + $("form").title = null + $("form").booktitle = "Theoretical Computer Science" + $("form").pages = null + $("form").create().click() + } + + def boolean isSomeConferenciaFildsBlank(){ + + return ($("form").title == null || $("form").booktitle ==null || + $("form").pages == null) + } + + def selectedMembers() { + $("form").members + } def selectHome() { $('a.home').click() } diff --git a/test/functional/pages/Conferencia/ConferenciaEditPage.groovy b/test/functional/pages/Conferencia/ConferenciaEditPage.groovy new file mode 100644 index 00000000..6f1df60d --- /dev/null +++ b/test/functional/pages/Conferencia/ConferenciaEditPage.groovy @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package pages.Conferencia + +import geb.Page +import pages.GetPageTitle + +/** + * + * @author Micael + */ +class ConferenciaEditPage extends Page{ + + static at = { + GetPageTitle gp = new GetPageTitle() + def currentPeriodico = gp.msg("default.conferencia.label") + def currentTitle = gp.msg("default.edit.label", [currentPeriodico]) + + title ==~ currentTitle + } + + def edit(String newtitle) { + $("form").title = newtitle + assert $("form").name == new_name + } + + def select(String s) { + $("form").find("input", value: s).click() + } +} + diff --git a/test/functional/pages/Conferencia/ConferenciaPage.groovy b/test/functional/pages/Conferencia/ConferenciaPage.groovy index 5ed8c9d4..09e39c1e 100644 --- a/test/functional/pages/Conferencia/ConferenciaPage.groovy +++ b/test/functional/pages/Conferencia/ConferenciaPage.groovy @@ -22,6 +22,23 @@ class ConferenciaPage extends Page{ $('a.list').click() } + def select(String s) { + $('div', id: 'status').find('a', text: s).click() + } + + //verificar pag da tabela + def selectColumn(String s) { + $('div', id: 'column').find('a', text: s).click() + } + + def fillDateField(String date){ + $("form").date = date + } + + def selectSearchConferencia(){ + $('a.search').click() + } + def selectHome() { $('a.home').click() } @@ -38,4 +55,42 @@ class ConferenciaPage extends Page{ assert conferenciaColumns.size() == 0 } + + def checkIfConferenciaListIsOrderedByTitle(){ + def listDiv = $('div', id: 'list-conferencia') + def conferenciaTable = (listDiv.find('table'))[0] + def conferenciaRows = conferenciaTable.find('tbody').find('tr') + + def list = [] + def y = conferenciaRows.size() + def x = 0 + + while(y-- > 0){ + def conferenciaColumns = conferenciaRows[x].find('td') + list.add(articleColumns[0].text()) + x++ + } + def list2 = list.clone() + list2.sort(it.title) + assert list == list2 + } + + def checkIfConferenciaListIsOrderedByDate(){ + def listDiv = $('div', id: 'list-conferencia') + def conferenciaTable = (listDiv.find('table'))[0] + def conferenciaRows = conferenciaTable.find('tbody').find('tr') + + def list = [] + def y = conferenciaRows.size() + def x = 0 + + while(y-- > 0){ + def conferenciaColumns = conferenciaRows[x].find('td') + list.add(articleColumns[1].text()) + x++ + } + def list2 = list.clone() + list2.sort(it.date) + assert list == list2 + } } \ No newline at end of file diff --git a/test/functional/steps/ConferenciaTestDataAndOperations.groovy b/test/functional/steps/ConferenciaTestDataAndOperations.groovy index 39c4009e..ea00c078 100644 --- a/test/functional/steps/ConferenciaTestDataAndOperations.groovy +++ b/test/functional/steps/ConferenciaTestDataAndOperations.groovy @@ -60,7 +60,27 @@ class ConferenciaTestDataAndOperations { conferencia.title == title } } + + static public Conferencia editConferencia(oldtitle, newtitle) { + def conferencia = Conferencia.findByTitle(oldtitle) + conferencia.setTitle(newtitle) + def cont = new ConferenciaController() + cont.params << conferencia.properties + cont.update() + + def updatedconferencia = Conferencia.findByTitle(newtitle) + return updatedconferencia + } + static public Conferencia searchConferencia(String title){ + def conferencia = Conferencia.findByTitle(title) + return conferencia + } + static public boolean containsUser(members){ + def userData = User.findByUsername('admin')?.author?.id.toString() + return members.contains(userData) + } + static public void uploadConferencias(filename) { def cont = new XMLController() def xml = new File(filename);