Skip to content

Commit

Permalink
ci: removed hardcoded site id from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdowdle committed Aug 17, 2023
1 parent 9636770 commit ab89182
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/nuxt-app/test/features/landingpage/forms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Feature: Forms
Given the mock server has started
And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200
And the site endpoint returns fixture "/site/reference" with status 200
And posting to endpoint "/api/tide/webform_submission/full_form" with query "?id=8888" returns fixture "/landingpage/full-form-error-response" with status 500
And posting form to endpoint "/api/tide/webform_submission/full_form" returns fixture "/landingpage/full-form-error-response" with status 500
Given I visit the page "/kitchen-sink"
Then the landing page component "TideLandingPageWebForm" should exist
And the form with ID "full_form" should exist
Expand All @@ -102,7 +102,7 @@ Feature: Forms
Given the mock server has started
And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200
And the site endpoint returns fixture "/site/reference" with status 200
And posting to endpoint "/api/tide/webform_submission/full_form" with query "?site=8888" returns fixture "/landingpage/full-form-success-response" with status 201
And posting form to endpoint "/api/tide/webform_submission/full_form" returns fixture "/landingpage/full-form-success-response" with status 201
Given I visit the page "/kitchen-sink"
Then the landing page component "TideLandingPageWebForm" should exist
And the form with ID "full_form" should exist
Expand Down
11 changes: 8 additions & 3 deletions packages/ripple-test-utils/step_definitions/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ Given(
)

Given(
`posting to endpoint {string} with query {string} returns fixture {string} with status {int}`,
(route: string, query: string, fixture: string, status: number) => {
`posting form to endpoint {string} returns fixture {string} with status {int}`,
(route: string, fixture: string, status: number) => {
cy.fixture(fixture).then((response) => {
cy.task('setMockPostRouteWithQuery', { route, status, response, query })
cy.task('setMockPostRouteWithQuery', {
route,
status,
response,
query: `?site=${Cypress.env('NUXT_PUBLIC_TIDE_SITE')}`
})
})
}
)
Expand Down

0 comments on commit ab89182

Please sign in to comment.