Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 0 additions & 157 deletions .github/workflows/test.yml

This file was deleted.

30 changes: 20 additions & 10 deletions .github/workflows/test-e2e.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E tests
name: Tests
on:
push:
paths-ignore:
Expand Down Expand Up @@ -26,7 +26,7 @@ jobs:

detect-changes:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
outputs:
changed-modules: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -46,6 +46,8 @@ jobs:
- 'pos-module-chat/**'
common-styling:
- 'pos-module-common-styling/**'
payments-stripe:
- 'pos-module-payments-stripe/**'
payments-example-gateway:
- 'pos-module-payments-example-gateway/**'

Expand Down Expand Up @@ -73,6 +75,12 @@ jobs:
"deploy-script": "pos-cli data clean --include-schema --auto-confirm\npos-cli deploy",
"test-commands": "npm run pw-tests"
},
"payments-stripe": {
"module": "payments-stripe",
"path": "pos-module-payments-stripe",
"deploy-script": "./tests/data/seed/seed.sh",
"test-commands": "npm run api-tests"
},
"payments-example-gateway": {
"module": "payments-example-gateway",
"path": "pos-module-payments-example-gateway",
Expand Down Expand Up @@ -112,7 +120,7 @@ jobs:

echo "matrix=$modules" >> $GITHUB_OUTPUT

test-e2e:
run-tests:
needs: detect-changes
if: |
needs.detect-changes.result == 'success' &&
Expand All @@ -130,6 +138,7 @@ jobs:
MPKIT_EMAIL: ${{ secrets.MPKIT_EMAIL }}
NPM_CONFIG_CACHE: ${{ github.workspace }}/.npm
E2E_TEST_PASSWORD: ${{ secrets.E2E_TEST_PASSWORD }}
STRIPE_SK_KEY: ${{ secrets.STRIPE_SK_KEY }}
HTML_ATTACHMENTS_BASE_URL: ${{ vars.HTML_ATTACHMENTS_BASE_URL }}
TEST_REPORT_MPKIT_URL: ${{ vars.TEST_REPORT_MPKIT_URL }}
TEST_REPORT_MPKIT_TOKEN: ${{ secrets.TEST_REPORT_MPKIT_TOKEN }}
Expand Down Expand Up @@ -173,6 +182,7 @@ jobs:
shell: sh
env:
MPKIT_URL: ${{ steps.reserve.outputs.mpkit-url }}
MPKIT_TOKEN: ${{ steps.get-token.outputs.mpkit-token }}
working-directory: ${{ matrix.path }}
run: |
set -eu
Expand All @@ -187,37 +197,37 @@ jobs:
pos-ci-repo-token: ${{ secrets.POS_CI_PS_REPO_ACCESS_TOKEN }}

conclusion:
needs: [detect-changes, test-e2e]
needs: [detect-changes, run-tests]
if: always()
runs-on: ubuntu-latest
steps:
- name: Generate workflow summary
run: |
if [ "${{ needs.detect-changes.outputs.changed-modules }}" = "[]" ] || [ "${{ needs.detect-changes.result }}" = "skipped" ]; then
echo "## E2E Tests - Skipped" >> $GITHUB_STEP_SUMMARY
echo "## Tests - Skipped" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.detect-changes.result }}" = "skipped" ]; then
echo "Workflow was skipped by duplicate action check." >> $GITHUB_STEP_SUMMARY
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manual trigger with no matching modules selected." >> $GITHUB_STEP_SUMMARY
else
echo "No modules with E2E tests were changed in this push." >> $GITHUB_STEP_SUMMARY
echo "No modules with tests were changed in this push." >> $GITHUB_STEP_SUMMARY
fi
else
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "## E2E Tests - Completed (Manual Trigger)" >> $GITHUB_STEP_SUMMARY
echo "## Tests - Completed (Manual Trigger)" >> $GITHUB_STEP_SUMMARY
else
echo "## E2E Tests - Completed" >> $GITHUB_STEP_SUMMARY
echo "## Tests - Completed" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "Tests ran for the following modules:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '${{ needs.detect-changes.outputs.changed-modules }}' | jq -r '.[] | "- " + .module' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test-e2e.result }}" = "success" ]; then
if [ "${{ needs.run-tests.result }}" = "success" ]; then
echo "Result: All tests passed" >> $GITHUB_STEP_SUMMARY
elif [ "${{ needs.test-e2e.result }}" = "skipped" ]; then
elif [ "${{ needs.run-tests.result }}" = "skipped" ]; then
echo "Result: Tests were skipped" >> $GITHUB_STEP_SUMMARY
else
echo "Result: Some tests failed - check job output for details" >> $GITHUB_STEP_SUMMARY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://api.stripe.com/v1/balance/history?payout={{ payout.payout_id }}&limit=10
{% liquid
assign expand = 'data.source.source_transfer,data.source.source_transfer.source_transaction' | split: ','
assign payload = {"expand": expand, "connected_account_id": payout.gateway_connected_account_id, "stripe_account_name": payout.stripe_account_name}
assign data = {"payload": payload, "request_type": 'GET', "to": url}
assign data = {"payload": payload, "request_type": "GET", "to": url}

return data
%}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% liquid
assign idempotency_key = object | hash_delete_key: 'idempotency_key'
assign data = {"payload": object, "request_type": 'POST', "to": 'https://api.stripe.com/v1/charges', "idempotency_key": idempotency_key}
assign data = '{}' | parse_json
hash_assign data['payload'] = object
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, we do not want to revert to hash_merge

