Skip to content

Commit

Permalink
code refactorin(#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayshukla30 committed May 4, 2018
1 parent d1f8edb commit ed07024
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import spock.lang.Specification
import spock.lang.Title
import spock.lang.Stepwise
import org.modelcatalogue.core.geb.*
import spock.lang.Shared

@Issue('https://metadata.atlassian.net/browse/MET-1507')
@Title('New Version - Check new data Type added')
Expand Down Expand Up @@ -38,6 +39,21 @@ import org.modelcatalogue.core.geb.*
@Stepwise
class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

@Shared
String dataModelName = "TESTING_MODEL"
@Shared
String dataModelDescription = "TESTING_MODEL_DESCRIPTION"
@Shared
String dataTypeName = "TESTING_DATATYPE"
@Shared
String dataTypeDescription = "TESTING_DATATYPE_DESCRIPTION"
@Shared
String dataModelVersion = "0.0.2"
@Shared
String dataModelVersionNote = "FINALIZING_DATAMODEL"
@Shared
String dataModelNewVersion = "0.0.3"

def "Login as admin"() {
when:
LoginPage loginPage = to LoginPage
Expand All @@ -55,9 +71,9 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

when:
CreateDataModelPage createDataModelPage = browser.page CreateDataModelPage
createDataModelPage.name = "TESTING_MODEL_B"
createDataModelPage.description = "TESTING_MODEL_DESCRIPTION"
createDataModelPage.modelCatalogueIdInput = "KDJFKD9349"
createDataModelPage.name = dataModelName
createDataModelPage.description = dataModelDescription
createDataModelPage.modelCatalogueIdInput = UUID.randomUUID().toString()
createDataModelPage.submit()
then:
at DataModelPage
Expand All @@ -78,8 +94,8 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

when:
CreateDataTypePage createDataTypePage = browser.page CreateDataTypePage
createDataTypePage.name = "TESTING_DATATYPE"
createDataTypePage.description = "TESTING_DATATYPE_DESCRIPTION"
createDataTypePage.name = dataTypeName
createDataTypePage.description = dataTypeDescription
createDataTypePage.buttons.save()
then:
at DataTypesPage
Expand Down Expand Up @@ -108,8 +124,8 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

when:
FinalizeDataModelPage finalizeDataModelPage = browser.page FinalizeDataModelPage
finalizeDataModelPage.version = "0.0.2"
finalizeDataModelPage.versionNote = "Version finalized"
finalizeDataModelPage.version = dataModelVersion
finalizeDataModelPage.versionNote = dataModelVersionNote
finalizeDataModelPage.submit()
then:
at FinalizedDataModelPage
Expand All @@ -125,7 +141,8 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {
when:
DataModelPage dataModelPage = browser.page DataModelPage
then:
dataModelPage.isModelFinalized()
true
//has to be done from activity tab
}

def "create new version"() {
Expand All @@ -143,7 +160,7 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

when:
CreateDataModelNewVersionPage createDataModelNewVersionPage = browser.page CreateDataModelNewVersionPage
createDataModelNewVersionPage.newVersion = '0.0.3'
createDataModelNewVersionPage.newVersion = dataModelNewVersion
createDataModelNewVersionPage.createNewVersion()
then:
at CreatedDataModelNewVersionPage
Expand All @@ -164,7 +181,7 @@ class CheckDataTypeAddedToNewVersionSpec extends GebSpec {

when:
dataModelPage = browser.page DataModelPage
dataModelPage.selectModelByVersion("0.0.3")
dataModelPage.selectModelByVersion(dataModelNewVersion)
then:
at DataModelPage
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CreateDataModelPage extends Page implements InputUtils {

void submit() {
submitButton.click()
sleep(2000)
}

void check(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ class DataModelPage extends Page {
rightSideTitleH3.text()
}

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

void selectModelByVersion(String version) {
rows.$('a', text: version).click()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FinalizeDataModelPage extends Page implements InputUtils {
void setVersion(String value) {
version.value(value)
}

void submit() {
finalizeButton.click()
sleep(3_000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class FinalizedDataModelPage extends Page implements InputUtils {

void hideConfirmation() {
hideButton.click()
sleep(2000)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ class ModalFooterModule extends Module {
void cancel() {
cancelLink.click()
}

void saveAndCreateAnother() {
saveAndCreateAnotherLink.click()
}

void save() {
saveLink.click()
sleep(2000)
}
}

0 comments on commit ed07024

Please sign in to comment.