From 0cf5a3fcca325ab9d1125ed8bbdae79c4fac5ab3 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Tue, 28 Oct 2014 21:13:22 -0300 Subject: [PATCH 01/13] Book GUI scenarios added --- test/cucumber/Book.feature | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index 3624ed38..f38875f4 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -34,4 +34,18 @@ 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 + + Scenario: remove existing book web + Given I am at the book page + And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" + When I choose to view "Next Generation Software Product Line Engineering" in book list + And I press to remove at the book show page + Then the book "Next Generation Software Product Line Engineering" is removed from the system + + Scenario: list existing book web + Given I am at the book page + And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" + Then the book list contains "Next Generation Software Product Line Engineering" + + From 4f0160a76aa1810bb78fcc68b9243bcda4f199cd Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Tue, 28 Oct 2014 22:11:52 -0300 Subject: [PATCH 02/13] Articles Features modified --- test/cucumber/Article.feature | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cucumber/Article.feature b/test/cucumber/Article.feature index 01606f0d..9f8bdb15 100644 --- a/test/cucumber/Article.feature +++ b/test/cucumber/Article.feature @@ -47,13 +47,15 @@ Feature: journal article Then the article "A theory of software product line refinement" is properly updated by the system Scenario: remove existing article web - Given I am at the articles page and the article "A theory of software product line refinement" is stored in the system with file name "TCS-77.pdf" + Given I am at the articles page + And the article "A theory of software product line refinement" is stored in the system with file name "TCS-77.pdf" When I select to view "A theory of software product line refinement" in resulting list And I select the option to remove in show page Then the article "A theory of software product line refinement" is properly removed by the system Scenario: list existing article web - Given I am at the articles page and the article "A theory of software product line refinement" is stored in the system with file name "TCS-88.pdf" + Given I am at the articles page + And the article "A theory of software product line refinement" is stored in the system with file name "TCS-88.pdf" Then my resulting articles list contains "A theory of software product line refinement" Scenario: edit existing article web From 0440dffb3635d8b0b9aa7fe6db18ef3fa8d455b2 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Tue, 28 Oct 2014 23:05:33 -0300 Subject: [PATCH 03/13] Dissertation GUI scenarios modified --- test/cucumber/Dissertacao.feature | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/cucumber/Dissertacao.feature b/test/cucumber/Dissertacao.feature index 98a20dd2..a5973bcb 100644 --- a/test/cucumber/Dissertacao.feature +++ b/test/cucumber/Dissertacao.feature @@ -58,18 +58,16 @@ Feature: Dissertation Tests Then the dissertation "Edit dissertation" is properly updated by the system Scenario: delete dissertation - Given the dissertation "Delete dissertation" is stored in the system with file name "Deletedissertation.txt" - Given I am at the publications menu - When I select the "Dissertacao" option at the program menu - And I select "Delete dissertation" at the dissertation page - And I delete "Delete dissertation" - Then the system has no dissertation entitled "Delete dissertation" + Given I am at the dissertation page + And the dissertation named "Dissertation One" is stored in the system + When I select "Dissertation One" at the dissertation list + And I press to remove "Delete dissertation" at the dissertation show page + Then the system has no dissertation entitled "Dissertation One" Scenario: upload dissertation without a file - Given I am at the publications menu - When I select the "Dissertacao" option at the program menu - And I select the upload button at the dissertation page - Then I'm still on dissertation page + Given I am at the dissertation page + And I select the upload button with no file selected + Then I stay on dissertation page with an error message Scenario: upload dissertation with a file Given the system has some dissertation stored From 4c84b909f029cc6e3d40417c4a292da34460ebf5 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Tue, 28 Oct 2014 23:15:04 -0300 Subject: [PATCH 04/13] Dissertation Controller scenarios modified --- test/cucumber/Article.feature | 6 ++---- test/cucumber/Dissertacao.feature | 9 ++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/test/cucumber/Article.feature b/test/cucumber/Article.feature index 9f8bdb15..01606f0d 100644 --- a/test/cucumber/Article.feature +++ b/test/cucumber/Article.feature @@ -47,15 +47,13 @@ Feature: journal article Then the article "A theory of software product line refinement" is properly updated by the system Scenario: remove existing article web - Given I am at the articles page - And the article "A theory of software product line refinement" is stored in the system with file name "TCS-77.pdf" + Given I am at the articles page and the article "A theory of software product line refinement" is stored in the system with file name "TCS-77.pdf" When I select to view "A theory of software product line refinement" in resulting list And I select the option to remove in show page Then the article "A theory of software product line refinement" is properly removed by the system Scenario: list existing article web - Given I am at the articles page - And the article "A theory of software product line refinement" is stored in the system with file name "TCS-88.pdf" + Given I am at the articles page and the article "A theory of software product line refinement" is stored in the system with file name "TCS-88.pdf" Then my resulting articles list contains "A theory of software product line refinement" Scenario: edit existing article web diff --git a/test/cucumber/Dissertacao.feature b/test/cucumber/Dissertacao.feature index a5973bcb..fdee037b 100644 --- a/test/cucumber/Dissertacao.feature +++ b/test/cucumber/Dissertacao.feature @@ -29,7 +29,7 @@ Feature: Dissertation Tests Scenario: new dissertation duplicated Given the dissertation "Dissertation duplicated" is stored in the system with file name "Dissertationduplicated.txt" - When I create the dissertation "Dissertation duplicated" with file name "Dissertationduplicated2.txt" and school "UFPE" + When I create the dissertation "Dissertation duplicated" with file name "Dissertationduplicated2.txt" Then the dissertation "Dissertation duplicated" is not stored twice Scenario: new dissertation without file @@ -39,12 +39,7 @@ Feature: Dissertation Tests And I cant add the dissertation without a file Then the system has no dissertation entitled "Dissertacao sem arquivo" - 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 "curriculo4.xml" with title "New dissertation" - Then the system has more dissertations now - - Scenario: new dissertation with file + Scenario: new dissertation with file Given I am at the publications menu When I select the "Dissertacao" option at the program menu And I select the new dissertation option at the dissertation page From d5774f56a77dc1a09303b02aea11e56179c2c818 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Tue, 11 Nov 2014 22:21:01 -0300 Subject: [PATCH 05/13] Book GUI Test Steps added --- test/cucumber/steps/BookSteps.groovy | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 45aae835..94946ccd 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -103,6 +103,57 @@ Then(~'^the book "([^"]*)" was stored by the system$') { String title -> at BookPage } + +Given(~'^I am at the book page$') { -> + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + at PublicationsPage + to BookPage +} + +And(~'^the book "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> + BookTestDataAndOperations.createBook(title, filename) + book = Book.findByTitle(title) + assert BookTestDataAndOperations.bookCompatibleTo(book, title) +} + +When(~'^I choose to view "([^"]*)" in book list$') { String title -> + page.selectViewBook(title) + at BookShowPage +} + +And(~'^I press to remove at the book show page$') {-> + at BookShowPage + page.select('input', 'delete') +} + +Then(~'^the article "([^"]*)" is properly removed by the system$') { String title -> + assert checkIfExists(title) +} + + +Given(~'^I am at the book page$') { -> + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + at PublicationsPage + to BookPage +} + +And(~'^the book "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> + BookTestDataAndOperations.createBook(title, filename) + book = Book.findByTitle(title) + assert BookTestDataAndOperations.bookCompatibleTo(book, title) +} + +Then(~'^the book list contains" ([^"]*)"$') { String title -> + at BookPage + page.checkArticleAtList(title, 0) +} + + + def checkIfExists(String title) { book = Book.findByTitle(title) assert book == null From 9b419f420f90b6476231863a925cc4e5306fe82d Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Thu, 13 Nov 2014 15:42:04 -0300 Subject: [PATCH 06/13] Duplicate test removed --- test/cucumber/steps/BookSteps.groovy | 33 +--------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 94946ccd..0101e9f2 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -88,14 +88,12 @@ When(~'^I go to new book page$') { -> to BookPage page.selectNewBook() } - And(~'^I use the webpage to create the book "([^"]*)" with file name "([^"]*)"$') { String title, filename -> at BookCreatePage createAndCheckBookOnBrowser(title, filename) to BookPage at BookPage } - Then(~'^the book "([^"]*)" was stored by the system$') { String title -> book = Book.findByTitle(title) assert book != null @@ -104,48 +102,19 @@ Then(~'^the book "([^"]*)" was stored by the system$') { String title -> } -Given(~'^I am at the book page$') { -> - to LoginPage - at LoginPage - page.fillLoginData("admin", "adminadmin") - at PublicationsPage - to BookPage -} - -And(~'^the book "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> - BookTestDataAndOperations.createBook(title, filename) - book = Book.findByTitle(title) - assert BookTestDataAndOperations.bookCompatibleTo(book, title) -} - When(~'^I choose to view "([^"]*)" in book list$') { String title -> page.selectViewBook(title) at BookShowPage } - And(~'^I press to remove at the book show page$') {-> at BookShowPage page.select('input', 'delete') } - Then(~'^the article "([^"]*)" is properly removed by the system$') { String title -> assert checkIfExists(title) } -Given(~'^I am at the book page$') { -> - to LoginPage - at LoginPage - page.fillLoginData("admin", "adminadmin") - at PublicationsPage - to BookPage -} - -And(~'^the book "([^"]*)" is stored in the system with file name "([^"]*)"$') { String title, String filename -> - BookTestDataAndOperations.createBook(title, filename) - book = Book.findByTitle(title) - assert BookTestDataAndOperations.bookCompatibleTo(book, title) -} Then(~'^the book list contains" ([^"]*)"$') { String title -> at BookPage @@ -164,4 +133,4 @@ def createAndCheckBookOnBrowser(String title, String filename) { page.clickSaveBook() book = Book.findByTitle(title) assert book != null -} \ No newline at end of file +} From c9cb68fa57fcb2bd9411c98f0f95167f9744fa97 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Sat, 22 Nov 2014 01:40:27 -0200 Subject: [PATCH 07/13] fixed scenario: upload dissertation without a file --- test/cucumber/steps/DissertacaoSteps.groovy | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/test/cucumber/steps/DissertacaoSteps.groovy b/test/cucumber/steps/DissertacaoSteps.groovy index 03cd3324..27fadef4 100644 --- a/test/cucumber/steps/DissertacaoSteps.groovy +++ b/test/cucumber/steps/DissertacaoSteps.groovy @@ -101,13 +101,6 @@ Then(~'^the dissertation "([^"]*)" is properly updated by the system$') { String assert article == null } -When(~'^I select the upload button at the dissertation page$') {-> - at DissertationPage - page.uploadWithoutFile() -} -Then(~'^I\'m still on dissertation page$') {-> - at DissertationPage -} When(~'^I upload a new dissertation "([^"]*)"$') { filename -> String path = new File(".").getCanonicalPath() + File.separator + "test" + File.separator + "functional" + File.separator + "steps" + File.separator + filename @@ -157,3 +150,21 @@ Given(~'^the system has no dissertation stored$') {-> } +Given(~'^I am at the dissertation page$') { -> + to LoginPage + at LoginPage + page.fillLoginData("admin", "adminadmin") + at PublicationsPage + to DissertationPage +} +When(~'^I select the upload button with no file selected$') {-> + page.uploadWithoutFile() +} +Then(~'^I stay on dissertation page with an error message$') { -> + at DissertationPage + assert page.readFlashMessage() != null +} + + + + From 025d563b453e14959311e8978bc574771717d0bc Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Sat, 22 Nov 2014 01:57:47 -0200 Subject: [PATCH 08/13] Scenario test: Delete dissertation Modification and implementation done --- test/cucumber/steps/DissertacaoSteps.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cucumber/steps/DissertacaoSteps.groovy b/test/cucumber/steps/DissertacaoSteps.groovy index 27fadef4..73dceeb5 100644 --- a/test/cucumber/steps/DissertacaoSteps.groovy +++ b/test/cucumber/steps/DissertacaoSteps.groovy @@ -166,5 +166,7 @@ Then(~'^I stay on dissertation page with an error message$') { -> } - +When(~'^I press to remove "([^"]*)" at the dissertation show page$'){ String title-> + page.select('input', 'delete') +} From 95ad3b08f0c995fe2129324a90efa1df1621afb3 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Sun, 23 Nov 2014 22:47:26 -0200 Subject: [PATCH 09/13] Book marks added --- test/cucumber/Book.feature | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index f38875f4..0e4473ef 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -35,7 +35,7 @@ Feature: Book 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 - +#if($bookOperations) Scenario: remove existing book web Given I am at the book page And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" @@ -47,5 +47,4 @@ Feature: Book Given I am at the book page And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" Then the book list contains "Next Generation Software Product Line Engineering" - - +#end From d842158c52ae50a412935f6d941a552fc0a092ea Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Wed, 21 Jan 2015 00:34:20 -0300 Subject: [PATCH 10/13] new Books steps added new Dissertacao steps added new functions created on: BookShowPage DissertationShowPage DissertationPage BookPage --- test/cucumber/Book.feature | 10 +++--- test/cucumber/Dissertacao.feature | 2 +- test/cucumber/steps/BookSteps.groovy | 23 ++++++++++++-- test/cucumber/steps/DissertacaoSteps.groovy | 20 +++++++++++- test/functional/pages/BookPage.groovy | 8 +++++ test/functional/pages/BookShowPage.groovy | 31 +++++++++++++++++++ test/functional/pages/DissertationPage.groovy | 15 ++++++++- .../pages/DissertationShowPage.groovy | 16 ++++++++-- .../steps/TestDataDissertacao.groovy | 2 +- 9 files changed, 114 insertions(+), 13 deletions(-) create mode 100644 test/functional/pages/BookShowPage.groovy diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index f38875f4..d29133b9 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -36,6 +36,11 @@ Feature: Book 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 + Scenario: list existing book web + Given I am at the book page + And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" + Then the book list contains "Next Generation Software Product Line Engineering" + Scenario: remove existing book web Given I am at the book page And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" @@ -43,9 +48,6 @@ Feature: Book And I press to remove at the book show page Then the book "Next Generation Software Product Line Engineering" is removed from the system - Scenario: list existing book web - Given I am at the book page - And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" - Then the book list contains "Next Generation Software Product Line Engineering" + diff --git a/test/cucumber/Dissertacao.feature b/test/cucumber/Dissertacao.feature index fdee037b..5eb67b28 100644 --- a/test/cucumber/Dissertacao.feature +++ b/test/cucumber/Dissertacao.feature @@ -39,7 +39,7 @@ Feature: Dissertation Tests And I cant add the dissertation without a file Then the system has no dissertation entitled "Dissertacao sem arquivo" - Scenario: new dissertation with file + Scenario: new dissertation with file Given I am at the publications menu When I select the "Dissertacao" option at the program menu And I select the new dissertation option at the dissertation page diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 0101e9f2..eafa88e8 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -7,6 +7,7 @@ */ import pages.BookCreatePage +import pages.BookShowPage import pages.BookPage import pages.LoginPage import pages.PublicationsPage @@ -110,9 +111,7 @@ And(~'^I press to remove at the book show page$') {-> at BookShowPage page.select('input', 'delete') } -Then(~'^the article "([^"]*)" is properly removed by the system$') { String title -> - assert checkIfExists(title) -} + @@ -123,6 +122,8 @@ Then(~'^the book list contains" ([^"]*)"$') { String title -> + + def checkIfExists(String title) { book = Book.findByTitle(title) assert book == null @@ -134,3 +135,19 @@ def createAndCheckBookOnBrowser(String title, String filename) { book = Book.findByTitle(title) assert book != null } + + +Given(~'^the system has the book entitled "([^"]*)" with file name "([^"]*)"$') { String title, String file -> + book = Book.findByTitleAndFile(title, file) + assert book != null +} + +Then(~'^the book "([^"]*)" is removed from the system$') { String title -> + book = Book.findByTitle(title) + assert book == null +} + +Then(~'^the book list contains "([^"]*)"$') { String title -> + book = Book.findByTitle(title) + assert book != null +} diff --git a/test/cucumber/steps/DissertacaoSteps.groovy b/test/cucumber/steps/DissertacaoSteps.groovy index 73dceeb5..5cb6b3ea 100644 --- a/test/cucumber/steps/DissertacaoSteps.groovy +++ b/test/cucumber/steps/DissertacaoSteps.groovy @@ -6,7 +6,8 @@ import rgms.authentication.User import rgms.publication.Dissertacao import steps.TestDataDissertacao import steps.TestDataAndOperationsPublication - +import pages.LoginPage +import pages.PublicationsPage import static cucumber.api.groovy.EN.* @@ -167,6 +168,23 @@ Then(~'^I stay on dissertation page with an error message$') { -> When(~'^I press to remove "([^"]*)" at the dissertation show page$'){ String title-> + at DissertationShowPage page.select('input', 'delete') } +When(~'^I create the dissertation "([^"]*)" with file name "([^"]*)"$') { String title, String filename -> + TestDataDissertacao.createDissertacao(title, filename, "UFPE") + dissertation = Dissertacao.findByTitle(title) + assert dissertation != null +} + +Given(~'^the dissertation named "([^"]*)" is stored in the system$') { String title -> + TestDataDissertacao.createDissertacao(title, "testDissertation.pdf", "UFPE") + dissertation = Dissertacao.findByTitle(title) + assert dissertation != null +} + +When(~'^I select "([^"]*)" at the dissertation list$') { String title -> + page.selectDissertation(title) +} + diff --git a/test/functional/pages/BookPage.groovy b/test/functional/pages/BookPage.groovy index 2c658d49..c2fdcba0 100644 --- a/test/functional/pages/BookPage.groovy +++ b/test/functional/pages/BookPage.groovy @@ -26,6 +26,14 @@ class BookPage extends Page { } + def selectViewBook(title) { + def listDiv = $('div', id: 'list-book') + def bookTable = (listDiv.find('table'))[0] + def bookRow = bookTable.find('tbody').find('tr') + def showLink = bookRow.find('td').find([text: title]) + showLink.click() + } + def selectNewBook() { $('a.create').click() } diff --git a/test/functional/pages/BookShowPage.groovy b/test/functional/pages/BookShowPage.groovy new file mode 100644 index 00000000..46e923f9 --- /dev/null +++ b/test/functional/pages/BookShowPage.groovy @@ -0,0 +1,31 @@ +package pages + +import geb.Page + +/** + * Created by Casa on 20/01/2015. + */ +class BookShowPage extends Page { + + static url = "book/show" + + static at = { + GetPageTitle gp = new GetPageTitle() + def currentBook = gp.msg("default.book.label") + def currentTitle = gp.msg("default.show.label", [currentBook]) + + title ==~ currentTitle + } + + static content = { + } + + def select(String e, v) { + if (v == 'delete') { + assert withConfirm(true) { $("form").find(e, class: v).click() } + } else { + $("form").find(e, class: v).click() + } + } + +} diff --git a/test/functional/pages/DissertationPage.groovy b/test/functional/pages/DissertationPage.groovy index b510ee72..473f7455 100644 --- a/test/functional/pages/DissertationPage.groovy +++ b/test/functional/pages/DissertationPage.groovy @@ -6,7 +6,11 @@ class DissertationPage extends Page { static url = "dissertacao/list" static at = { - title ==~ /Dissertacao Listagem/ + GetPageTitle gp = new GetPageTitle() + def currentDissertation = gp.msg("default.periodico.label") + def currentTitle = gp.msg("default.list.label", [currentDissertation]) + + title ==~ currentTitle } static content = { @@ -23,6 +27,14 @@ class DissertationPage extends Page { $('input.save').click() } + def selectViewDissertation(title) { + def listDiv = $('div', id: 'list-dissertacao') + def dissertationTable = (listDiv.find('table'))[0] + def dissertationRow = dissertationTable.find('tbody').find('tr') + def showLink = dissertationRow.find('td').find([text: title]) + showLink.click() + } + def checkIfDissertationListIsEmpty(){ def listDiv = $('div', id: 'list-dissertacao') def dissertationTable = (listDiv.find('table'))[0] @@ -31,4 +43,5 @@ class DissertationPage extends Page { assert dissertationColumns.size() < 6 } + } diff --git a/test/functional/pages/DissertationShowPage.groovy b/test/functional/pages/DissertationShowPage.groovy index 30d667a3..eebd00d3 100644 --- a/test/functional/pages/DissertationShowPage.groovy +++ b/test/functional/pages/DissertationShowPage.groovy @@ -8,9 +8,13 @@ import geb.Page; class DissertationShowPage extends Page{ static url = "dissertacao/show" - + static at = { - title ==~ /Ver Dissertacao/ + GetPageTitle gp = new GetPageTitle() + def currentDissertation = gp.msg("default.dissertacao.label") + def currentTitle = gp.msg("default.show.label", [currentDissertation]) + + title ==~ currentTitle } static content = { @@ -26,4 +30,12 @@ class DissertationShowPage extends Page{ $('input.delete').click() } } + + def select(String e, v) { + if (v == 'delete') { + assert withConfirm(true) { $("form").find(e, class: v).click() } + } else { + $("form").find(e, class: v).click() + } + } } diff --git a/test/functional/steps/TestDataDissertacao.groovy b/test/functional/steps/TestDataDissertacao.groovy index a7e034fa..d0dcfb74 100644 --- a/test/functional/steps/TestDataDissertacao.groovy +++ b/test/functional/steps/TestDataDissertacao.groovy @@ -55,7 +55,7 @@ class TestDataDissertacao def testDissertation = Dissertacao.findByTitle(title) def cont = new DissertacaoController() def date = new Date() - cont.params << [id: testDissertation.id] + cont.params << [id: testDissertation?.id] cont.delete() } From 24911d48481b6ac7ec7e6e0d6232358ce1a079ad Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Mon, 2 Feb 2015 17:36:34 -0300 Subject: [PATCH 11/13] Testing --- test/cucumber/Book.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index f38875f4..c103f01a 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -48,4 +48,4 @@ Feature: Book And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" Then the book list contains "Next Generation Software Product Line Engineering" - + Testing stuff From d2f41b8aecad99073543a4cea72149cbc2063183 Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Fri, 6 Feb 2015 13:48:48 -0300 Subject: [PATCH 12/13] Function checkIfExists matches its title-behavior now Removed duplicates by checkIfExists equivalent placements --- test/cucumber/Book.feature | 10 +++++----- test/cucumber/steps/BookSteps.groovy | 20 +++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/test/cucumber/Book.feature b/test/cucumber/Book.feature index c103f01a..c03bfbb9 100644 --- a/test/cucumber/Book.feature +++ b/test/cucumber/Book.feature @@ -36,6 +36,11 @@ Feature: Book 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 + Scenario: list existing book web + Given I am at the book page + And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" + Then the book list contains "Next Generation Software Product Line Engineering" + Scenario: remove existing book web Given I am at the book page And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" @@ -43,9 +48,4 @@ Feature: Book And I press to remove at the book show page Then the book "Next Generation Software Product Line Engineering" is removed from the system - Scenario: list existing book web - Given I am at the book page - And the system has the book entitled "Next Generation Software Product Line Engineering" with file name "Ngs.pdf" - Then the book list contains "Next Generation Software Product Line Engineering" - Testing stuff diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index eafa88e8..276d9707 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -17,7 +17,7 @@ import steps.BookTestDataAndOperations import static cucumber.api.groovy.EN.* Given(~'^the system has no book entitled "([^"]*)"$') { String title -> - checkIfExists(title) + assert !checkIfExists(title) } When(~'^I create the book "([^"]*)" with file name "([^"]*)"$') { String title, filename -> @@ -40,7 +40,7 @@ When(~'^I remove the book "([^"]*)"$') { String title -> } Then(~'^the book "([^"]*)" is properly removed by the system$') { String title -> - checkIfExists(title) + assert !checkIfExists(title) } Then(~'^the book "([^"]*)" is not stored twice$') { String title -> @@ -96,8 +96,7 @@ And(~'^I use the webpage to create the book "([^"]*)" with file name "([^"]*)"$' at BookPage } Then(~'^the book "([^"]*)" was stored by the system$') { String title -> - book = Book.findByTitle(title) - assert book != null + assert checkIfExists(title) to BookPage at BookPage } @@ -126,14 +125,14 @@ Then(~'^the book list contains" ([^"]*)"$') { String title -> def checkIfExists(String title) { book = Book.findByTitle(title) - assert book == null + book != null } + def createAndCheckBookOnBrowser(String title, String filename) { page.fillBookDetails(title, filename) page.clickSaveBook() - book = Book.findByTitle(title) - assert book != null + assert checkIfExists(title) } @@ -143,11 +142,10 @@ Given(~'^the system has the book entitled "([^"]*)" with file name "([^"]*)"$') } Then(~'^the book "([^"]*)" is removed from the system$') { String title -> - book = Book.findByTitle(title) - assert book == null + + assert !checkIfExists(title) } Then(~'^the book list contains "([^"]*)"$') { String title -> - book = Book.findByTitle(title) - assert book != null + assert checkIfExists(title) } From aded9661d2b06c4dc8c1e8c04e54dc46dfb9c6bb Mon Sep 17 00:00:00 2001 From: Jonas Lins Date: Fri, 6 Feb 2015 16:07:03 -0300 Subject: [PATCH 13/13] Functions moved to the end of page --- test/cucumber/steps/BookSteps.groovy | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test/cucumber/steps/BookSteps.groovy b/test/cucumber/steps/BookSteps.groovy index 276d9707..a39f34ea 100644 --- a/test/cucumber/steps/BookSteps.groovy +++ b/test/cucumber/steps/BookSteps.groovy @@ -120,8 +120,19 @@ Then(~'^the book list contains" ([^"]*)"$') { String title -> } +Given(~'^the system has the book entitled "([^"]*)" with file name "([^"]*)"$') { String title, String file -> + book = Book.findByTitleAndFile(title, file) + assert book != null +} +Then(~'^the book "([^"]*)" is removed from the system$') { String title -> + assert !checkIfExists(title) +} + +Then(~'^the book list contains "([^"]*)"$') { String title -> + assert checkIfExists(title) +} def checkIfExists(String title) { book = Book.findByTitle(title) @@ -135,17 +146,3 @@ def createAndCheckBookOnBrowser(String title, String filename) { assert checkIfExists(title) } - -Given(~'^the system has the book entitled "([^"]*)" with file name "([^"]*)"$') { String title, String file -> - book = Book.findByTitleAndFile(title, file) - assert book != null -} - -Then(~'^the book "([^"]*)" is removed from the system$') { String title -> - - assert !checkIfExists(title) -} - -Then(~'^the book list contains "([^"]*)"$') { String title -> - assert checkIfExists(title) -}