diff --git a/chromedrivers/chromedriver.exe b/chromedrivers/chromedriver.exe new file mode 100644 index 00000000..d62a3fe3 Binary files /dev/null and b/chromedrivers/chromedriver.exe differ diff --git a/grails-app/controllers/rgms/member/MemberController.groovy b/grails-app/controllers/rgms/member/MemberController.groovy index 9da75bf4..bd1c447a 100644 --- a/grails-app/controllers/rgms/member/MemberController.groovy +++ b/grails-app/controllers/rgms/member/MemberController.groovy @@ -54,7 +54,6 @@ class MemberController { def memberInstance = new Member(params) def userInstance = new User(params) - def password = "" if (!userInstance.passwordHash) { @@ -63,12 +62,13 @@ class MemberController { userInstance.passwordHash = new Sha256Hash(password).toHex() } userInstance.passwordChangeRequiredOnNextLogon = true - if (!memberInstance.save(flush: true)) { + memberInstance.errors.each { + println it + } render(view: "create", model: [userMemberInstanceList: [memberInstance: memberInstance, userInstance: userInstance]]) return } - userInstance.author = memberInstance; if (!userInstance.save(flush: true)) { userInstance.errors.each { @@ -84,10 +84,11 @@ class MemberController { def title = message(code: 'mail.title.create.account') def content = message(code: 'mail.body.create.account', args: [memberInstance.name, params.username, password, createLink(absolute: true, uri: '/')]) + //Not Working EmailService emailService = new EmailService(); - emailService.sendEmail(email, mailSender, title, content) + //emailService.sendEmail(email, mailSender, title, content) - flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.id]) + //flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.id]) redirect(action: "show", id: memberInstance.id) } diff --git a/grails-app/controllers/rgms/publication/TeseController.groovy b/grails-app/controllers/rgms/publication/TeseController.groovy index 5bb89056..3814c134 100644 --- a/grails-app/controllers/rgms/publication/TeseController.groovy +++ b/grails-app/controllers/rgms/publication/TeseController.groovy @@ -14,7 +14,11 @@ class TeseController extends ThesisOrDissertationController { } def save() { - saveThesisOrDissertation("Tese", params) + String file = params['file'] + def format = file.substring(file.indexOf('.')+1,file.size()) + if(format == 'doc' || format == 'pdf') { + saveThesisOrDissertation("Tese", params) + } } def show() { diff --git a/grails-app/controllers/rgms/publication/ThesisOrDissertationController.groovy b/grails-app/controllers/rgms/publication/ThesisOrDissertationController.groovy index 4e134061..88233354 100644 --- a/grails-app/controllers/rgms/publication/ThesisOrDissertationController.groovy +++ b/grails-app/controllers/rgms/publication/ThesisOrDissertationController.groovy @@ -35,8 +35,11 @@ class ThesisOrDissertationController { def saveThesisOrDissertation(String thesisOrDissertation, params) { //noinspection GroovyAssignabilityCheck - def instance = getClassByName(thesisOrDissertation).newInstance(params) - PublicationController pb = new PublicationController() + def instance = null + if(thesisOrDissertation == 'Tese') + instance = new Tese(params) + else + instance = new Dissertacao(params) def duplicated if (thesisOrDissertation == "Tese") { //noinspection GroovyAssignabilityCheck @@ -50,7 +53,10 @@ class ThesisOrDissertationController { render(view: "create", model: [instance: instance]) return } - if (!pb.upload(instance as Publication) || !instance.save(flush: true)) { + if (!instance.save(flush: true)) { + instance.errors.each { + println it + } render(view: "create", model: [instance: instance]) return } diff --git a/test/cucumber/Authentication.feature b/test/cucumber/Authentication.feature index 425b140e..8ae1bb85 100644 --- a/test/cucumber/Authentication.feature +++ b/test/cucumber/Authentication.feature @@ -25,6 +25,11 @@ Scenario: New user register with invalid email fail message When I try to create a "newuser" username with the "invalid email abcde" email Then A message indicating the email is invalid is displayed +Scenario: New user register with a small password + Given I am at the Login Page + When I try to create a "newuser" username with a password less than 5 characters + Then A message indicating the password is too small + Scenario: Try to access Member List Page without being logged in Given I am not logged When I directly access the Member List Page diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index 3624ed38..a0ea4e64 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -4,13 +4,9 @@ Feature: Book I want to add, remove and modify books I have published so that I can generate web pages and reports containing these books - Scenario: new book - Given the system has no book entitled "SPL Development" - When I create the book "SPL Development" with file name "HSPLE.pdf" - Then the book "SPL Development" is properly stored by the system - +@scc Scenario: remove book - Given the book "SPL Development" is stored in the system with file name "NGSPL-2.pdf" + Given the book "SPL Development" is stored in the system with file name "SPL-2.pdf" When I remove the book "SPL Development" Then the book "SPL Development" is properly removed by the system @@ -19,19 +15,15 @@ Feature: Book When I create the book "SPL Development" with file name "NGSPL-0.pdf" Then the book "SPL Development" is not stored twice - Scenario: edit existing book - Given the book "SPL Development" is stored in the system with file name "HSPLE.pdf" - When I edit the book title from "SPL Development" to "New Title" - Then the book "New Title" is properly updated by the system - Scenario: upload book with a file Given the system has no books stored When I upload the books of "curriculo.xml" Then the system has all the books of the xml file - Scenario: new book web - Given I am at the book page - And the system has no book entitled "Next Generation Software Product Line Engineering" - When I go to new book page - And I use the webpage to create the book "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" - Then the book "Next Generation Software Product Line Engineering" was stored by the system \ No newline at end of file + @scc + Scenario: edit existing book with a invalid name + Given the book "SPL Development" is stored in the system with file name "HSPLE.pdf" + When I edit the book title from "SPL Development" to "ESS Book" + And there is already a stored book named "ESS Book" + Then the book "SPL Development" will not be modified + #if ($newBook) diff --git a/test/cucumber/BookChapter.feature b/test/cucumber/BookChapter.feature index 9f21361b..a81f4485 100644 --- a/test/cucumber/BookChapter.feature +++ b/test/cucumber/BookChapter.feature @@ -19,6 +19,14 @@ Feature: BookChapter When I remove the book chapter "Next Generation Software Product Line Engineering" * the book chapter "Next Generation Software Product Line Engineering" is properly removed by the system + #if ($BookChapter) + @mjgfl + Scenario: modify existing book chapter + Given the book chapter "Next Generation Software Product Line Engineering" is stored in the system with file name "NGSPL-2.pdf" + When I edit the book chapter title from "Next Generation Software Product Line Engineering" to "Next Generation Software Product Line Engineering REVIEWED" + Then the book chapter "Next Generation Software Product Line Engineering" is properly updated by the system + #end + Scenario: register book chapter with invalid data Given I am at the book chapter page And I select the new book chapter option at the book chapter page @@ -61,14 +69,4 @@ Feature: BookChapter And the book chapter "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" was created before Then My resulting book chapter list contains "Next Generation Software Product Line Engineering" - Scenario: upload book chapter with a file - Given the system has some book chapters stored - When I upload the book chapters of "curriculo.xml" - Then the system has all the book chapters of the xml file - Scenario: upload book chapters without a file - Given I am at the publications menu - When I select the Book Chapter option at the program menu - And I select the upload button at the book chapter page - Then I'm still on book chapter page - And the book chapters are not stored by the system diff --git a/test/cucumber/Ferramenta.feature b/test/cucumber/Ferramenta.feature index 1db4f31c..6457d2aa 100644 --- a/test/cucumber/Ferramenta.feature +++ b/test/cucumber/Ferramenta.feature @@ -83,3 +83,23 @@ Feature: Ferramenta And fill the others fields with valid values without Titulo Then I am still on create new ferramenta page And the ferramenta is not displayed in the ferramentas list page + + #if($ferramentaWithWebsite) + @vddm + Scenario: new ferramenta with website + Given the system has no ferramenta entitled "Target" + When I create the ferramenta "Target" with file name "target.pdf" with "www.targed.com" as its website + Then the ferramenta "Target" is stored + + #if($list) + @vddm + Scenario: list ferramenta web + Given I am at the publications menu + When I select the "Ferramenta" option at the publications menu + And I select the "create" option at the ferramenta page + Then I can create a ferramenta with name "Joee" + And I select the "create" option at the show page + And I can create a ferramenta with name "Joee1" + When I select the "list" option at the show page + Then I can see all existing ferramentas in the system and the "Joee" and "Joee1" ferramentas + #end diff --git a/test/cucumber/Funder.feature b/test/cucumber/Funder.feature index be8c4fe8..0a4df0ff 100644 --- a/test/cucumber/Funder.feature +++ b/test/cucumber/Funder.feature @@ -18,6 +18,7 @@ Feature: Funder When I create a funder with code "12345" Then there is only one funder with code "12345" in the system + Scenario: new funder web Given I am at the create funder page When I fill the funder code with "12345" diff --git a/test/cucumber/Member.feature b/test/cucumber/Member.feature index 239da9ff..ba6c35d5 100644 --- a/test/cucumber/Member.feature +++ b/test/cucumber/Member.feature @@ -32,7 +32,14 @@ Feature: member Given I am at the login page When I fill username and password with "admin" and "incorrectpassword" Then I am still on the login page with an error message - + +#if($nonexisting) + Scenario: login with nonexisting username + Given I am at the login page + When I fill username and password with "nonexistingusername" and "password" + Then I am still on the login page with an error message +#end + Scenario: user registration Given I am at the register page When I fill the user details with a name, username, passoword1, password2, email, university, status "jose" "josesilva" "123456" "123456" "jose@ufpe.br" "UFPE" "Graduate Student" @@ -51,22 +58,39 @@ Feature: member When I fill some user details with "jose" "josesilva" "jose@ufpe.br" "UFPE" Then I am still on the create member page with the error message - Scenario: register user with invalid data +#if($longUsername) + Scenario: register user with long username Given I am at the create member page - When I fill the user details with "jose" "josesilva" "jose@com" "UFPE" - Then I am still on the create member page with the error message - - -#Scenario: register member invalid aditional info -# Given I am at the create member page -# When I fill many user details with "berg" "bergU" "jus@cin.ufpe.br" "UFPE" "ajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -# Then I am still on the create member page with the error message - -#Scenario: new member with invalid phone -# Given the system has no member with username "userwithinvalidphone" -# When I create a member with username "userwithinvalidphone" -# Then I am still on the create member page with the error message + When I fill the username with "josedmskejfjsdifejfje" + Then I am still on the create member page + #And a long username error message is displayed +#end +#if($invalidEmail) + Scenario: register member with invalid email + Given I am at the create member page + When I fill the email with "lalala.la" + Then I am still on the create member page + And a invalid email error message is displayed +#end + +#if($invalid info) +Scenario: register member invalid info + Given I am at the create member page + When I fill city with "321" + And I fill country with "123" + Then I am still on the create member page + And a "no numbers in city and country allowed" error message is displayed +#end + +#if($invalidPhone) +Scenario: new member with invalid phone + Given I am at the create member page + When I fill the phone with "camilasouto" + Then I am still on the create member page + And a invalid phone message is displayed +#end + #if ($contextualInformation) Scenario: new member filled with default data Given I am at the create member page @@ -75,4 +99,29 @@ Feature: member Scenario: user registration with default data Given I am at the register page Then I see default data filled on register form -#end \ No newline at end of file +#end + +#if($memberInfo) +@vddm +Scenario: editing member information + Given the system has member with "Victor Monteiro","rgmsTest", "rgmsTest@gmail.com", "UFPE", "12345", "www.g.com.br", "Brazil", "Graduate Student" + When I edit the "rgmsTest@gmail.com"'s "email" for "rgms@gmail.com" + Then "rgms@gmail.com"'s information is updated and saved in the system + +@vddm +Scenario: editing member + Given I am at the member page + When I click the "1" member id + And I Click the option "edit" on Member Edition Page + And I change the member's "name" by "Victor Monteiro" + Then I can see the member's name is now "Victor Monteiro" +#end + +#if($loginfacebook) + Scenario: new member with facebook account + Given I am at the create member page + And I am logged on "Camila Souto" facebook + When I click on "register with facebook" + Then the member "Camila Souto" is properly stored by the system +#end + diff --git a/test/cucumber/News.feature b/test/cucumber/News.feature index ff54e938..3c895861 100644 --- a/test/cucumber/News.feature +++ b/test/cucumber/News.feature @@ -34,6 +34,11 @@ Feature: news When I request to update the news from Twitter to research group "SPG" Then news of "SPG" research group has been updated + Scenario: disintegrate Twitter account + Given the research group "SPG" in the system has a Twitter account associated + When When I disassociate account "HumanBrainProj" group to "SPG" + Then "SPG" research group has a twitter account "@HumanBrainProj" registered + Scenario: consecutive update without duplicate news Given the research group "SPG" in the system has a Twitter account "@HumanBrainProj" associated And twitter account associated with "SPG" research group has been updated once @@ -60,6 +65,14 @@ Feature: news When I edit the news with description "noticiaTeste" to "newDescription", date "07-04-2012" and "SPG" research group Then the news "newDescription", date "07-04-2012" and "SPG" research group is properly updated by the system + + Scenario: edit existing news with a invalid description + Given the system has a news with description "noticiaTeste" and date "07-04-2012" for "SPG" research group + When I edit the news with description "noticiaTeste" to "newDescription", date "07-04-2012" and "SPG" research group + And the news "newDescription", date "07-04-2012" and "SPG" research group already exist + Then the news "noticiaTeste", date "07-04-2012" and "SPG" will not be be edited + + Scenario: remove existing news web Given I am at the publications menu When I select the news page @@ -67,7 +80,7 @@ Feature: news And I select the option to remove in news show page Then the news "Noticia1" is properly removed by the system - Scenario: new invalid news (invalid date) + Scenario: new invalid news (invalid description) Given the system has no news with description "teste" and date "31-02-2013" for "SPG" research group When I try to create a news with description "teste" and date "31-02-2013" for "SPG" research group Then the news with description "teste", date "31-02-2013" and "SPG" research group is not stored by the system because it is invalid diff --git a/test/cucumber/ResearchGroup.feature b/test/cucumber/ResearchGroup.feature index 00b98a39..b6f18493 100644 --- a/test/cucumber/ResearchGroup.feature +++ b/test/cucumber/ResearchGroup.feature @@ -37,37 +37,58 @@ Feature: research group When I modify the name of research group entitled "modcs-3" to none Then the research group is not stored in the system because it has no name + #if ($ResearchGroup) + Scenario: editing the researchgroup's name to a invalid name by size + Given the system has a research group entitled "modcs-3" with the description "modcs-3 research group" stored in the system + When I modify the name of research group entitled "modcs-3" to "modcs 123456789" + Then the research group "modcs 123456789" is not stored in the system because exceeds the number of characters allowed + #end - Scenario:edit research group + #if ($ResearchGroup) + Scenario:edit research group Given the system has a research group entitled "modcs" with the description "modcs research group" stored in the system - When I modify the research group entitled "modcs" to "modcs 123" and its description to "modcs research group 1234" + When I modify the research group entitled "modcs" to "modcs 123" + And I modify its description to "modcs research group 1234" Then the edited research group "modcs 123" with description "modcs research group 1234" is properly stored in the system - + #end + Scenario:delete research group Given the system has a research group entitled "modcs" with the description "modcs research group" stored in the system When I delete the research group entitled "modcs" Then the research group "modcs" is properly deleted of the system - + + Scenario: new research group and show via web browser Given I am at the publications menu When I select the "Research Group" option at the publications menu And I select the new research group option at research group list page Then I can fill the research group details with name "modcs" and create a new one + + #if($ResearchGroup) + Scenario: new invalid search group web (name field exceeded the limit of characters) + Given I am at the new Research Group page + When I fill all group information + And I fill the field name with "mdocs 123456789" + And I select to create the group + Then an error message is showed for the name field + #end + #if($ResearchGroup) Scenario: show research group via web browser - Given I am at the publications menu + Given I am at Research Group list menu And the system has a Research Group named "grupo" stored in the system - And I am at Research Group list menu And I select a research group called "grupo" Then the system will show the details of this research group + #end + #if($ResearchGroup) Scenario: edit research group via web browser - Given I am at the publications menu + Given I am at Research Group list menu And the system has a Research Group named "PESQUISA" stored in the system - And I am at Research Group list menu When I select a research group called "PESQUISA" And I select the edit option Then I can change the research group name to "rgms" and save it + #end diff --git a/test/cucumber/ResearchLine.feature b/test/cucumber/ResearchLine.feature index 7e13bd62..ff9396e0 100644 --- a/test/cucumber/ResearchLine.feature +++ b/test/cucumber/ResearchLine.feature @@ -47,11 +47,14 @@ Feature: research line Then I can change the research line "Teoria da informacao - Complexidade no espaco" details #if ($XMLImport) - @ignore - Scenario: upload research lines with a file - Given the system has some research line stored - When I upload new research lines from the file "testelattes2.xml" - Then the system has more research lines now + #if($upload) + @vddm + Scenario: upload research lines with a file + Given the system has some research line stored + When I upload new research lines from the file "testelattes2.xml" + Then the system keep the old reserch lines and has more research lines now + + #end Scenario: upload research lines without a file Given I am at the publications menu @@ -59,4 +62,6 @@ Feature: research line And I select the upload button at the research line page Then I'm still on the research line page And an error message is showed at the research line page - #end \ No newline at end of file + #end + + diff --git a/test/cucumber/Thesis.feature b/test/cucumber/Thesis.feature index e664276f..a1277715 100644 --- a/test/cucumber/Thesis.feature +++ b/test/cucumber/Thesis.feature @@ -5,13 +5,17 @@ Feature: Thesis Tests Scenario: new thesis duplicated Given The thesis "Thesis duplicated" is stored in the system with file name "Thesisduplicated.txt" - When I create the thesis "Thesis duplicated" with file name "Thesisduplicated2.txt" and school "UFPE" + When I create the thesis "Thesis duplicated" with file name "Thesisduplicated2.txt" Then The thesis "Thesis duplicated" is not stored twice - Scenario: new thesis - Given The system has no thesis entitled "New thesis" - When I create the thesis "New thesis" with file name "Newthesis.txt" and school "UFPE" - Then The thesis "New thesis" is properly stored by the system + #if($thesis) + @vddm + Scenario: new thesis + Given The system has no thesis entitled "New thesis" + When I create the thesis "New thesis" with file name "NewthesisGUI.txt" + And I create the thesis "New thesis2" with file name "NewThesis.pdf" + Then The thesis "New thesis" not is properly stored by the system, but "New thesis2" is + #end Scenario: remove existing thesis Given the system has thesis entitled "New thesis2" @@ -77,29 +81,33 @@ Feature: Thesis Tests @ignore Scenario: edit thesis title - Given the system has thesis entitled "My Thesis" + Given The thesis "My Thesis" is stored in the system with file name "Joee.pdf" When I change the title from "My Thesis" to "My Thesis Renamed" Then the thesis entitled "My Thesis Renamed" is properly renamed by the system And the other theses are not changed by the system @ignore Scenario: edit thesis with invalid data - Given the system has thesis entitled "My Thesis" + Given The thesis "My Thesis" is stored in the system with file name "Joee.pdf" When I change the title from "My Thesis" to "" Then the existing thesis are not changed by the system - @ignore - Scenario: search a thesis - Given the system has one thesis entitled "My Thesis" - When I search for thesis entitled "My Thesis" - Then the existing thesis are not changed by the system + #if($search) + @vddm + Scenario: search a thesis + Given The thesis "My Thesis" is stored in the system with file name "Joee.pdf" + When I search for thesis entitled "My Thesis" + Then the "My Thesis" thesis is returned by the system + #end - @ignore - Scenario: upload thesis with a file - Given The system has no thesis entitled "My Thesis" - When I upload the file "My Thesis.xml" - Then the existing thesis are not changed by the system - And the system stores properly the thesis entitled "My Thesis" + #if($fileThesis) + @vddm + Scenario: upload existing thesis with a file + Given The thesis "New thesis" is stored in the system with file name "Joee.pdf" + When I upload the file "Newthesis.pdf" to "New thesis" + Then the file "Joee.pdf" associated with the existing thesis "New thesis" is replaced by "Newthesis.pdf" + #end + # editar dados de uma tese, ordenar lista de teses, filtrar lista de teses, # criar tese com dados inválidos, a chave é mesmo o título da tese?, tamanho # dos campos, o dia e o arquivo deveriam ser opcional, deveria poder adicionar diff --git a/test/cucumber/Visit.feature b/test/cucumber/Visit.feature index 2ddf3bdc..4343c369 100644 --- a/test/cucumber/Visit.feature +++ b/test/cucumber/Visit.feature @@ -50,11 +50,13 @@ Feature: Visit Then the visit details are showed and I can select the option to remove And the visit of the visitor named "Person" with initial date "11/11/2000" and final date "12/11/2000" is properly removed by the system + #if($Visit) Scenario: edit existing visit - Given the system has visitor named "Person" - And a visit for the visitor "Person" with initial date "11/11/2000" and final date "12/11/2000" + Given the system has a visitor named "Person" + And the visit of the visitor named "Person" with initial date "11/11/2000" and final date "12/11/2000" is stored in the system When I edit the visit of the visitor named "Person" with initial date "11/11/2000" and final date "12/11/2000" to the visitor named "Person Updated" Then the visit of the visitor named "Person" with initial date "11/11/2000" and final date "12/11/2000" is properly updated by the system + #end Scenario: edit existing visit web Given I am logged as "admin" and at the visits page diff --git a/test/cucumber/steps/BookChapterSteps.groovy b/test/cucumber/steps/BookChapterSteps.groovy index 1ef01632..ea27ec82 100644 --- a/test/cucumber/steps/BookChapterSteps.groovy +++ b/test/cucumber/steps/BookChapterSteps.groovy @@ -28,6 +28,20 @@ Given(~'^the book chapter "([^"]*)" is stored in the system with file name "([^" assert bookChapter != null } +//mjgfl +When(~'^I edit the book chapter title from "([^"]*)" to "([^"]*)"$') { String title, + newtitle -> + BookChapterTestDataAndOperations.editBookChapterTitle(title, newtitle) +} + +Then(~'^the book chapter "([^"]*)" is properly updated by the system$'){String title -> + def book = BookChapter.findByTitle(title) + assert book == null + //era != +} + +//mjgfl - end + Then(~'^the book chapter "([^"]*)" is not stored twice$') { String title -> bookChapters = BookChapter.findAllByTitle(title) assert bookChapters.size() == 1 diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 45aae835..837da7be 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -10,7 +10,9 @@ import pages.BookCreatePage import pages.BookPage import pages.LoginPage import pages.PublicationsPage +import pages.ferramenta.BookShowPage import rgms.publication.Book +import steps.BookChapterTestDataAndOperations import steps.BookTestDataAndOperations import static cucumber.api.groovy.EN.* @@ -103,6 +105,31 @@ Then(~'^the book "([^"]*)" was stored by the system$') { String title -> at BookPage } +//simone +When(~'^I select the option to remove book "([^"]*)"$') {-> + atBookPage + page.select('input', 'delete') +} + +Then(~'^the system removes the book "([^"]*)"$'){String title -> + BookTestDataAndOperations.removeBook(title) +} + +//end simone + +//leo + +And(~'^there is already a stored book named "([^"]*)"$') { String title -> + book = Book.findByTitle(title) + assert book != null +} + +Then(~'^the book "([^"]*)" will not be modified$') { String title -> + assert Book.findByTitle(title) == null +} +//end leo + + def checkIfExists(String title) { book = Book.findByTitle(title) assert book == null diff --git a/test/cucumber/steps/FerramentaSteps.groovy b/test/cucumber/steps/FerramentaSteps.groovy index d19739b9..ebfcdd48 100644 --- a/test/cucumber/steps/FerramentaSteps.groovy +++ b/test/cucumber/steps/FerramentaSteps.groovy @@ -86,14 +86,19 @@ When(~'^I select "([^"]*)" at the ferramenta page$') { String title -> page.selectFerramenta(title) } -// new ferramenta web -When(~'^I select the new ferramenta option at the ferramenta page$') {-> +When(~'^I select the "([^"]*)" option at the ferramenta page$') {String option-> at FerramentaPage - page.selectNewFerramenta() + page.select(option) } -Then(~'^I can create a ferramenta filling the details$') {-> + +When(~'^I select the "([^"]*)" option at the show page$') {String option-> + at FerramentaShowPage + page.select(option) +} + +Then(~'^I can create a ferramenta with name "([^"]*)"$') {String name-> at FerramentaCreatePage - page.createNewFerramenta("CCFinder") + page.createNewFerramenta(name) } // new ferramenta without any information @@ -151,3 +156,21 @@ And(~'^fill the others fields with valid values without Titulo$') {-> at FerramentaCreatePage page.fillFerramentaDetailsWithoutTitle("Tool without title") } + +//new ferramente with website +//By VDDM +//Given already implemented +When(~'^I create the ferramenta "([^"]*)" with file name "([^"]*)" with "([^"]*)" as its website$') { String title, String filename, String website -> + FerramentaTestDataAndOperations.createFerramenta(title, filename,website) +} +Then(~'^the ferramenta "([^"]*)" is stored$') { String title -> + def tool = Ferramenta.findByTitle(title) + assert tool != null +} + +//List ferramentas +//By VDDM +Then(~'^I can see all existing ferramentas in the system and the "([^"]*)" and "([^"]*)" ferramentas$') {String name1,String name2 -> + at FerramentaPage + page.checkFerramentaList(name1, name2) +} \ No newline at end of file diff --git a/test/cucumber/steps/FunderSteps.groovy b/test/cucumber/steps/FunderSteps.groovy index 255232e7..619d2e31 100644 --- a/test/cucumber/steps/FunderSteps.groovy +++ b/test/cucumber/steps/FunderSteps.groovy @@ -3,6 +3,7 @@ import pages.funder.FunderCreatePage import pages.funder.FunderPage import rgms.researchProject.Funder import steps.FunderTestDataAndOperations +import sun.security.util.PendingException import static cucumber.api.groovy.EN.* @@ -22,7 +23,7 @@ Then(~'^the funder with code "([^"]*)" is properly stored by the system$') { Str checkIfFunderExists(code) } -//remove funder +//remove funder - cscbb Given(~'^the system has funder with code "([^"]*)"$'){String code -> funder = Funder.findByCode(code) if(!funder){ @@ -36,13 +37,13 @@ When(~'^I remove a funder with code "([^"]*)"$'){ String code -> funder.delete() } - +//cscbb //duplicate funder Then(~'^there is only one funder with code "([^"]*)" in the system$') { String code -> assert Funder.findAllByCode(code).size() == 1 } - +//cscbb //new funder web Given(~'^I am at the create funder page$'){ -> goToFunderCreatePage() @@ -77,4 +78,4 @@ private void fillCodefield(String code){ private void clickSave(){ at FunderCreatePage page.selectSave() -} \ No newline at end of file +} diff --git a/test/cucumber/steps/MemberSteps.groovy b/test/cucumber/steps/MemberSteps.groovy index 210c1aa6..eac41ba6 100644 --- a/test/cucumber/steps/MemberSteps.groovy +++ b/test/cucumber/steps/MemberSteps.groovy @@ -1,6 +1,10 @@ import pages.LoginPage +import pages.PublicationsPage import pages.RegisterPage import pages.member.MemberCreatePage +import pages.member.MemberEditionPage +import pages.member.MemberListPage +import pages.member.MemberPage import pages.member.MemberViewPage import rgms.authentication.User import rgms.member.Member @@ -191,4 +195,43 @@ When(~'^I try to create the member "([^"]*)" with email "([^"]*)"$') { String na MemberTestDataAndOperations.createMemberWithEmail(name, email) //member = Member.findByEmail(email) //assert member.name == name +} + +//Edit editing member information +//By VDDM +Given(~'^the system has member with "([^"]*)","([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$'){String name, String username, String email, String IES, String phone, String website, String country, String status-> + MemberTestDataAndOperations.createMember(name,username,email,phone,IES,website,country,status) +} +When (~'^I edit the "([^"]*)"\'s "([^"]*)" for "([^"]*)"$'){ String emailKey, String option, String value -> + def newMember = MemberTestDataAndOperations.editMember(emailKey,option,value) + assert newMember != null +} +Then (~'^"([^"]*)"\'s information is updated and saved in the system$'){ String emailKey -> + def newMember = Member.findByEmail(emailKey) + assert newMember != null +} +// editing member +//BY VDDM +Given(~'^I am at the member page$'){-> + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + at PublicationsPage + page.select("Member") +} +When(~'^I click the "([^"]*)" member id$'){String number-> + at MemberListPage + page.selectNthMember(number) +} +And(~'^I Click the option "([^"]*)" on Member Edition Page$'){String option-> + at MemberPage + page.select(option) +} +And(~'^I change the member\'s "([^"]*)" by "([^"]*)"$'){String option, String value-> + at MemberEditionPage + page.editMemberInformation(option,value) +} +Then(~'^I can see the member\'s name is now "([^"]*)"$'){String name-> + at MemberPage + page.checkName(name) } \ No newline at end of file diff --git a/test/cucumber/steps/ResearchLineSteps.groovy b/test/cucumber/steps/ResearchLineSteps.groovy index ce84ed8b..27458637 100644 --- a/test/cucumber/steps/ResearchLineSteps.groovy +++ b/test/cucumber/steps/ResearchLineSteps.groovy @@ -118,7 +118,7 @@ When(~'^I upload new research lines from the file "([^"]*)"$') { filename -> ResearchLineTestDataAndOperations.uploadResearchLine(path + filename) } -Then(~'^the system has more reseach lines now$'){ -> +Then(~'^the system keep the old reserch lines and has more research lines now$'){ -> TestDataAndOperations.logoutController(this) finalSize = ResearchLine.findAll().size() assert (finalSize - initialSize) == 5 //If all researchlines was imported, we will have 5 more than before diff --git a/test/cucumber/steps/ThesisSteps.groovy b/test/cucumber/steps/ThesisSteps.groovy index 90129b91..62f3e84a 100644 --- a/test/cucumber/steps/ThesisSteps.groovy +++ b/test/cucumber/steps/ThesisSteps.groovy @@ -7,27 +7,23 @@ import pages.thesis.ThesisShowPage import rgms.authentication.User import rgms.publication.Tese import steps.TestDataAndOperationsPublication +import steps.ThesisOrDissertationTestDataAndOperations import steps.ThesisTestDataAndOperations import static cucumber.api.groovy.EN.* +import static cucumber.api.groovy.EN.Then Given(~'^The system has no thesis entitled "([^"]*)"$') { String title -> article = Tese.findByTitle(title) assert article == null } -Given(~'^The thesis "([^"]*)" is stored in the system with file name "([^"]*)"$') { - String title, filename -> - ThesisTestDataAndOperations.createTese(title, filename, "UFPE") - article = Tese.findByTitle(title) +Given(~'^The thesis "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, filename -> + ThesisOrDissertationTestDataAndOperations.createThesisOrDissertation(title, filename) + def article = Tese.findByTitle(title) assert article != null } -When(~'^I create the thesis "([^"]*)" with file name "([^"]*)" and school "([^"]*)"$') { - String title, filename, school -> - ThesisTestDataAndOperations.createTese(title, filename, school) -} - Then(~'^The thesis "([^"]*)" is not stored twice$') { String title -> theses = Tese.findAllByTitle(title) assert theses.size() == 1 @@ -136,12 +132,6 @@ Then(~'^the thesis "([^"]*)" is removed from the system$') { title -> thesisDoNotExists(title) } -// #6 -Given(~'^the system has thesis entitled "([^"]*)"$') { title -> - ThesisTestDataAndOperations.createTese(title, 'teste.txt', 'UFPE') - thesis = Tese.findByTitle(title) - assert thesis != null -} When(~'^I delete the thesis "([^"]*)"$') { title -> ThesisTestDataAndOperations.deleteTeseByTitle(title) @@ -249,15 +239,13 @@ And(~'^the other theses are not changed by the system$') { -> } //Scenario: edit thesis with invalid data -Then(~'^the existing thesis are not changed by the system$') { -> - +Then(~'^the existing thesis are not changed by the system$') {-> } -//Scenario: search a thesis -Given(~'^the system has one thesis entitled "([^"]*)"$') { title -> -} When(~'^I search for thesis entitled "([^"]*)"$') { title -> + def thesis = Tese.findByTitle(title) + assert thesis != null } //Scenario: upload thesis with a file @@ -269,6 +257,33 @@ And(~'^the system stores properly the thesis entitled "([^"]*)"$') { title -> } +//new thesis with correct format file +//BY vddm +When(~'^I create the thesis "([^"]*)" with file name "([^"]*)"$') {String name1, String file1 -> + ThesisOrDissertationTestDataAndOperations.createThesisOrDissertation(name1,file1) +} +Then(~'^The thesis "([^"]*)" not is properly stored by the system, but "([^"]*)" is$'){String name1, String name2 -> + def thesis1 = Tese.findByTitle(name1) + def thesis2 = Tese.findByTitle(name2) + assert thesis1 == null && thesis2 != null +} +//search Thesis +//By vddm +Then(~'^the "([^"]*)" thesis is returned by the system$'){String name -> + def thesis = Tese.findByTitle(name) + assert thesis != null +} + +//upload existing thesis with a file +//BY vddm +When(~'^I upload the file "([^"]*)" to "([^"]*)"$') {String file, String name -> + ThesisOrDissertationTestDataAndOperations.editThesisOrDissertation("file",file,name) +} +Then(~'^the file "([^"]*)" associated with the existing thesis "([^"]*)" is replaced by "([^"]*)"$'){String oldFile, String title, String newFile-> + def file1 = Tese.findByTitle(title).file + assert file1 != oldFile && file1 == newFile +} + //FUNÇÔES AUXILIARES def thesisDoNotExists(title) { tese = Tese.findByTitle(title) diff --git a/test/functional/pages/ferramenta/FerramentaCreatePage.groovy b/test/functional/pages/ferramenta/FerramentaCreatePage.groovy index 10920527..37f1b6cd 100644 --- a/test/functional/pages/ferramenta/FerramentaCreatePage.groovy +++ b/test/functional/pages/ferramenta/FerramentaCreatePage.groovy @@ -34,6 +34,7 @@ class FerramentaCreatePage extends FormPage { fillFerramentaTitle(title) fillFerramentaDescription("Description") fillFerramentaWebsite("website") + fillFerramentaFile(title) clickCreateFerramenta() } diff --git a/test/functional/pages/ferramenta/FerramentaPage.groovy b/test/functional/pages/ferramenta/FerramentaPage.groovy index 477309c7..db16fbb9 100644 --- a/test/functional/pages/ferramenta/FerramentaPage.groovy +++ b/test/functional/pages/ferramenta/FerramentaPage.groovy @@ -1,6 +1,7 @@ package pages.ferramenta import geb.Page +import rgms.publication.Ferramenta class FerramentaPage extends Page { static url = "ferramenta/list" @@ -12,8 +13,8 @@ class FerramentaPage extends Page { static content = { } - def selectNewFerramenta() { - $('a.create').click() + def select(String s){ + $('a.' + s).click(); } def selectFerramenta(String s) { @@ -29,10 +30,30 @@ class FerramentaPage extends Page { def checkFirstFerramentaNameAtList(name){ def listDiv = $('div', id: 'list-ferramenta') - def ferramentaTable = (listDiv.find('table'))[0] + def ferramentaTable = (listDiv.find('table')) def ferramentaRows = ferramentaTable.find('tbody').find('tr') def ferramentaColumns = ferramentaRows[1].find('td') assert ferramentaColumns[1].text() == name } + + def checkFerramentaList(String name1, name2){ + def list = $('div', id: 'list-ferramenta').find('table').find('tbody').find('tr') + int exist = 0 + def listWeb = [] + for(int i = 0; i < list.size(); i++){ + def title = list[i].find('td')[0].text() + def file = list[i].find('td')[2].text() + def website = list[i].find('td')[4].text() + def f = new Ferramenta() + f.website = website + f.file = file + f.title = title + listWeb.add(i,f) + if(title == name1 || title == name2) exist++ + } + + def listSystem = Ferramenta.findAll() + assert listWeb == listSystem && exist == 2 + } } diff --git a/test/functional/pages/ferramenta/FerramentaShowPage.groovy b/test/functional/pages/ferramenta/FerramentaShowPage.groovy index f59a5823..7a56d7e4 100644 --- a/test/functional/pages/ferramenta/FerramentaShowPage.groovy +++ b/test/functional/pages/ferramenta/FerramentaShowPage.groovy @@ -13,6 +13,10 @@ class FerramentaShowPage extends Page{ static content = { } + def select(String s){ + $('a.' + s).click(); + } + def editFerramenta(){ $('a.edit').click() } diff --git a/test/functional/pages/member/MemberEditionPage.groovy b/test/functional/pages/member/MemberEditionPage.groovy index f39cfda6..d6e94d15 100644 --- a/test/functional/pages/member/MemberEditionPage.groovy +++ b/test/functional/pages/member/MemberEditionPage.groovy @@ -18,6 +18,12 @@ class MemberEditionPage extends Page { searchSubmitButton { memberform.find(".buttons.button.save")} } + def editMemberInformation(String type, String value){ + if(type == 'name') + $('form').name = value + $('input', type: 'submit', class: 'save').click() + } + def editEnableUser(String userName){ def member = TestDataAndOperations.findByUsername(userName) diff --git a/test/functional/pages/member/MemberListPage.groovy b/test/functional/pages/member/MemberListPage.groovy index d0452ac1..6b9a743c 100644 --- a/test/functional/pages/member/MemberListPage.groovy +++ b/test/functional/pages/member/MemberListPage.groovy @@ -26,4 +26,8 @@ class MemberListPage extends Page { $("a", text: member).click() } + def selectNthMember(String number){ + $('a', text: number).click() + } + } diff --git a/test/functional/pages/member/MemberPage.groovy b/test/functional/pages/member/MemberPage.groovy index 59efb81d..accc30f3 100644 --- a/test/functional/pages/member/MemberPage.groovy +++ b/test/functional/pages/member/MemberPage.groovy @@ -17,6 +17,15 @@ class MemberPage extends Page { static content = { } + def select(String option){ + $('input.' + option).click() + } + + def checkName(String value){ + def name = $('td.value')[0].text() + assert value == name + } + def checkPdf() { def pdf = $('form').find([title: "PDF"]) assert pdf != null diff --git a/test/functional/pages/visit/BookShowPage.groovy b/test/functional/pages/visit/BookShowPage.groovy new file mode 100644 index 00000000..9c599a39 --- /dev/null +++ b/test/functional/pages/visit/BookShowPage.groovy @@ -0,0 +1,38 @@ +package pages.ferramenta + +import geb.Page +import rgms.publication.Ferramenta + +class BookShowPage extends Page{ + static url = "book/show" + + static at = { + title ==~ /Ver Book/ + } + + static content = { + } + + def select(String s){ + $('a.' + s).click(); + } + + def editBook(){ + $('a.edit').click() + } + + def deleteBook(){ + assert withConfirm(true) { + $('input.delete').click() + } + } + + def checkBookTitle(title){ + def listInformations = $('ol', class : 'book') + def rowTitle = (listInformations.find('li'))[0] + def titleBook = rowTitle.find('span', class: 'property-value') + + def editedBook = Book.findByTitle(title) + assert titleBook.text() == editedBook.title + } +} diff --git a/test/functional/steps/ArticleTestDataAndOperations.groovy b/test/functional/steps/ArticleTestDataAndOperations.groovy index 390bd57f..6f1b779b 100644 --- a/test/functional/steps/ArticleTestDataAndOperations.groovy +++ b/test/functional/steps/ArticleTestDataAndOperations.groovy @@ -41,12 +41,24 @@ class ArticleTestDataAndOperations { cont.response.reset() } + //scc + static public int nullOrNot(def testarticle, article) { + if(testarticle == null && article == null) { + return 0; + } else if (testarticle != null && article != null) { + return 1; + } else { + return 2; + } + } + + //scc static public boolean compatibleTo(article, title) { def testarticle = findArticleByTitle(title) def compatible = false - if (testarticle == null && article == null) { + if (nullOrNot(testarticle, article) == 0) { compatible = true - } else if (testarticle != null && article != null) { + } else if (nullOrNot(testarticle, article)) { compatible = true testarticle.each { key, data -> compatible = compatible && (article."$key" == data) @@ -55,6 +67,7 @@ class ArticleTestDataAndOperations { return compatible } + static public void createArticle(String title, filename) { createArticle(title,filename, null,null) } diff --git a/test/functional/steps/BookChapterTestDataAndOperations.groovy b/test/functional/steps/BookChapterTestDataAndOperations.groovy index f4a0a0c7..ba4c2679 100644 --- a/test/functional/steps/BookChapterTestDataAndOperations.groovy +++ b/test/functional/steps/BookChapterTestDataAndOperations.groovy @@ -30,6 +30,32 @@ class BookChapterTestDataAndOperations { } } + + static public int isNull (def Ch, BookChapter book) { + if(Ch == null && book == null) { + return 0; + } else if (Ch != null && book != null) { + return 1; + } else { + return 2; + } + } + + static public boolean bookChapterCompatibleTo(bookChapter, String title) { + def testBookChapter = findBookChapterByTitle(title) + def compatible = false + if (isNull(testBookChapter, bookChapter) == 0) { + compatible = true + } else if (isNull(testBookChapter, bookChapter) == 1) { + compatible = true + testBookChapter.each { key, data -> + compatible = compatible && (bookChapter."$key" == data) + } + } + return compatible + } + +/* static public boolean bookChapterCompatibleTo(bookChapter, String title) { def testBookChapter = findBookChapterByTitle(title) def compatible = false @@ -43,7 +69,7 @@ class BookChapterTestDataAndOperations { } return compatible } - +*/ static public void uploadBookChapter(String filename) { def cont = new XMLController() def xml = new File(filename); @@ -83,5 +109,12 @@ class BookChapterTestDataAndOperations { PublicationController.sendPostFacebook(member, title) } - + //teste + static public void editBookChapterTitle(String title, String newTitle) { + def book = BookChapter.findByTitle(title) + book.title = newTitle + def cont = new BookChapterController() + cont.params << book.properties + cont.update(book.id, book.version) + } } diff --git a/test/functional/steps/BookTestDataAndOperations.groovy b/test/functional/steps/BookTestDataAndOperations.groovy index a6a8f379..8d621cd3 100644 --- a/test/functional/steps/BookTestDataAndOperations.groovy +++ b/test/functional/steps/BookTestDataAndOperations.groovy @@ -63,12 +63,26 @@ class BookTestDataAndOperations { cont.response.reset() } + //scc + static public int nullOrNot(def testBook, Book book) { + if(testBook == null && book == null) { + return 0; + } else if (testBook != null && book != null) { + return 1; + } else { + return 2; + } + } + + //scc static public boolean bookCompatibleTo(book, String title) { def testBook = findBookByTitle(title) def compatible = false - if (testBook == null && book == null) { + if (nullOrNot(testBook, book) == 0) { + //testBook == null && book == null compatible = true - } else if (testBook != null && book != null) { + } else if (nullOrNot(testBook, book) == 1) { + //testBook != null && book != null compatible = true testBook.each { key, data -> compatible = compatible && (book."$key" == data) diff --git a/test/functional/steps/FerramentaTestDataAndOperations.groovy b/test/functional/steps/FerramentaTestDataAndOperations.groovy index a9f8285b..a46af4cd 100644 --- a/test/functional/steps/FerramentaTestDataAndOperations.groovy +++ b/test/functional/steps/FerramentaTestDataAndOperations.groovy @@ -52,10 +52,10 @@ class FerramentaTestDataAndOperations { cont.response.reset() } - static public void createFerramenta(String title, filename) { + static public void createFerramenta(String title, filename, website = null) { def cont = new FerramentaController() def date = new Date() - cont.params << findFerramentaByTitle(title) << [file: filename] + cont.params << findFerramentaByTitle(title) << [file: filename] << [website: website] cont.request.setContent(new byte[1000]) // Could also vary the request content. cont.create() cont.save() diff --git a/test/functional/steps/MemberTestDataAndOperations.groovy b/test/functional/steps/MemberTestDataAndOperations.groovy index 01345ddb..5cf24818 100644 --- a/test/functional/steps/MemberTestDataAndOperations.groovy +++ b/test/functional/steps/MemberTestDataAndOperations.groovy @@ -1,6 +1,7 @@ package steps import rgms.authentication.User +import rgms.member.Member import rgms.member.MemberController /** @@ -39,13 +40,10 @@ class MemberTestDataAndOperations { } } - static public void createMember(String username, String phone) { + static public void createMember(String name = null,String username = null, String email = null, String phone = null, String university = null, + String website = null, String country = null, String status = null) { def cont = new MemberController() - if (phone.equals("")) { - cont.params << findByUsername(username) - } else { - cont.params << [username: username, phone: phone] - } + cont.params << [name: name] << [username: username] << [email: email] << [university: university] << [phone: phone] << [website: website] << [country: country] << [status: status] cont.create() cont.save() cont.response.reset() @@ -69,13 +67,69 @@ class MemberTestDataAndOperations { cont.response.reset() } + //cscbb + static public boolean exist(String usernameToCompare, String username, Member member) { + return (usernameToCompare == username && member != null) + } + + //cscbb static public boolean containsMember(username) { def cont = new MemberController() def result = cont.list().userMemberInstanceList for (i in result) { - if (i.user.username == username && i.member != null) - return true; + if(exist(i.user.username, username, i.member)) + return true + //if (i.user.username == username && i.member != null) + // return true; } return false; } + + //cscbb + static public void changeValue(def member, String option, String value) { + switch(option) { + case 'name': + member.name = value + break + case 'email': + member.email = value + break + case 'phone': + member.phone = value + break + case 'university': + member.university = value + break + case 'website': + member.website = value + break + case 'country': + member.country = value + break + case 'additionalInfo': + member.additionalInfo = value + break + case 'city': + member.city = value + break + case 'status': + member.status = value + break + case 'active': + member.active = (boolean)value + break + default: + break + } + } +//cscbb + static public Member editMember(String emailKey, String option, String value){ + def cont = new MemberController() + def member = Member.findByEmail(emailKey) + changeValue(member, option, value) + cont.params << member.properties + cont.update() + + return member + } } diff --git a/test/functional/steps/NewsTestDataAndOperations.groovy b/test/functional/steps/NewsTestDataAndOperations.groovy index 50ab484b..2636676a 100644 --- a/test/functional/steps/NewsTestDataAndOperations.groovy +++ b/test/functional/steps/NewsTestDataAndOperations.groovy @@ -45,22 +45,23 @@ class NewsTestDataAndOperations { cont.response.reset() } - static public boolean checkValidDate(String date) { + //lrb + static public boolean checkdDate(int dia, int mes) { + if( (dia > 28) && (mes == 2) ) { + return false; + } + else if ( (dia > 30) && ( (mes == 4) || (mes == 6) || (mes == 7) || (mes == 11) ) ) { + return false; + } + } - boolean retorno = true + static public boolean checkValidDate(String date) { String diaStr = "" + date.charAt(0) + date.charAt(1) String mesStr = "" + date.charAt(3) + date.charAt(4) int dia = Integer.valueOf(diaStr) int mes = Integer.valueOf(mesStr) - if( (dia > 28) && (mes == 2) ) { - retorno = false - } - else if ( (dia > 30) && ( (mes == 4) || (mes == 6) || (mes == 7) || (mes == 11) ) ) { - retorno = false - } - - return retorno + return checkdDate(dia, mes); } } diff --git a/test/functional/steps/Newthesis.pdf b/test/functional/steps/Newthesis.pdf new file mode 100644 index 00000000..befff10b Binary files /dev/null and b/test/functional/steps/Newthesis.pdf differ diff --git a/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy b/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy index 9cb82072..c1aa7d5b 100644 --- a/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy +++ b/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy @@ -6,9 +6,10 @@ import rgms.publication.TeseController class ThesisOrDissertationTestDataAndOperations { - static protected void createThesisOrDissertation(String title, filename, school, cont) { + static protected void createThesisOrDissertation(String title, filename = "Joee.pdf", school = "UFPE", address = "Boa Viagem") { + def cont = new TeseController() cont.params << [title: title, publicationDate: new Date(2013, 03, 02), - school: school, address: "Boa Viagem", file: filename] + school: school, address: address, file: filename] cont.request.setContent(new byte[1000]) // Could also vary the request content. cont.create() cont.save() @@ -24,6 +25,14 @@ class ThesisOrDissertationTestDataAndOperations { } cont.params << [id: test.id] cont.delete() + } + static public void editThesisOrDissertation(String option, String value, String title){ + def cont = new TeseController() + def thesis = Tese.findByTitle(title) + if(option == 'file') + thesis.file = value + cont.params << thesis.properties + cont.update() } }