Skip to content

Commit

Permalink
implement CheckDataTypeAddedToNewVersion(#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayshukla30 committed May 2, 2018
1 parent de7e6f4 commit d1f8edb
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import spock.lang.Issue
import spock.lang.Narrative
import spock.lang.Specification
import spock.lang.Title
import spock.lang.Stepwise
import org.modelcatalogue.core.geb.*

@Issue('https://metadata.atlassian.net/browse/MET-1507')
@Title('New Version - Check new data Type added')
Expand Down Expand Up @@ -33,6 +35,137 @@ import spock.lang.Title
- Enter Name, Catalogue ID, Description and select type of data type. Click Save | New Data Type is created.
- Check that new data type appears under list in Data Types main page ( 'Active Data types as title) | Data Type has been created
''')

@Stepwise
class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

def "Login as admin"() {
when:
LoginPage loginPage = to LoginPage
loginPage.login("curator", "curator")
then:
at DashboardPage
}

def "create a data model"() {
when:
DashboardPage dashboardPage = browser.page DashboardPage
dashboardPage.nav.createDataModel()
then:
at CreateDataModelPage

when:
CreateDataModelPage createDataModelPage = browser.page CreateDataModelPage
createDataModelPage.name = "TESTING_MODEL_B"
createDataModelPage.description = "TESTING_MODEL_DESCRIPTION"
createDataModelPage.modelCatalogueIdInput = "KDJFKD9349"
createDataModelPage.submit()
then:
at DataModelPage
}

def "create a data type"() {
when:
DataModelPage dataModelPage = browser.page DataModelPage
dataModelPage.treeView.dataTypes()
then:
at DataTypesPage

when:
DataTypesPage dataTypesPage = browser.page DataTypesPage
dataTypesPage.createDataTypeFromGreenPlusButton()
then:
at CreateDataTypePage

when:
CreateDataTypePage createDataTypePage = browser.page CreateDataTypePage
createDataTypePage.name = "TESTING_DATATYPE"
createDataTypePage.description = "TESTING_DATATYPE_DESCRIPTION"
createDataTypePage.buttons.save()
then:
at DataTypesPage
}

def "navigate back to data model main page"() {
when:
DataTypesPage dataTypesPage = browser.page DataTypesPage
dataTypesPage.treeView.dataModel()
then:
at DataModelPage
}

def "finalize the data model"() {
when:
DataModelPage dataModelPage = browser.page DataModelPage
dataModelPage.dropdown()
then:
at DataModelPage

when:
dataModelPage = browser.page DataModelPage
dataModelPage.finalizedDataModel()
then:
at FinalizeDataModelPage

when:
FinalizeDataModelPage finalizeDataModelPage = browser.page FinalizeDataModelPage
finalizeDataModelPage.version = "0.0.2"
finalizeDataModelPage.versionNote = "Version finalized"
finalizeDataModelPage.submit()
then:
at FinalizedDataModelPage

when:
FinalizedDataModelPage finalizedDataModelPage = browser.page FinalizedDataModelPage
finalizedDataModelPage.hideConfirmation()
then:
at DataModelPage
}

def "verify data model is finalized"() {
when:
DataModelPage dataModelPage = browser.page DataModelPage
then:
dataModelPage.isModelFinalized()
}

def "create new version"() {
when:
DataModelPage dataModelPage = browser.page DataModelPage
dataModelPage.dropdown()
then:
at DataModelPage

when:
dataModelPage = browser.page DataModelPage
dataModelPage.dropdownMenu.createNewVersion()
then:
at CreateDataModelNewVersionPage

when:
CreateDataModelNewVersionPage createDataModelNewVersionPage = browser.page CreateDataModelNewVersionPage
createDataModelNewVersionPage.newVersion = '0.0.3'
createDataModelNewVersionPage.createNewVersion()
then:
at CreatedDataModelNewVersionPage

when:
CreatedDataModelNewVersionPage createdDataModelNewVersionPage = browser.page CreatedDataModelNewVersionPage
createdDataModelNewVersionPage.hide()
then:
at DataModelPage
}

def "navigate to new version created"() {
when:
DataModelPage dataModelPage = browser.page DataModelPage
dataModelPage.treeView.versions()
then:
at DataModelPage

when:
dataModelPage = browser.page DataModelPage
dataModelPage.selectModelByVersion("0.0.3")
then:
at DataModelPage
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.modelcatalogue.core.geb

import geb.Page

class CreateDataModelNewVersionPage extends Page implements InputUtils {
static atCheckWaiting = true

static at = { $("div.modal-header>h4").text()?.contains('New Version of') }

static content = {
semanticVersion { $('input#semanticVersion') }
createNewVersionButton { $('a#role_modal_modal-create-new-versionBtn') }
}

void setNewVersion(String value) {
fillInput(semanticVersion, value)
}

void createNewVersion() {
createNewVersionButton.click()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CreateDataModelPage extends Page implements InputUtils {
}

void setDescription(String value) {
fillInput(modelCatalogueIdInput, value)
fillInput(descriptionTextArea, value)
}

void removeTag() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.modelcatalogue.core.geb

import geb.Page

class CreatedDataModelNewVersionPage extends Page implements InputUtils {
static atCheckWaiting = true

static at = { $("div.modal-header>h4")*.text().join(",").contains('Create new version of') }

static content = {
hideButton { $('button', text: 'Hide') }
}

void hide() {
hideButton.click()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class DataModelPage extends Page {
deleteButton(required: false) { $('#delete-menu-item-link', 0) }
modalDialog(required: false) { $('.modal-dialog', 0).module(ModalDialogModule) }
dropdownLink(wait: true, required: false) { $('a#role_item_catalogue-element-menu-item-link', 0) }
dropdownMenu(required: false) { $('#role_item_catalogue-element-menu-item-link').module(DataModelNavModule) }
dropdownMenu(required: false) {
$('#role_item_catalogue-element-menu-item-link').siblings('ul.dropdown-menu').module(DataModelNavModule)
}
exportLink(required: false) { $('a#role_item_export-menu-item-link') }
exportXMLLink(required: false) { $('a#catalogue-element-export-specific-reports_12-menu-item-link') }
finalizedLink(required: false) { $("a#finalize-menu-item-link") }
Expand Down Expand Up @@ -72,4 +74,12 @@ class DataModelPage extends Page {
String getRightSideTitle() {
rightSideTitleH3.text()
}

boolean isModelFinalized() {
$('small', text: contains('Version finalized')).displayed
}

void selectModelByVersion(String version) {
rows.$('a', text: version).click()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import geb.Module
class DataModelTreeViewModule extends Module {

static content = {
dataModelLink { $('a.catalogue-element-treeview-icon') }
dataModelLink { $('span.catalogue-element-treeview-name', 0) }
item { $('ul .catalogue-element-treeview-name', text: it) }
}

void dataModel() {
dataModelLink.click()
dataModelLink.siblings('a.catalogue-element-treeview-icon').click()
}

void dataClasses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class DataTypesPage extends Page {
}

boolean areCreateButtonsVisible() {
if ( createDateTypeLink.empty ) {
if (createDateTypeLink.empty) {
return false
}
if ( addItemIcon.empty ) {
if (addItemIcon.empty) {
return false
}
true
Expand All @@ -44,4 +44,8 @@ class DataTypesPage extends Page {
void createDataTypeFromNavigation() {
createDateTypeLink.click()
}

void createDataTypeFromGreenPlusButton() {
addItemIcon.click()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ class FinalizeDataModelPage extends Page implements InputUtils {
static content = {
versionNoteTextarea { $('textarea#revisionNotes') }
finalizeButton { $('a#role_modal_modal-finalize-data-modalBtn', 0) }
version { $('#semanticVersion') }
}

void setVersionNote(String value) {
fillInput(versionNoteTextarea, value)
}

void setVersion(String value) {
version.value(value)
}

void submit() {
finalizeButton.click()
sleep(3_000)
Expand Down

0 comments on commit d1f8edb

Please sign in to comment.