Skip to content

Commit

Permalink
#31402 karate tests adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinogiardino committed Mar 1, 2025
1 parent 86bf3cb commit 1ac43dc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
4 changes: 2 additions & 2 deletions test-karate/src/test/java/graphql/ftm/newContent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Background:
* def title = __arg.title
* def publishDate = __arg.publishDate
* def expiresOn = __arg.expiresOn
* def action = __arg.action ? __arg.action : 'PUBLISH'
* def urlTitle = __arg.urlTitle
* def action = __arg.action ? __arg.action : 'PUBLISH'
# Default to PUBLISH if action is not provided

Given url baseUrl + '/api/v1/workflow/actions/default/fire/' + action + '?indexPolicy=WAIT_FOR'
And headers commonHeaders

* def requestPayload = buildContentRequestPayload (contentTypeId, title, publishDate, expiresOn, urlTitle)
* def requestPayload = buildContentRequestPayload (contentTypeId, title, publishDate, expiresOn, null, urlTitle)
And request requestPayload

When method POST
Expand Down
30 changes: 2 additions & 28 deletions test-karate/src/test/java/graphql/ftm/newUrlMapContentType.feature
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Feature: Create a Content Type with URL Map
"required":true,
"searchable":true,
"sortOrder":2,
"unique":true,
"unique":false,
"variable":"urlTitle"
},
{
Expand Down Expand Up @@ -252,31 +252,6 @@ Feature: Create a Content Type with URL Map
"unique":false,
"variable":"title"
},
{
"clazz":"com.dotcms.contenttype.model.field.ImmutableCustomField",
"contentTypeId":"d90434114b901620af330653e4d33f25",
"dataType":"LONG_TEXT",
"fieldType":"Custom-Field",
"fieldTypeLabel":"Custom Field",
"fieldVariables":[
],
"fixed":false,
"forceIncludeInApi":false,
"iDate":1740706740000,
"id":"53e9ed7ffd1dd44dc1407f84c20270f8",
"indexed":false,
"listed":false,
"modDate":1740706749000,
"name":"URL Title",
"readOnly":false,
"required":false,
"searchable":false,
"sortOrder":3,
"unique":false,
"values":"#dotParse(\"/dA/0ec62ffd3666f23fc5228ef84a481b09\")",
"variable":"urlTitle"
},
{
"clazz":"com.dotcms.contenttype.model.field.ImmutableDateTimeField",
"contentTypeId":"d90434114b901620af330653e4d33f25",
Expand Down Expand Up @@ -353,5 +328,4 @@ Feature: Create a Content Type with URL Map
"""
When method POST
Then status 200
And match response.entity[0].id != null
And match response.entity[0].variable == contentTypeVariable
And match response.entity[0].id != null
7 changes: 3 additions & 4 deletions test-karate/src/test/java/graphql/ftm/setup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ Feature: Setting up the Future Time Machine Test

# Create a couple of new pieces of content for the UrlMap Content Type
* def createUrlMapContentPieceOneResult = callonce read('classpath:graphql/ftm/newContent.feature') { contentTypeId: '#(urlMapContentTypeId)', title: 'url-content-map-test-1-v1', urlTitle: 'url-content-map-test-1' }
* def urlMapContentPieceOne = createContentPieceOneResult.response.entity.results
* def urlMapContentPieceOneId = contentPieceOne.map(result => Object.keys(result)[0])
* def urlMapContentPieceOneId = contentPieceOneId[0]
* def urlMapContentPieceOneUrl = contentPieceOneId[0]["urlMap"]
* def urlMapContentPieceOne = createUrlMapContentPieceOneResult.response.entity.results[0]
* def urlMapContentPieceOneId = karate.keysOf(urlMapContentPieceOne)[0]
* def urlMapContentPieceOneUrl = urlMapContentPieceOne[urlMapContentPieceOneId].urlMap

# Create new version of the content for the UrlMap Content Type with future publishDate
* def newUrlMapContentPiceOneVersion2 = callonce read('classpath:graphql/ftm/newContentVersion.feature') { contentTypeId: '#(urlMapContentTypeId)', identifier: '#(urlMapContentPieceOneId)', title: 'url-content-map-test-1-v2', publishDate: '#(formattedFutureDateTime)' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ Feature: Test Time Machine functionality

* def urlContentMap = response.entity.urlContentMap
* def urlContentMapTitle = urlContentMap.title
* karate.log('urlContentMapTitle:', urlContentMapTitle)

# Expect the first version of the content to be displayed
* match urlContentMapTitle contains URL_CONTENT_MAP_TITLE_V1

Expand All @@ -165,6 +167,8 @@ Feature: Test Time Machine functionality

* def urlContentMap = response.entity.urlContentMap
* def urlContentMapTitle = urlContentMap.title
* karate.log('urlContentMapTitle:', urlContentMapTitle)

# Expect the second version of the content to be displayed
* match urlContentMapTitle contains URL_CONTENT_MAP_TITLE_V2

Expand Down

0 comments on commit 1ac43dc

Please sign in to comment.