hash_assign data['request_type'] = 'POST'
hash_assign data['to'] = 'https://api.stripe.com/v1/charges'
hash_assign data['idempotency_key'] = idempotency_key

return data
%}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% liquid
assign result = object | default: {}
assign result = object | default: '{}' | parse_json
return result
%}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% liquid
assign data = {"payload": object, "request_type": 'POST', "to": 'https://api.stripe.com/v1/checkout/sessions'}
assign data = '{}' | parse_json
hash_assign data['payload'] = object
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, we do not want to revert to hash_merge

hash_assign data['request_type'] = 'POST'
hash_assign data['to'] = 'https://api.stripe.com/v1/checkout/sessions'

return data
%}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% liquid
assign url = 'https://api.stripe.com/v1/checkout/sessions'
assign url = "https://api.stripe.com/v1/checkout/sessions"
assign url = url | append: '/' | append: transaction.gateway_transaction_id | append: '/expire'

assign data = {"request_type": 'POST', "to": url}
assign data = {"request_type": "POST", "to": url}

return data
%}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% liquid
assign url = 'https://api.stripe.com/v1/checkout/sessions'
assign url = "https://api.stripe.com/v1/checkout/sessions"
assign url = url | append: '/' | append: transaction.gateway_transaction_id

assign payload = {}
if with_payment_intent
assign expand = ["payment_intent"]
assign payload.expand = expand
endif
assign data = {"payload": payload, "request_type": 'GET', "to": url}
assign data = {"payload": payload, "request_type": "GET", "to": url}

return data
%}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% liquid
assign data = {"payload": object, "request_type": 'POST', "to": 'https://api.stripe.com/v1/checkout/sessions'}
assign data = '{}' | parse_json
hash_assign data['payload'] = object
hash_assign data['request_type'] = 'POST'
hash_assign data['to'] = 'https://api.stripe.com/v1/checkout/sessions'

return data
%}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
}
{%- endparse_json -%}
{% liquid
return {"payload": payload, "request_type": 'POST', "to": "https://api.stripe.com/v1/accounts"}
assign result = '{}' | parse_json
hash_assign result['payload'] = payload
hash_assign result['request_type'] = 'POST'
hash_assign result['to'] = 'https://api.stripe.com/v1/accounts'
return result
%}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
https://api.stripe.com//v1/accounts/{{ account_id }}
{% endcapture %}
{% liquid
return {"payload": null, "request_type": 'DELETE', "to": url}
assign result = '{}' | parse_json
hash_assign result['payload'] = null
hash_assign result['request_type'] = 'DELETE'
hash_assign result['to'] = url
return result
%}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% capture url %}
https://api.stripe.com//v1/accounts/{{ account_id }}/login_links
{% endcapture %}
{% assign payload = {"stripe_account_name": stripe_account_name} %}
{% liquid
return {"payload": payload, "request_type": 'POST', "to": url}
assign payload = '{}' | parse_json
hash_assign payload['stripe_account_name'] = stripe_account_name

assign result = '{}' | parse_json
hash_assign result['payload'] = payload
hash_assign result['request_type'] = 'POST'
hash_assign result['to'] = url
return result
%}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
}
{%- endparse_json -%}
{% liquid
return {"payload": payload, "request_type": 'POST', "to": "https://api.stripe.com/v1/account_links"}
assign result = '{}' | parse_json
hash_assign result['payload'] = payload
hash_assign result['request_type'] = 'POST'
hash_assign result['to'] = 'https://api.stripe.com/v1/account_links'
return result
%}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ https://api.stripe.com/v1/customers/{{ customer_id }}
{% endcapture %}
{% liquid
assign payload = {"stripe_account_name": stripe_account_name}
assign data = {"payload": payload, "request_type": 'GET', "to": url}
assign data = {"payload": payload, "request_type": "GET", "to": url}

return data
%}
Loading
Loading