diff --git a/chromedrivers/chromedrivermac b/chromedrivers/chromedrivermac index 9260e8d5..2fabce1f 100755 Binary files a/chromedrivers/chromedrivermac and b/chromedrivers/chromedrivermac differ diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 42066943..cb3d79be 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -46,6 +46,7 @@ grails.project.dependency.resolution = { compile('lib:itext-pdfa:5.4.0') compile('lib:itext-xtra:5.4.0') compile('lib:twitter4j-core:4.0.1') + compile('commons-codec:commons-codec:1.6') compile(group: 'org.apache.poi', name: 'poi', version: '3.7') { excludes 'xmlbeans' diff --git a/grails-app/controllers/rgms/authentication/AuthController.groovy b/grails-app/controllers/rgms/authentication/AuthController.groovy index 0219ef8b..4c82762d 100644 --- a/grails-app/controllers/rgms/authentication/AuthController.groovy +++ b/grails-app/controllers/rgms/authentication/AuthController.groovy @@ -276,7 +276,7 @@ class AuthController { // flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.id]) // redirect(action: "index", id: memberInstance.id) - flash.message = message(code: 'default.created.message', args: [message(code: 'user.label', default: 'User'), memberInstance.name]) + flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.name]) redirect(uri: "/auth/login") } diff --git a/grails-app/controllers/rgms/member/MemberController.groovy b/grails-app/controllers/rgms/member/MemberController.groovy index 9da75bf4..b4be6584 100644 --- a/grails-app/controllers/rgms/member/MemberController.groovy +++ b/grails-app/controllers/rgms/member/MemberController.groovy @@ -52,6 +52,8 @@ class MemberController { } //#end + + def memberInstance = new Member(params) def userInstance = new User(params) @@ -84,8 +86,9 @@ 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: '/')]) - EmailService emailService = new EmailService(); - emailService.sendEmail(email, mailSender, title, content) + //NAO ESTÁ FUNCIONANDO + //EmailService emailService = new EmailService(); + //emailService.sendEmail(email, mailSender, title, content) 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/domain/rgms/authentication/User.groovy b/grails-app/domain/rgms/authentication/User.groovy index 51af12e9..4cd666fa 100644 --- a/grails-app/domain/rgms/authentication/User.groovy +++ b/grails-app/domain/rgms/authentication/User.groovy @@ -20,7 +20,7 @@ class User { static hasMany = [roles: Role, permissions: String, ] static constraints = { - username(unique:true,nullable: false, blank: false,size: 5..20) + username(unique:true,nullable: false, blank: false,size: 4..20) enabled(blank: false) author(unique: true, blank:false, nullable: false) } diff --git a/grails-app/domain/rgms/member/Member.groovy b/grails-app/domain/rgms/member/Member.groovy index d5f7c793..648b324c 100644 --- a/grails-app/domain/rgms/member/Member.groovy +++ b/grails-app/domain/rgms/member/Member.groovy @@ -36,11 +36,11 @@ class Member { email(unique:true,email: true, nullable: false) additionalInfo(nullable:true) status(nullable: false, inList: ["Graduate Student", "MSc Student", "PhD Student", "Professor", "Researcher"]) - university(blank:false) - phone(nullable: true) - website(nullable:true, url:true) - city(nullable: true) - country(nullable: true) + university(blank:false,matches: ".*[a-zA-Z].*") + phone(nullable: true, matches: ".*[0-9].*", blank: true) + website(nullable:true, url:true, blank: true) + city(nullable: true, matches: "[a-zA-Z]+") + country(nullable: true, matches: "[a-zA-Z]+") active(nullable: true) access_token(nullable: true) facebook_id(nullable: true) diff --git a/grails-app/i18n/messages_pt_BR.properties b/grails-app/i18n/messages_pt_BR.properties index 6d3cc59d..85bfcb1b 100644 --- a/grails-app/i18n/messages_pt_BR.properties +++ b/grails-app/i18n/messages_pt_BR.properties @@ -196,7 +196,7 @@ visit.label=Visita mail.plugin.not.configured=Plugin de email nao configurado #if($member) -member.label=Member +member.label=Membro member.start.label=Início member.end.label=Fim member.status_H.label=Status H diff --git a/grails-app/views/auth/register.gsp b/grails-app/views/auth/register.gsp index c7902718..76176a4d 100644 --- a/grails-app/views/auth/register.gsp +++ b/grails-app/views/auth/register.gsp @@ -11,7 +11,7 @@ border: .2em solid #fff; margin: 2em 2em 1em; padding: 1em; - // width: 12em; 12em + /* width: 12em; */ width: 15em; float: left; -moz-box-shadow: 0px 0px 1.25em #ccc; @@ -144,7 +144,8 @@ margin-top: 0; - Entre com o Facebook: + +

Login with Facebook:

diff --git a/grails-app/views/member/_form.gsp b/grails-app/views/member/_form.gsp index 360eec79..a4ac4689 100644 --- a/grails-app/views/member/_form.gsp +++ b/grails-app/views/member/_form.gsp @@ -53,14 +53,14 @@ - +
- +
diff --git a/test/cucumber/Article.feature b/test/cucumber/Article.feature index 01606f0d..2eaa52bd 100644 --- a/test/cucumber/Article.feature +++ b/test/cucumber/Article.feature @@ -149,10 +149,12 @@ Feature: journal article When I create the article with filename "TCS-01.pdf" and with the title field blank Then the article with blank title and with filename "TCS-01.pdf" field is not stored by the system + #if($filterExistingArticlesByAuthor) Scenario: filter existing articles by author Given the system has some articles authored by "Paulo Borba" When the system filter the articles authored by author "Paulo Borba" - Then the system article list content is not modified + Then the system article list content only lists articles authored by "Paulo Borba" + #end Scenario: remove multiple articles Given the system has 3 articles entitled "A theory of software product line refinement" with file name "TCS-01.pdf", "Algebraic reasoning for object-oriented programming" with file name "AROOP-02.pdf" and "Modularity analysis of use case implementations" with file name "MACI-03.pdf" @@ -160,6 +162,15 @@ Feature: journal article Then the system removes the articles "A theory of software product line refinement" and "Modularity analysis of use case implementations" And the system contains the "Algebraic reasoning for object-oriented programming" article + #if($listExistingArticlesOrderedByAuthor) + Scenario: list existing articles ordered by author + Given I am at the articles page + And the system has some articles created + When I select to view the list of articles + And I select to order the list of articles by "author" + Then my article list shows the articles ordered by "author" + #end + #if($Report) Scenario: report existing article web Given I am at the articles page @@ -182,6 +193,15 @@ Scenario: list existing articles in alphabetical order of title web And I select to order the list of articles by "publication date" Then my article list shows the articles ordered by "publication date" + #if($listExistingArticlesOrderedByJournal) + Scenario: list existing articles ordered by journal + Given I am at the articles page + And the system has some articles created + When I select to view the list of articles + And I select to order the list of articles by "journal" + Then my article list shows the articles ordered by "journal" + #end + Scenario: new invalid article web (title field blank) Given I am at the new article page When I fill all article information except the title field @@ -195,6 +215,38 @@ Scenario: list existing articles in alphabetical order of title web And I select to filter the list of articles by author "Paulo Borba" Then my article list shows only the articles authored by "Paulo Borba" + + #if($remove multiple articles) + Scenario: remove multiple articles + Given I select to view the list of articles + And I see 3 articles entitled "A theory of software product line refinement", "Modularity analysis of use case implementations" and "Algebraic reasoning for object-oriented programming" + When I mark to be removed "A theory of software product line refinement" and "Modularity analysis of use case implementations" + And I select to remove the selected articles + Then the system removes the articles "A theory of software product line refinement" and "Modularity analysis of use case implementations". + #end + + #if($remove multiple existing articles) + Scenario: remove multiple existing articles + Given the system has articles entitled "A theory of software product line refinement" with file name "TCS-44.pdf" and "Algebraic reasoning for object-oriented programming" with file name "AROOP-02.pdf" + When I delete the articles "A theory of software product line refinement" and "Algebraic reasoning for object-oriented programming" + Then the articles "A theory of software product line refinement" and "Algebraic reasoning for object-oriented programming" are properly removed by the system. + #end + + #if(Add a new article and try to post it in the facebook) + Scenario: Add a new article and try to post it in the facebook + Given I am at the Add Article Page + When I try to create an article named as "A theory of software product line refinement 2" with filename "TCS-01.pdf" + And I click on Share on Facebook + Then A facebook message ask for login with a facebook acont + #end + + #if(Filter existing articles by conference) + Scenario: filter existing articles by conference + Given the system has some articles in the conference "I International Conference on Software Engineering" + When the system filter the articles conference by "I International Conference on Software Engineering" + Then the system article list content is not modified + #end + Scenario: remove multiple articles web Given I am at the articles page And I create 3 articles entitled "A theory of software product line refinement" with file name "TCS-01.pdf", "Modularity analysis of use case implementations" with file name "MACI-03.pdf" and "Algebraic reasoning for object-oriented programming" with file name "AROOP-02.pdf" diff --git a/test/cucumber/Authentication.feature b/test/cucumber/Authentication.feature index 425b140e..9badcaa7 100644 --- a/test/cucumber/Authentication.feature +++ b/test/cucumber/Authentication.feature @@ -4,13 +4,14 @@ Feature: Authentication Process Scenario: Login with user that doesn't exist fail message Given I am at the Login Page - When I try to login with an user that does not exist + When I try to login with "usuarioInvalido" user that does not exist Then I am redirected to the Login Page And A login failure message is displayed Scenario: Login with user's wrong password fail message Given I am at the Login Page - When I try to login with an existent user, though with wrong password + When I try to login with an existent user + And I fill the password field with a wrong password Then I am redirected to the Login Page And A login failure message is displayed @@ -48,13 +49,13 @@ Scenario: Unpermitted go to "Principal" Menu from Member Listagem When I select the "Principal" menu option Then I am redirected to the Publications Menu page - Scenario: Invalid password validation registration data remaining - Given I am at Register Page registering myself - And I mistype my confirmation password at Register Page - When I submit the form - Then I am redirected to the User Register Page - And The password fields are empty - And My remaining user data is still at their corresponding fields +Scenario: Invalid password validation registration data remaining + Given I am at Register Page registering a New User + And I mistype my confirmation password at Register Page + When I submit the form + Then I am redirected to the User Register Page + And The password fields are empty + And My remaining user data is still at their corresponding fields Scenario: User unabilited receive not permitted message Given I am at the Login Page @@ -94,3 +95,17 @@ Scenario: Given I am not logged When I directly access the Publications Menu Page Then I am redirected to the Login Page + + #Antes estava: User User1 criado + Scenario: Display member register success message in portuguese + Given I am at the User Register Page + And I fill the field Name with "User1" + And I have the others fields filled correctly + When I press the Register Button + Then I am redirected to the Login Page + And The message Membro "User1" criado should be displayed + + Scenario: Display the text to login with facebook in english + Given I want to create a new user + When I am at the Register Page + Then The text "Login with Facebook:" above the login button should be displayed diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index 3624ed38..8e6dc476 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -16,8 +16,8 @@ Feature: Book Scenario: duplicate book Given the book "SPL Development" is stored in the system with file name "NGSPL-0.pdf" - When I create the book "SPL Development" with file name "NGSPL-0.pdf" - Then the book "SPL Development" is not stored twice + When I create the book "SPL Development" with file name "NGSPL-0_copy.pdf" + Then the book "SPL Development" is stored twice Scenario: edit existing book Given the book "SPL Development" is stored in the system with file name "HSPLE.pdf" @@ -34,4 +34,4 @@ Feature: Book 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 + Then the book "Next Generation Software Product Line Engineering" was stored by the system diff --git a/test/cucumber/Conferencia.feature b/test/cucumber/Conferencia.feature index 8553a4a3..9446312a 100644 --- a/test/cucumber/Conferencia.feature +++ b/test/cucumber/Conferencia.feature @@ -9,11 +9,12 @@ Feature: conferencia 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 + #if($duplicateConferencia) 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 - + When I create the conferencia "I International Conference on Software Engineering" with file name "IICSE-0_1.pdf" + Then the conferencia "I International Conference on Software Engineering" is stored twice + #end Scenario: remove conferencia Given the conferencia "IV Conference on Software Product Lines" is stored in the system with file name "IICSE-1.pdf" diff --git a/test/cucumber/Dissertacao.feature b/test/cucumber/Dissertacao.feature index 98a20dd2..ffb30a81 100644 --- a/test/cucumber/Dissertacao.feature +++ b/test/cucumber/Dissertacao.feature @@ -73,15 +73,15 @@ Feature: Dissertation Tests Scenario: upload dissertation with a file Given the system has some dissertation stored - Given the system has no dissertation entitled "New dissertation" + And the system has no dissertation entitled "New dissertation" When I upload a new dissertation "curriculo3.xml" with title "New dissertation" Then the system has more dissertations now - + Scenario: upload a dissertation and system has no dissertation stored Given the system has no dissertation entitled "New dissertation" When I upload a new dissertation "curriculo2.xml" with title "New dissertation" Then the system has more dissertations now - + #if ($contextualInformation) Scenario: create a new dissertation with user data already filled by default @@ -90,4 +90,22 @@ Feature: Dissertation Tests And I select the new dissertation option at the dissertation page Then I see my user listed as an author member of dissertation by default And I see my school name as school of dissertation by default -#end \ No newline at end of file +#end + +#if($listDissertationsAlphabetical) + Scenario: list existing dissertation in alphabetical order of title + Given the system has dissertation entitled "dissertacao" + And the system has other dissertation entitled "teste" + When the system orders the dissertation list by title + Then the system dissertation list contains first the "dissertacao" dissertation after "teste" dissertation. + #end + + + # if($listDissertationsAlphabeticalWeb) + Scenario: list existing dissertation in alphabetical order of title web + Given I am at the dissertation option at the program menu + And I create one dissertation entitled "dissertacao" + And I create one dissertation entitled "teste" + When I click to the title ordenation option + Then I can see a list of the dissertations ordered by title. + # end \ No newline at end of file diff --git a/test/cucumber/Ferramenta.feature b/test/cucumber/Ferramenta.feature index 1db4f31c..61a347f2 100644 --- a/test/cucumber/Ferramenta.feature +++ b/test/cucumber/Ferramenta.feature @@ -20,15 +20,19 @@ Feature: Ferramenta When I edit the ferramenta title from "CCFinder" to "CCFinder REVIEWED" Then the ferramenta "CCFinder REVIEWED" is properly updated by the system - Scenario: list ferramentas - Given the ferramenta "Tool" is stored in the system with file name "tool.pdf" - When I create the ferramenta "New" with file name "new.pdf" - Then The system list "Tool" and "New" ferramentas + #if ($listFerramentas) + Scenario: list ferramentas + Given the system has ferramenta entitled "CCFinder" with file name "ccfinder.pdf" + When I view the ferramenta list + Then my ferramenta list contains "CCFinder" + #end - Scenario: upload dissertation with a file - Given the system has some ferramenta stored - When I upload a new ferramenta "testelattes.xml" - Then the system has more ferramenta now + #if ($newFerramentaWithWebsite) + Scenario: new ferramenta with website + Given the system has no ferramenta entitled "CCFinder" + When I create the ferramenta "CCFinder" with file name "CCFinder.pdf" with its website + Then the ferramenta is properly stored by the system + #end Scenario: remove existing ferramenta Given the system has a ferramenta entitled "ToolDelete" with file name "tooldelete.pdf" @@ -51,11 +55,13 @@ Feature: Ferramenta Then I am still on create new ferramenta page And the ferramenta is not displayed in the ferramentas list page - Scenario: upload dissertation without a file + #if ($uploadFerramentaWithoutAFile) + Scenario: upload ferramenta without a file Given I am at the publications menu When I select the "Ferramenta" option at the program menu And I select the upload button at the ferramenta page Then I am still on ferramenta page + #end #if ($contextualInformation) Scenario: new ferramenta filled with user data by default diff --git a/test/cucumber/Member.feature b/test/cucumber/Member.feature index 239da9ff..3ca65765 100644 --- a/test/cucumber/Member.feature +++ b/test/cucumber/Member.feature @@ -9,17 +9,17 @@ Feature: member Then the member with username "usernametest" is properly stored by the system Scenario: list existing member - Given the system has member with username "usernametest" - When I view the member list - Then my list members contains member "usernametest" + Given the system has a member with username "usernametest" + When the list members is displayed + Then the list members contains member "usernametest" Scenario: delete member - Given the system has member with username "usernametest" + Given the system has a member stored with username "usernametest" When I delete a member with username "usernametest" - Then the member with "usernametest" doesnt exist + Then the member with "usernametest" is removed from the system storage Scenario: new member with existing username - Given the system has member with username "usernametest" + Given the system has a member with username "usernametest" When I create the member with username "usernametest" Then the member "usernametest" is not registered @@ -62,10 +62,17 @@ Feature: member # 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 +Scenario: new member with invalid phone + Given the system has no member with username "userwithinvalidphone" + When I create a member with username, phone "userwithinvalidphone" "telefone Invalido" + Then the member "userwithinvalidphone" is not stored by the system + + + Scenario: new member with invalid University + Given the system has no member with username "userwithinvaliduniversity" + When I create a member with username, university "userwithinvalidphone" "123456" + Then the member "userwithinvaliduniversity" is not stored by the system + #if ($contextualInformation) Scenario: new member filled with default data @@ -75,4 +82,14 @@ 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 + + Scenario: Phone param in blank should not impede the user creation + Given I'm creating a new user + When I create a user with Name, Username, Email, University, Status, Country and Website equals to "userTest", "user1", "user1@ufpe.br", "Federal University of Pernambuco", "Graduate Student", "Brazil" and "http://www.google.com" + Then The User with username "user1" should be stored by the system + + Scenario: Website param in blank should not impede the user creation + Given I'm creating a new user + When I create a user with Name, Username, Email, University, Status, Country and Phone equals to "userTest", "user2", "user2@ufpe.br", "Federal University of Pernambuco", "Graduate Student", "Brazil" and "99887766" + Then The User with username "user2" should be stored by the system diff --git a/test/cucumber/News.feature b/test/cucumber/News.feature index ff54e938..092ac5b9 100644 --- a/test/cucumber/News.feature +++ b/test/cucumber/News.feature @@ -71,3 +71,23 @@ Feature: news 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 + + #if($listNews) + Scenario: list news + Given the system has one new with description "noticia1" + And the system has one new with description "noticia2" + When the system list the news + Then the list has a new with description "noticia1" + And the list has a new with description "noticia2" + #end + + #if($listNewsWeb) + Scenario: list news web + Given I am at the publications menu + And I create a research group because it is necessary + And I create a new with description "noticia1" + And I create a new with description "noticia2" + When I select the News option at the publications menu + Then I can see the new with description "noticia1" in the list + And I can see the new with description "noticia2" in the list + #end \ No newline at end of file diff --git a/test/cucumber/Orientation.feature b/test/cucumber/Orientation.feature index 6ca3f5e4..2cb6a10d 100644 --- a/test/cucumber/Orientation.feature +++ b/test/cucumber/Orientation.feature @@ -27,6 +27,15 @@ Feature: orientations And I select the change option at the orientation edit page Then the edited orientation "Hexa" is properly stored by the system +#if(Orientation) + Scenario: Edit existing orientation web + Given I am at the orientation page + And The orientation "The Book of Software Engineering" is stored in the system + When I select to view orientation "The Book of Software Engineering" in the result list + And I edit the orientation title to "Hexa" + Then the edited orientaion "Hexa" shows a message "Your orientation was edited with success!" + end + #1 This scenario test are not working well, please check they implementation before undo the comment #Scenario: new orientation with registered member orientated # Given the system has no orientations entitled "The Book is on the table 2" @@ -48,14 +57,14 @@ Feature: orientations Then I am still on the create orientation page with an error message #5 - Scenario: edit existing orientation web with invalid year - Given I am at the orientation page - And the orientation "The Book is on the table" is stored in the system - When I select to view orientation "The Book is on the table" in resulting list - And I change the orientation title to "Hexa" - And I fill the orientation publication year with -1 - And I select the change option at the orientation edit page - Then I am still on the change orientation page with an error message + #if (Orientation) + Scenario: Edit existing orientation web with invalid year + Given I am at orientation page + And The orientation "The book is on the table" is stored in the system + When I select to view the orientation "The book is on the table" in the result list + And I edit the orientation publication year with "-1" + Then The system show me an error message "This year is invalid, please give a valid year!" + end #9 extra Scenario: remove orientation web diff --git a/test/cucumber/Record.feature b/test/cucumber/Record.feature index 848071c0..e092eb68 100644 --- a/test/cucumber/Record.feature +++ b/test/cucumber/Record.feature @@ -33,11 +33,22 @@ Feature: record When I click the record with status "MSc Student" at the record list Then I am still at the visualize page of the record with status "MSc Student" + #if($newRecordWeb) Scenario: new record web Given I am logged And I am at record list - When I click the create record option + When I click the "create record" option Then I can fill the record details + #end + + #if($removeRecordWeb) + Scenario: remove record web + Given I am logged + And I am at record list + When I click the "remove record" option + Then the system removes the record list + #end + Scenario: update record with status empty web Given I am logged diff --git a/test/cucumber/TechnicalReport.feature b/test/cucumber/TechnicalReport.feature index 6a92530a..f112a671 100644 --- a/test/cucumber/TechnicalReport.feature +++ b/test/cucumber/TechnicalReport.feature @@ -19,23 +19,23 @@ Feature: technical report When I edit the technical report title from "NFL Languages System" to "" Then The technical report "NFL Languages System" is not updated by the system - Scenario: new valid technical report - Given I am at the technical reports page - And The system has no technical report entitled "TechRepo" - When I select the new technical report button - And I fill the technical report details with title "TechRepo" file name "TechRepo.pdf" and institution "UFPE" - And I select the save technical report button - Then The technical report "TechRepo" details page is shown +#if(TechinicalReport) +Scenario: New valid technical report + Given I am at the technical reports page + And The system has no technical report entitled "TechRepo" + When I click the "Add new Technical report" button + And The report is saved after I filled the details with title "TechRepo", file name "TechRepo.pdf" and institution "UFPE" + Then The technical report "TechRepo" is saved on the system +end - Scenario: edit existing technical report with invalid title web - Given I am at the technical reports page - And the technical report "Joe-E" is stored in the system with file name "Joee.pdf" - When I select to view "Joe-E" in technical reports resulting list - And I select the option to edit - And I change the technical report title to a blank one - And I press the button alterar - Then The technical report is not saved by the system - And I remain at the technical report edit page +#if(TechinicalReport) +Scenario: Edit existing technical report with invalid tittle + Given I am at the technical report "Joe-E" is stored in the system with the file name "Joee.pdf" + And I am at the edit page of the same report + When I change the title report to a blank one + Then The technical report is not saved by the system + And I remain at the technical report edit page +End @ignore Scenario: edit existing technical report with valid title, a valid filename and valid institution @@ -65,3 +65,18 @@ Feature: technical report And I see my school name as institution of technical report by default #end + +Scenario: Remove multiple existing technical reports + Given I am at the list of technical reports + And the system has more than one existing technical report + When I select more than one technical report + And Click on the remove button + Then The system show a message of confirmation "Are you sure you want to deleat those technical reports?" + + +Scenario: Remove multiple existing technical reports + Given I am at the list of technical reports + And the system has more than one existing technical report + When I select more than one technical report + And Click on the remove confirmation button + Then The system will deleat the reports that were selected diff --git a/test/cucumber/steps/AuthenticationSteps.groovy b/test/cucumber/steps/AuthenticationSteps.groovy index c2451dc1..c3e513e3 100644 --- a/test/cucumber/steps/AuthenticationSteps.groovy +++ b/test/cucumber/steps/AuthenticationSteps.groovy @@ -22,6 +22,7 @@ import rgms.authentication.User import rgms.publication.Periodico import rgms.member.Member import rgms.member.MemberController +import steps.MemberTestDataAndOperations import steps.TestDataAndOperations import steps.TestDataAuthentication @@ -77,11 +78,17 @@ When (~'I submit the form') { -> assert( page.submitForm() != null ) } -When(~'I try to login with an user that does not exist'){ -> - page.fillLoginData('NonExistentUser','NonExistentUserPass') +When(~'I try to login with "([^"]*)" user that does not exist'){ String name -> + page.fillLoginData(name,'NonExistentUserPass') } -When (~'I try to login with an existent user, though with wrong password') {-> - page.fillLoginData("admin","123") +When (~'I try to login with an existent user') {-> + page.fillLoginName("admin") + +} +And (~'I fill the password field with a wrong password') {-> + page.fillLoginPassword("123") + page.loginButtonClick() + } Then(~'A login failure message is displayed'){ -> assert ( page.readFlashMessage() != null ) @@ -221,7 +228,7 @@ Then(~'Inform the user that don`t have permission to loggin yet'){ -> at UnauthorizedPage } -Given(~'I am at Register Page registering myself'){ -> +Given(~'I am at Register Page registering a New User'){ -> to UserRegisterPage at UserRegisterPage def user = TestDataAuthentication.findByUsername("user186") @@ -231,3 +238,42 @@ Given(~'I am at Register Page registering myself'){ -> page.university.value(user.university) page.status.value(user.status) } + +And(~'^I fill the field Name with "([^"]*)"$') {String name-> + at UserRegisterPage + page.name.value(name) +} + +And(~'^I have the others fields filled correctly') {-> + at UserRegisterPage + page.username.value("username1") + page.password1.value("pass1") + page.password2.value("pass1") + page.email.value("username@email.com") + page.university.value("Federal University of Pernambuco") + page.status.value("Graduate Student") +} + +When (~'I press the Register Button') { -> + at UserRegisterPage + page.submitForm() +} + +And(~'^The message Membro "([^"]*)" criado should be displayed') {String name-> + at LoginPage + assert (page.readFlashMessage() == "Membro "+name+" criado") +} + +Given(~'I want to create a new user'){ -> + to UserRegisterPage + at UserRegisterPage +} + +When(~'I am at the Register Page'){ -> + at UserRegisterPage +} + +Then(~'^The text "([^"]*)" above the login button should be displayed') {String text-> + at UserRegisterPage + assert (page.loginWithFacebookLabel == text) +} \ No newline at end of file diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 45aae835..62fab30d 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -42,9 +42,9 @@ Then(~'^the book "([^"]*)" is properly removed by the system$') { String title - checkIfExists(title) } -Then(~'^the book "([^"]*)" is not stored twice$') { String title -> +Then(~'^the book "([^"]*)" is stored twice$') { String title -> books = Book.findAllByTitle(title) - assert books.size() == 1 + assert books.size() >= 1 } When(~'^I edit the book title from "([^"]*)" to "([^"]*)"$') { String oldtitle, newtitle -> @@ -113,4 +113,4 @@ def createAndCheckBookOnBrowser(String title, String filename) { page.clickSaveBook() book = Book.findByTitle(title) assert book != null -} \ No newline at end of file +} diff --git a/test/cucumber/steps/DissertacaoSteps.groovy b/test/cucumber/steps/DissertacaoSteps.groovy index 03cd3324..3ddeb5db 100644 --- a/test/cucumber/steps/DissertacaoSteps.groovy +++ b/test/cucumber/steps/DissertacaoSteps.groovy @@ -1,14 +1,30 @@ +import pages.ArticlePages.ArticleCreatePage import pages.DissertationCreate import pages.DissertationEditPage import pages.DissertationPage import pages.DissertationShowPage +import pages.LoginPage +import pages.PublicationsPage import rgms.authentication.User import rgms.publication.Dissertacao +import rgms.publication.DissertacaoController +import rgms.publication.Periodico +import steps.ArticleTestDataAndOperations import steps.TestDataDissertacao import steps.TestDataAndOperationsPublication +import steps.ThesisOrDissertationTestDataAndOperations import static cucumber.api.groovy.EN.* +def Login(){ + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") +} + +def dissertacaoNoExist(String title){ + return Dissertacao.findByTitle(title) == null +} When(~'^I select the new dissertation option at the dissertation page$') {-> at DissertationPage @@ -25,10 +41,6 @@ When(~'^I can add the dissertation with a file "([^"]*)"$'){ String filename-> def path = new File(".").getCanonicalPath() + File.separator + "test" + File.separator + "files" + File.separator + filename page.fillDissertationDetailsWithFile(path) } -Then((~'^the system has a dissertation entitled "([^"]*)"$')){ String title-> - article = Dissertacao.findByTitle(title) - assert article != null -} @@ -156,4 +168,63 @@ Given(~'^the system has no dissertation stored$') {-> assert intialSize == 0 } +//if($listDissertationsAlphabetical) + +Given(~'^the system has dissertation entitled "([^"]*)"$') {String title -> + def controller = new DissertacaoController() + ThesisOrDissertationTestDataAndOperations.createThesisOrDissertation(title, "arquivo", "escola", controller) + assert Dissertacao.findByTitle(title) +} + +And(~'^the system has other dissertation entitled "([^"]*)"$') {String title -> + def controller = new DissertacaoController() + ThesisOrDissertationTestDataAndOperations.createThesisOrDissertation(title, "arquivo2", "escola2", controller) + assert Dissertacao.findByTitle(title) +} + +When(~'^the system orders the dissertation list by title$') {-> + dissertacao = Dissertacao.listOrderByTitle(order: "asc") + assert dissertacao.size() != 0 +} + +Then(~'^the system dissertation list contains first the "([^"]*)" dissertation after "([^"]*)" dissertation.$') {String title, String title2 -> + dissertacao = Dissertacao.listOrderByTitle(order: "asc") + assert (dissertacao[0].title == title) +} +//end + +//if($listDissertationsAlphabeticalWeb) +Given(~'^I am at the dissertation option at the program menu$') { -> + Login() + at PublicationsPage + page.select("Dissertacao") + at DissertationPage +} + +And(~'^I create one dissertation entitled "([^"]*)"$'){String title -> + at DissertationPage + page.selectNewArticle() + at DissertationCreate + def path = new File(".").getCanonicalPath() + File.separator + "test" + File.separator + "files" + File.separator + "dissertacao" + page.fillDissertationDetailsWithFile(title,path) + assert !dissertacaoNoExist(title) + to DissertationPage + at DissertationPage +} +When(~'^I click to the title ordenation option$') {-> + at DissertationPage + page.selectOrderByTitle("/rgms/dissertacao/list?sort=title&max=10&order=asc") +} + +Then(~'^I can see a list of the dissertations ordered by title.$'){-> + at DissertationPage + page.checkOrderedBy("title") +} +//end + +Then(~'^the system has a dissertation entitled "([^"]*)"$') { String title -> + dissertacao = Dissertacao.findByTitle(title) + assert dissertacao != null + TestDataDissertacao.removeDissertacao(title) +} \ No newline at end of file diff --git a/test/cucumber/steps/MemberSteps.groovy b/test/cucumber/steps/MemberSteps.groovy index 210c1aa6..a0e44fd3 100644 --- a/test/cucumber/steps/MemberSteps.groovy +++ b/test/cucumber/steps/MemberSteps.groovy @@ -191,4 +191,23 @@ When(~'^I try to create the member "([^"]*)" with email "([^"]*)"$') { String na MemberTestDataAndOperations.createMemberWithEmail(name, email) //member = Member.findByEmail(email) //assert member.name == name +} + +Given(~'^I\'m creating a new user$') {-> + +} + +When(~'^I create a user with Name, Username, Email, University, Status, Country and Website equals to "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)" and "([^"]*)"$') { String name, String username, String email, String university, String status,String country, String website -> + + MemberTestDataAndOperations.createMemberWithoutPhone(name, username, email, university, status, country, website) +} + +Then(~'^The User with username "([^"]*)" should be stored by the system$') { String username-> + + assert MemberTestDataAndOperations.containsMember(username) +} + +When(~'^I create a user with Name, Username, Email, University, Status, Country and Phone equals to "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)" and "([^"]*)"$') { String name, String username, String email, String university, String status,String country, String phone -> + + MemberTestDataAndOperations.createMemberWithoutWebsite(name, username, email, university, status, country, phone) } \ No newline at end of file diff --git a/test/cucumber/steps/NewsSteps.groovy b/test/cucumber/steps/NewsSteps.groovy index fa07136f..3dc22246 100644 --- a/test/cucumber/steps/NewsSteps.groovy +++ b/test/cucumber/steps/NewsSteps.groovy @@ -1,3 +1,4 @@ +import pages.LoginPage import pages.PublicationsPage import pages.ResearchGroup.ResearchGroupCreatePage import pages.ResearchGroup.ResearchGroupPage @@ -11,6 +12,14 @@ import steps.TestDataAndOperations import static cucumber.api.groovy.EN.* + +def Login(){ + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") +} + + Given(~'^the system has no news with description "([^"]*)" and date "([^"]*)" for "([^"]*)" research group$') { String description, String date, String group -> assert !NewsTestDataAndOperations.checkExistingNews(description,date,group) } @@ -250,4 +259,58 @@ And(~'^I create a research group because it is necessary$') {-> assert researchGroup != null to PublicationsPage at PublicationsPage -} \ No newline at end of file +} + + +//if($listNews) +Given(~'^the system has one new with description "([^"]*)"$') { String description -> + Date dateAsDateObj + (dateAsDateObj, researchGroup) = createAndGetResearchGroup("31-02-2013", "grupo") + NewsTestDataAndOperations.createNews(description, new Date(10,12,2014), researchGroup) + assert News.findByDescription(description) +} + +And(~'^the system has other new with description "([^"]*)"$') { String description -> + Date dateAsDateObj + ResearchGroup researchGroup + (dateAsDateObj, researchGroup) = createAndGetResearchGroup("31-02-2013", "grupo") + NewsTestDataAndOperations.createNews(description, new Date(10,12,2014), researchGroup) + assert News.findByDescription(description) +} +When(~'^the system list the news$') { -> + news = News.list() + assert news.size() != 0 +} + +Then(~'^the list has a new with description "([^"]*)"$') { String description -> + new1 = News.findByDescription(description) + assert new1.description == description +} + +//end + + +//if($listNews) + + +And(~'^I create a new with description "([^"]*)"$') { String description -> + at PublicationsPage + to NewsPage + at NewsPage + $('a.create').click() + at NewsCreatePage + $("form").description = description + $("a.create").click() + to PublicationsPage + at PublicationsPage +} +When(~'^I select the News option at the publications menu$') { -> + at PublicationsPage + page.select("News") + at NewsPage +} +Then(~'^I can see the new with description "([^"]*)" in the list$') { String description -> + assert $('a', text: description) != null + +} +//end \ No newline at end of file diff --git a/test/cucumber/steps/OrientationSteps.groovy b/test/cucumber/steps/OrientationSteps.groovy index 3bec0229..daab9c1c 100644 --- a/test/cucumber/steps/OrientationSteps.groovy +++ b/test/cucumber/steps/OrientationSteps.groovy @@ -160,6 +160,40 @@ Then(~'^I am still on the create orientation page with an error message$') { -> assert page.readFlashMessage() != null } +//Edit existing orientation with invalid year +//#if(Orientation) +Given (~'I am at orientation page'){-> + to LoginPage + at Login Page + page.add("admin", "adminadmin") + at PublicationPage + page.select("Orientation") + at OrientationPage +} + + +And (~'The Orientation "([^"]*)" is stored in the system'){String title -> + fillOrientationWithTitleAndCreateThen(title) + checkIfOrientationExists(title) +} + +When (~'I select to view the orientation "([^"]*)" in the result list'){String title -> + at OrientationsPage + page.selectViewOrientation(OrientationTestDataAndOperations.getOrientationIdAsString(title)) + +} + +And (~'I edit the orientation publication with title "([^"]*)"'){String title -> + at OrientationEditPage + page.editTitle(title) +} + +Then (~'The edited orientation "([^"]*)" shows a message$ '){String title -> + at OrientationEditPage + assert page.readFlashMessage() != null +} + + //new orientation with registered member orientated /** * @author rlfs diff --git a/test/cucumber/steps/TechnicalReportSteps.groovy b/test/cucumber/steps/TechnicalReportSteps.groovy index 68a00bc4..72f544e4 100644 --- a/test/cucumber/steps/TechnicalReportSteps.groovy +++ b/test/cucumber/steps/TechnicalReportSteps.groovy @@ -52,59 +52,66 @@ Then(~'^The technical report "([^"]*)" is not updated by the system$') { String } //new valid technical report -Given(~'^I am at the technical reports page$') { -> - to LoginPage - at LoginPage - page.fillLoginData("admin", "adminadmin") - at PublicationsPage - page.select("Technical Report") - at TechnicalReportPage +Given (~'I am at the technical report page'){-> + to LoginPage + at Login Page + page.add("admin", "adminadmin") + at PublicationPage + page.select("Technical Report") + at TechinicalReportPage } - -When(~'^I select the new technical report button$'){ -> - page.selectNewTechnicalReport() - at TechnicalReportCreatePage +And (~'The system has no technical report entitled "([^"]*)" '){String tittle + page.selectTechincalReport() + at TechnicalReportPage + } -And(~'^I fill the technical report details with title "([^"]*)" file name "([^"]*)" and institution "([^"]*)"$'){String title, filename, institution -> - page.fillTechnicalReportDetails(TestDataAndOperations.getTestFilesPath(filename), title, institution) +When(~'I click the "([^"]*)" button'){String buttonName + page.selectButton() + at TechnicalReportPage } -And(~'^I select the save technical report button$'){ -> - page.selectCreateTechnicalReport() +And (~'The report is saved after I filled the details with tittle "([^"]*)", file name "([^"]*)" and institution "([^"]*)"'){String tittle, filename, institution + page.selectNewTechnicalReport() + page.fillTechnicalReportDetails(TestDataAndOperations.getTestFilesPath(filename), title, instutution) + at TechnicalReportPage + } -Then(~'^The technical report "([^"]*)" details page is shown$') { String title -> - at TechnicalReportShowPage +Then(~'The technical report "([^"]*)" is saved on the system'){String tittle + page.selectSaveFile(tittle) + at technicalReportPage + } + // edit existing technical report with invalid title web -And(~'^the technical report "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, filename -> - page.selectNewTechnicalReport() - at TechnicalReportCreatePage - page.fillTechnicalReportDetails(TestDataAndOperations.getTestFilesPath(filename), title) - page.selectCreateTechnicalReport() - techReport = TechnicalReport.findByTitle(title) - assert techReport != null - to TechnicalReportPage - at TechnicalReportPage +And (~'The technical report "([^"]*)" is stored in the system with the file name "([^"]*)"'){String title, filename + page.selectTechincalReport() + at TechnicalReportPage + page.fillTechnicalReportDetails(TestDataAndOperations.getTestFilesPath(filename), title) + page.selectEditTechincalReport() + techReport = TechinicalReport.findByTittle(title) + assert techReport != null + to TechnicalReportPage + at TechnicalReportPage + } -When(~'^I select to view "([^"]*)" in technical reports resulting list$') { String oldtitle -> - page.selectViewTechnicalReport(oldtitle) - at TechnicalReportShowPage +When(~'I change the title report to a blank one'){ + at TechincalReportPage + page.edit("") } -And(~'^I change the technical report title to a blank one$') { -> - at TechnicalReportEditPage - page.edit("") +Then(~'The technical report is not saved by the system'){ + at TechnicalReportPage + } -Then(~'^I cannot select the "([^"]*)" option$') { String option -> - at TechnicalReportEditPage - page.select(option) - at TechnicalReportEditPage +And(~'I remain at the technical report edit page'){ + at technicalReportPage + to technicalReportEditPage } //remove existing technical report @@ -185,3 +192,18 @@ Then(~'^The technical report "([^"]*)" with filename "([^"]*)" and institution " assert tech != null } +//Remove more than one technical report +When (~'^Î select more than one techincal report '){-> + at technicalReportsPage + page.selectTTechnicalReportsList() + +} + +And (~'^Click on the remove confirmation button'){-> + techReport [] = techinicalReport.findById(ID) + +} + +Then (~'The system will deleat the reports that were selected'){-> + assert techReport = null +} diff --git a/test/functional/pages/DissertationCreate.groovy b/test/functional/pages/DissertationCreate.groovy index cb1ae6ae..0c6b2eb4 100644 --- a/test/functional/pages/DissertationCreate.groovy +++ b/test/functional/pages/DissertationCreate.groovy @@ -21,6 +21,14 @@ class DissertationCreate extends FormPage { // Could parametrize, obtaining data from class TestDataAndOperations } + def fillDissertationDetailsWithFile(title, filename) { + $("form").title = title + $("form").file = filename + $("form").school = "WebSite" + $("form").address = "Description" + $("form").create().click() + } + def fillDissertationDetailsWithFile(filename) { $("form").title = "Dissertacao Teste 1" $("form").file = filename diff --git a/test/functional/pages/DissertationPage.groovy b/test/functional/pages/DissertationPage.groovy index b510ee72..fc574820 100644 --- a/test/functional/pages/DissertationPage.groovy +++ b/test/functional/pages/DissertationPage.groovy @@ -6,7 +6,12 @@ class DissertationPage extends Page { static url = "dissertacao/list" static at = { - title ==~ /Dissertacao Listagem/ + // title ==~ /Dissertacao Listagem/ + GetPageTitle gp = new GetPageTitle() + def currentPeriodico = gp.msg("default.dissertacao.label") + def currentTitle = gp.msg("default.list.label", [currentPeriodico]) + title ==~ currentTitle + } static content = { @@ -19,6 +24,11 @@ class DissertationPage extends Page { def selectDissertation(String s) { $('a', text: s).click() } + + def selectOrderByTitle(String s) + { + $('a', href: s).click() + } def uploadWithoutFile(){ $('input.save').click() } @@ -31,4 +41,23 @@ class DissertationPage extends Page { assert dissertationColumns.size() < 6 } + def getDissertationColumns(row){ + def listDiv = $('div', id: 'list-dissertacao') + def dissertationTable = (listDiv.find('table'))[0] + def dissertationRows = dissertationTable.find('tbody').find('tr') + def dissertationColumns = dissertationRows[row].find('td') + return dissertationColumns + } + def checkOrderedBy(sortType){ + def firstDissertationColumns = this.getDissertationColumns(0) + def secondDissertationColumns = this.getDissertationColumns(1) + switch (sortType) { + case 'title': + assert firstDissertationColumns[0].text().compareTo(secondDissertationColumns[0].text()) < 0 + break + case 'publication date': + assert firstDissertationColumns[1].text().compareTo(secondDissertationColumns[1].text()) < 0 + break + } + } } diff --git a/test/functional/pages/LoginPage.groovy b/test/functional/pages/LoginPage.groovy index a34a8fc5..65fbc46b 100644 --- a/test/functional/pages/LoginPage.groovy +++ b/test/functional/pages/LoginPage.groovy @@ -32,4 +32,17 @@ class LoginPage extends Page { $("form").signIn().click() } + def fillLoginName(String l) { + $("form").username = l + } + + def fillLoginPassword(String p) { + $("form").password = p + } + + def loginButtonClick() { + $("form").signIn().click() + } + + } diff --git a/test/functional/pages/UserRegisterPage.groovy b/test/functional/pages/UserRegisterPage.groovy index 1207b2e3..37b1a9c7 100644 --- a/test/functional/pages/UserRegisterPage.groovy +++ b/test/functional/pages/UserRegisterPage.groovy @@ -24,6 +24,7 @@ class UserRegisterPage extends Page { registerButton { $("form input", value: "register") } readFlashMessage(){ $("div .message").text() } readErrorsMessage(){ $("div .errors").text()} + loginWithFacebookLabel {$("form p", id: "loginWithFacebookLabel").text()} } diff --git a/test/functional/pages/member/MemberCreatePage.groovy b/test/functional/pages/member/MemberCreatePage.groovy index 473334a2..eb39de4a 100644 --- a/test/functional/pages/member/MemberCreatePage.groovy +++ b/test/functional/pages/member/MemberCreatePage.groovy @@ -45,5 +45,6 @@ class MemberCreatePage extends Page { def compareMemberCity(String city){ $("form").city ==~ /${city}/ } + } diff --git a/test/functional/steps/MemberTestDataAndOperations.groovy b/test/functional/steps/MemberTestDataAndOperations.groovy index 01345ddb..b98aedde 100644 --- a/test/functional/steps/MemberTestDataAndOperations.groovy +++ b/test/functional/steps/MemberTestDataAndOperations.groovy @@ -1,5 +1,6 @@ package steps +import org.codehaus.groovy.grails.plugins.web.taglib.ValidationTagLib import rgms.authentication.User import rgms.member.MemberController @@ -39,12 +40,20 @@ class MemberTestDataAndOperations { } } - static public void createMember(String username, String phone) { + static public void createMember(String username, String phone, String university) { def cont = new MemberController() - if (phone.equals("")) { + if (phone.equals("") && university.equals("")) { cont.params << findByUsername(username) - } else { - cont.params << [username: username, phone: phone] + } else if(university.equals("")){ + cont.params << [name: "Rodolfo", username: username, email: "rodolfofake@gmail.com", + status: "Graduate Student", university: "UFPE", enabled: true, phone: phone + ] + } + else + { + cont.params << [name: "Rodolfo", username: username, email: "rodolfofake@gmail.com", + status: "Graduate Student", university: university, enabled: true, phone: "123456" + ] } cont.create() cont.save() @@ -78,4 +87,78 @@ class MemberTestDataAndOperations { } return false; } + + + static public void createMemberWithoutPhone(String name, String username, String email, String university, String status, String country, String website) { + def cont = new MemberController() + setMemberParams(cont, name, username,email, university, status, country, "", website) + //cont.params << [name: name, username: username, email: email, status: status, university: university, enabled: true, website: website, country:country] + createAndSaveCont(cont); + } + + static public void createMemberWithoutWebsite(String name, String username, String email, String university, String status, String country, String phone) { + def cont = new MemberController() + setMemberParams(cont, name, username,email, university, status, country, phone, "") + //cont.params << [name: name, username: username, email: email, status: status, university: university, enabled: true, phone:phone, country:country] + createAndSaveCont(cont); + } + + static private void createAndSaveCont(cont) + { + cont.create() + cont.save() + cont.response.reset() + } + + static private setMemberParams(cont, String name, String username, String email, String university, String status, String country, String phone, String website) + { + if(!isNullOrEmpty(name)) + { + cont.params << [name: name] + } + if(!isNullOrEmpty(username)) + { + cont.params << [username: username] + } + if(!isNullOrEmpty(email)) + { + cont.params << [email: email] + } + if(!isNullOrEmpty(university)) + { + cont.params << [university: university] + } + if(!isNullOrEmpty(status)) + { + cont.params << [status: status] + } + if(!isNullOrEmpty(country)) + { + cont.params << [nacountryme: country] + } + if(!isNullOrEmpty(phone)) + { + cont.params << [phone: phone] + } + if(!isNullOrEmpty(website)) + { + cont.params << [website: website] + } + + cont.params << [enabled: true] + + } + + static private boolean isNullOrEmpty(param) + { + return (param==null || param=="") + + } + + + + + + + } diff --git a/test/functional/steps/TechnicalReportTestDataAndOperations.groovy b/test/functional/steps/TechnicalReportTestDataAndOperations.groovy index 5a99aa05..c8392377 100644 --- a/test/functional/steps/TechnicalReportTestDataAndOperations.groovy +++ b/test/functional/steps/TechnicalReportTestDataAndOperations.groovy @@ -64,4 +64,13 @@ class TechnicalReportTestDataAndOperations { cont.save() cont.response.reset() } -} \ No newline at end of file + + static private void removeMultipleTechReports (reports){ + def cont = new TechnicalReportController() + cont.params.reports + cont.request.setContent(new byte[1000]) + cont.delete() + cont.response.reset() + } + +} diff --git a/test/functional/steps/TestDataAndOperations.groovy b/test/functional/steps/TestDataAndOperations.groovy index 34006453..6f4b2fa1 100644 --- a/test/functional/steps/TestDataAndOperations.groovy +++ b/test/functional/steps/TestDataAndOperations.groovy @@ -240,7 +240,7 @@ class TestDataAndOperations { static public ResearchGroup createAndGetResearchGroupByNameWithTwitter(String name, String twitter) { def researchGroupController = new ResearchGroupController() - researchGroupController.params << findResearchGroupByGroupName(name) + researchGroupController.params << [name: name, description: "descricao"] if(twitter != null) researchGroupController.params << [twitter: twitter] researchGroupController.create() diff --git a/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy b/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy index 9cb82072..9dfc2c07 100644 --- a/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy +++ b/test/functional/steps/ThesisOrDissertationTestDataAndOperations.groovy @@ -6,7 +6,7 @@ import rgms.publication.TeseController class ThesisOrDissertationTestDataAndOperations { - static protected void createThesisOrDissertation(String title, filename, school, cont) { + static public void createThesisOrDissertation(String title, filename, school, cont) { cont.params << [title: title, publicationDate: new Date(2013, 03, 02), school: school, address: "Boa Viagem", file: filename] cont.request.setContent(new byte[1000]) // Could also vary the request content. @@ -15,7 +15,7 @@ class ThesisOrDissertationTestDataAndOperations { cont.response.reset() } - static protected void deleteThesisOrDissertation(String title, cont) { + static public void deleteThesisOrDissertation(String title, cont) { def test if (cont instanceof TeseController) { test = Tese.findByTitle(title) diff --git a/test/unit/rgms/member/MemberSpec.groovy b/test/unit/rgms/member/MemberSpec.groovy new file mode 100644 index 00000000..32165678 --- /dev/null +++ b/test/unit/rgms/member/MemberSpec.groovy @@ -0,0 +1,21 @@ +package rgms.member + +import grails.test.mixin.TestMixin +import grails.test.mixin.support.GrailsUnitTestMixin +import spock.lang.Specification + +/** + * See the API for {@link grails.test.mixin.support.GrailsUnitTestMixin} for usage instructions + */ +@TestMixin(GrailsUnitTestMixin) +class MemberSpec extends Specification { + + def setup() { + } + + def cleanup() { + } + + void "test something"() { + } +} \ No newline at end of file