Skip to content

Commit

Permalink
Added compatibility with new Docker (compose) version.
Browse files Browse the repository at this point in the history
Replaced usage of POST `/checkout?include=orders` to POST `/checkout`, the response has order reference.
  • Loading branch information
matweew committed Jan 22, 2025
1 parent 8030a87 commit 6c610e6
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .env-default
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ K6_HTTP_DEBUG=
# This variable is the path to the script file that K6 will execute during the test.
# The test script is a JavaScript file that contains the test scenarios and configuration for the test.
# This variable should be set to the path of the script file that should be run.
K6_SCRIPT=tests/example-scenario.js
K6_SCRIPT=tests/abstract-scenario.js

###################################
# Spryker Test Framework Settings #
Expand Down
12 changes: 11 additions & 1 deletion shell/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,17 @@ build_k6_docker_command() {
return 1;
fi

command="docker-compose run --rm \
if docker compose version >/dev/null 2>&1; then
DOCKER_COMPOSE="docker compose"
# Check if 'docker-compose' is available
elif docker-compose --version >/dev/null 2>&1; then
DOCKER_COMPOSE="docker-compose"
else
echo "Neither 'docker compose' nor 'docker-compose' is available. Please install one of them."
exit 1
fi

command="$DOCKER_COMPOSE run --rm \
-v $(pwd):/scripts \
-u $(id -u):$(id -g) \
-e 'SPRYKER_TEST_RUN_ID=$testRunId' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class SharedCheckoutScenario extends AbstractScenario {
}

const checkoutResponse = this.http.sendPostRequest(
this.http.url`${this.getStorefrontApiBaseUrl()}/checkout?include=orders`,
this.http.url`${this.getStorefrontApiBaseUrl()}/checkout`,
JSON.stringify(this._getCheckoutData(cartId, customerEmail, isMpPaymentProvider)),
requestParams,
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Reorder
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Reorder
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Reorder
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Reorder
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedCartReorderScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Edit an order
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function execute(data) {
// Edit an order
const cartReorderResponseJson = sharedOrderAmendmentScenario.haveOrderAmendment(
customerEmail,
checkoutResponseJson.data.relationships.orders.data[0].id
checkoutResponseJson.data.attributes.orderReference
);

// Place an updated order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Edit an order
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function execute(data) {
// Edit an order
const cartReorderResponseJson = sharedOrderAmendmentScenario.haveOrderAmendment(
customerEmail,
checkoutResponseJson.data.relationships.orders.data[0].id
checkoutResponseJson.data.attributes.orderReference
);

// Place an updated order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Edit an order
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function execute(data) {
// Edit an order
const cartReorderResponseJson = sharedOrderAmendmentScenario.haveOrderAmendment(
customerEmail,
checkoutResponseJson.data.relationships.orders.data[0].id
checkoutResponseJson.data.attributes.orderReference
);

// Place an updated order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ export function execute(data) {
const checkoutResponseJson = sharedCheckoutScenario.haveOrder(customerEmail, quoteIds[quoteIndex], false);

// Edit an order
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.relationships.orders.data[0].id, thresholdTag);
sharedOrderAmendmentScenario.execute(customerEmail, checkoutResponseJson.data.attributes.orderReference, thresholdTag);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function execute(data) {
// Edit an order
const cartReorderResponseJson = sharedOrderAmendmentScenario.haveOrderAmendment(
customerEmail,
checkoutResponseJson.data.relationships.orders.data[0].id
checkoutResponseJson.data.attributes.orderReference
);

// Place an updated order
Expand Down

0 comments on commit 6c610e6

Please sign in to comment.