Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSS3 RLFS - Atividade 5 #254

Closed
wants to merge 11 commits into from
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ target/test-reports/plain/TEST-functional-cucumber-Visit.txt

.idea/*

target/test-reports/*

target/test-reports/TEST-functional-cucumber-orientations.xml

target/test-reports/html/11_orientations.html
Expand All @@ -441,3 +443,5 @@ target/test-reports/plain/TEST-functional-cucumber-orientations-err.txt
target/test-reports/plain/TEST-functional-cucumber-orientations-out.txt

target/test-reports/plain/TEST-functional-cucumber-orientations.txt


Binary file modified chromedrivers/chromedriverwindows.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ grails {
port = 465
//TODO: Before running, make sure that your email login and password appear below
//TODO: Before committing, make sure that the strings "LOGIN" and "PASSWORD" appear in place of your login and password
username = "LOGIN"
username = "USERNAME"
password = "PASSWORD"
props = ["mail.smtp.auth": "true",
"mail.smtp.socketFactory.port": "465",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ class BookChapterController {
def bookChapterInstance = BookChapter.get(id)
aux.delete(id, bookChapterInstance, 'bookChapter.label', 'BookChapter');
}


}
6 changes: 4 additions & 2 deletions grails-app/domain/rgms/member/Orientation.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class Orientation {
String instituicao
String curso


static constraints = {
tipo(nullable: false, blank: false, inList: ["Mestrado","Doutorado","Iniciação Científica"])
orientando(nullable: false)
orientador(nullable: false)
tituloTese(nullable: false, blank: false)
anoPublicacao(nullable: false)
tituloTese(nullable: false, blank: false, unique: true)
anoPublicacao(nullable: false, min: 0)
instituicao(nullable: false, blank: false)
curso(nullable: true)
}

boolean Equals(Orientation other)
Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/rgms/publication/BookChapter.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class BookChapter extends Publication {
int chapter

static constraints = {
publisher nullable: false, blank: false
publisher nullable: false, blank: false, unique: ['title','file','chapter']
chapter nullable: false, blank: false, min: 1
}

Expand Down
15 changes: 12 additions & 3 deletions test/cucumber/BookChapter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,33 @@ Feature: BookChapter

Scenario: register book chapter with invalid data
Given I am at the book chapter page
And I select the Novo BookChapter option at the book chapter page
And I select the new book chapter option at the book chapter page
And I fill only the title field with the value "Next Generation Software Product Line Engineering"
Then A failure message is displayed
And I still on the book chapter create page

Scenario: new book chapter web
Given I am at the book chapter page
And the system has no book chapter entitled "Next Generation Software Product Line Engineering"
When I go to NewBookChapter page
When I go to new book chapter page
And I use the webpage to create the book chapter "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
Then the book chapter "Next Generation Software Product Line Engineering" was stored by the system
And it is shown in the book chapter list with title "Next Generation Software Product Line Engineering"

#4
Scenario: new duplicate book chapter web
Given I am at the book chapter page
And the system has a book chapter entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
When I go to new book chapter page
And I use the webpage to create the book chapter "Next Generation Software Product Line Engineering" with file name "Ngs.pdf"
Then the book chapter "Next Generation Software Product Line Engineering" is not stored twice
And the system shows an error message

#if ($contextualInformation)

Scenario: new book chapter filled with user data by default
Given I am at the book chapter page
And I select the Novo BookChapter option at the book chapter page
And I select the new book chapter option at the book chapter page
Then I see my user listed as a member of book chapter by default
#end

Expand Down
89 changes: 65 additions & 24 deletions test/cucumber/Orientation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,78 @@ Feature: orientations
so that I can generate web pages and reports containing these orientations

Scenario: new orientation
Given the system has no orientations entitled "The Book is on the table 2"
When I create a orientation for the thesis "The Book is on the table 2"
Then the orientation "The Book is on the table 2" is properly stored by the system
Given the system has no orientations entitled "The Book is on the table"
When I create a new orientation entitled "The Book is on the table"
Then the orientation "The Book is on the table" is properly stored by the system

Scenario: remove existing orientation
Given the system has thesis entitled "The Book is on the table" supervised for someone
Given the system has an orientation entitled "The Book is on the table" supervised by someone
When I delete the orientation for "The Book is on the table"
Then the orientation for "The Book is on the table" is properly removed by the system

Scenario: create orientation web
Given I am at the create orientation page
When I fill the orientation title with "The Book is on the table"
Then I am on the orientation show page
When I fill the orientation title with "The Book of Web Software"
And I select the list orientation option
Then the orientation "The Book of Web Software" is properly stored by the system

Scenario: edit existing orientation web
Given I am at the orientation page and the orientation "The Book is on the table" is stored in the system
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 resulting list
And I change the orientation title to "Hexa"
And I select the change option at the orientation edit page
Then the edited orientation "Hexa" is properly stored by the system

#1 This scenario test are not working well, please check they implementation before undo the comment

#Scenario: new orientation with registered member orientated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicar porque o cenário foi comentado

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

este foi trocado pela correção na implementação do cenário de teste "new orientation", e como esta sendo problemática a sua implementação, foi comentada, deixando-se como sugestão para futuras implementações por outros alunos.

# Given the system has no orientations entitled "The Book is on the table 2"
# And Exists a member "Rubens Lopes" with username "rlfs" that has been an registered member
#When I create a orientation for the thesis "The Book is on the table 2" with registered member "rlfs"
#Then the orientation "The Book is on the table 2" is properly stored by the system


#2
Scenario: duplicate orientation
Given the system has an orientation entitled "The Book is on the table" supervised by someone
When I create a new orientation entitled "The Book is on the table"
Then the orientation for the thesis "The Book is on the table" is not stored twice

#3
Scenario: create orientation web with invalid year
Given I am at the create orientation page
When I fill the orientation title with "The Book is on the table" and the year with -1
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 tituloTese to "Hexa"
And I select the "Alterar" option
Then I am on the orientation show page

#if ($XMLUpload)
Scenario: upload orientation with a file
Given the system has some orientations stored
When I upload a new orientation "testelattes.xml"
Then the system has more orientations now

Scenario: upload orientations with a file
Given I am at the publications menu
When I select the "Orientation" option at the program menu
And I select the upload button at the orientations page
Then I'm still on orientations page
And the orientations are not stored by the system
#end
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

#9 extra
Scenario: remove orientation web
Given I am at the orientation page
And the orientation "Hexa2" is stored in the system
When I select to view "Hexa2" in the list of orientations
And I select the option remove at the orientation show page
Then The orientation "Hexa2" is properly removed by the system

#if ($XMLUpload)
Scenario: upload orientation with a file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

por isso que é ruim mudar o texto de lugar no arquivo

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrigido!
Código posto no fim do arquivo como era anteriormente.

Given the system has some orientations stored
When I upload a new orientation "testelattes.xml"
Then the system has more orientations now

Scenario: upload orientations with a file
Given I am at the publications menu
When I select the "Orientation" option at the program menu
And I select the upload button at the orientations page
Then I'm still on orientations page
And the orientations are not stored by the system
#end
17 changes: 15 additions & 2 deletions test/cucumber/Thesis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
Feature: Thesis Tests
As a member of a research group
I want to add, remove and modify theses I have added

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"
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

#6
Scenario: remove existing thesis
Given the system has thesis entitled "New thesis2"
When I delete the thesis "New thesis2"
Then the thesis "New thesis2" is properly removed by the system

Scenario: create thesis web
Given I am at the create thesis page
When I fill the thesis details with "Software Engineering", "10", "8", "1998", "UFPE" and "Recife"
Expand All @@ -24,6 +30,13 @@ Feature: Thesis Tests
When I fill some thesis details with "Tese002", "10", "8", "1998", "UFPE" and "Recife"
Then I am still on the create thesis page with the error message

#7
Scenario: remove existing thesis web
Given I am at the thesis page and the thesis "Software Enginnering2" is stored in the system
When I select to view thesis "Software Enginnering2" in resulting list
And I select the remover option at the thesis show page
Then the thesis "Software Enginnering2" is removed from the system

#if ($contextualInformation)
Scenario: Add a new thesis with user data already filled by default
Given I am at the publications menu
Expand Down
61 changes: 41 additions & 20 deletions test/cucumber/steps/BookChapterSteps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ Then(~'^the book chapter "([^"]*)" is properly removed by the system$') { String
checkIfExists(title)
}

When(~'^I select the Novo BookChapter option at the book chapter page$') {->
When(~'^I select the new book chapter option at the book chapter page$') { ->
at BookChapterPage
page.selectNewBookChapter()
}

Given(~'^I am at the book chapter page$') {->
Given(~'^I am at the book chapter page$') { ->
to LoginPage
at LoginPage
page.fillLoginData("admin", "adminadmin")
Expand All @@ -60,20 +60,20 @@ And(~'^I fill only the title field with the value "([^"]*)"$') { String title ->
page.fillTitle(title)
}

Then(~'^A failure message is displayed$') {->
assert ( page.readFlashMessage() != null )
Then(~'^A failure message is displayed$') { ->
assert (page.readFlashMessage() != null)

}
And(~'^I still on the book chapter create page$'){->
And(~'^I still on the book chapter create page$') { ->
at BookChapterCreatePage
}

Then(~'^I see my user listed as a member of book chapter by default$') {->
Then(~'^I see my user listed as a member of book chapter by default$') { ->
at BookChapterCreatePage
assert TestDataAndOperationsPublication.containsUser(page.selectedMembers())
}

When(~'^I view the book chapter list$') {->
When(~'^I view the book chapter list$') { ->
to BookChapterPage
}

Expand All @@ -82,7 +82,7 @@ Then(~'my book chapter list contains "([^"]*)"$') { String title ->
bookChapterList = BookChapter.findAll()
assert BookChapterTestDataAndOperations.containsBookChapter(title, bookChapterList)
}
And(~'^the book chapter "([^"]*)" with file name "([^"]*)" was created before$'){ String title, filename ->
And(~'^the book chapter "([^"]*)" with file name "([^"]*)" was created before$') { String title, filename ->
page.selectNewBookChapter()
to BookChapterCreatePage
at BookChapterCreatePage
Expand All @@ -95,30 +95,30 @@ Then(~'My resulting book chapter list contains "([^"]*)"$') { String title ->
at BookChapterPage
page.checkBookChapterAtList(title, 0)
}
When(~'^I go to NewBookChapter page$'){->
to BookChapterPage
When(~'^I go to new book chapter page$') { ->
// to BookChapterPage
at BookChapterPage
page.selectNewBookChapter()
at BookChapterCreatePage
}
And(~'^I use the webpage to create the book chapter "([^"]*)" with file name "([^"]*)"$'){ String title, filename ->
And(~'^I use the webpage to create the book chapter "([^"]*)" with file name "([^"]*)"$') { String title, filename ->
at BookChapterCreatePage
createAndCheckBookOnBrowser(title, filename)
to BookChapterPage
at BookChapterPage
}
Then(~'^the book chapter "([^"]*)" was stored by the system$'){String title ->
Then(~'^the book chapter "([^"]*)" was stored by the system$') { String title ->
book = BookChapter.findByTitle(title)
assert book != null
to BookChapterPage
at BookChapterPage
}
And(~'^it is shown in the book chapter list with title "([^"]*)"$'){ String title ->
And(~'^it is shown in the book chapter list with title "([^"]*)"$') { String title ->
to BookChapterPage
at BookChapterPage
page.checkBookChapterAtList(title, 0)
}
Given(~'^the system has some book chapters stored$') {->
Given(~'^the system has some book chapters stored$') { ->
initialSize = BookChapter.findAll().size()
}
When(~'^I upload the book chapters of "([^"]*)"$') { filename ->
Expand All @@ -128,7 +128,7 @@ When(~'^I upload the book chapters of "([^"]*)"$') { filename ->
finalSize = BookChapter.findAll().size()
assert initialSize < finalSize
}
Then(~'^the system has all the book chapters of the xml file$') {->
Then(~'^the system has all the book chapters of the xml file$') { ->
assert BookChapter.findByTitle("Refinement of Concurrent Object Oriented Programs") != null
assert BookChapter.findByTitle("A RUP-Based Software Process Supporting Progressive Implementation") != null
assert BookChapter.findByTitle("Transformation Laws for Sequential Object-Oriented Programming") != null
Expand All @@ -137,26 +137,47 @@ Then(~'^the system has all the book chapters of the xml file$') {->
assert BookChapter.findByTitle("An Introduction to Software Product Line Refactoring") != null
}

And(~'^I select the upload button at the book chapter page$') {->

And(~'^I select the upload button at the book chapter page$') { ->
at BookChapterPage
page.uploadWithoutFile()
}
Then(~'^I\'m still on book chapter page$') {->
Then(~'^I\'m still on book chapter page$') { ->
at BookChapterPage
}
And(~'^the book chapters are not stored by the system$') {->
And(~'^the book chapters are not stored by the system$') { ->
at BookChapterPage
page.checkIfBookChapterListIsEmpty()
}

def createAndCheckBookOnBrowser(String title, String filename){
And(~'^the system has a book chapter entitled "([^"]*)" with file name "([^"]*)"$') { String title, String filename ->
book = BookChapter.findByTitle(title)
if (book == null) {
BookChapterTestDataAndOperations.createBookChapter(title, filename)
}
}

Then(~'^the book chapter "([^"]*)" was not stored twice$') { String entitled ->
bookChapter = BookChapter.findAllByPublisher(entitled)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

é ByPublisher mesmo? não faz muito sentido.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrigido!
Foi um acidente.

assert bookChapter.size() < 2
}

And(~'^the system shows an error message$') { ->
at BookChapterPage
//assert page.readFlashMessage()
//Thread.sleep(100000)
assert page.hasErrorUploadFile()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poderia ser mais específico comparando o conteúdo da mensagem?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrigido! Agora identificando de acordo com o conteúdo da mensagem!



def createAndCheckBookOnBrowser(String title, String filename) {
page.fillBookChapterDetails(title, filename)
page.clickSaveBookChapter()
book = BookChapter.findByTitle(title)
assert book != null
}

def checkIfExists(String title){
def checkIfExists(String title) {
bookChapter = BookChapter.findByTitle(title)
assert bookChapter == null
}
Loading