Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use immutable WC order ID for KOMOJU sessions #81

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
cd tests
npm install
npx cypress run
npm run cypress:run
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NPX ignores our pinned version of cypress, I found it was installing cypress version 11. Using the NPM script will use our pinned version.

- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v3
Expand All @@ -27,7 +27,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build plugin zip file
run: ./build.bash
- uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion class-wc-gateway-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function process_payment($order_id, $payment_type = null)
],
'line_items' => $line_items,
'metadata' => [
'woocommerce_order_id' => $order->get_order_number(),
'woocommerce_order_id' => strval($order->get_id()),
],
];
$remove_nulls = function ($v) { return !is_null($v); };
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
context: .
dockerfile: Dockerfile
args:
woocommerce_version: 4.0.1
woocommerce_version: 4.8.0
ports:
- "8000:80"
restart: always
Expand Down
4 changes: 2 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ docker-compose down --volumes
To run tests,

```bash
npx cypress run
npm run cypress:run
```


To visually debug and inspect the in-progress tests,

```bash
npx cypress open
npm run cypress:open
```
36 changes: 23 additions & 13 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,33 @@ Cypress.Commands.add('installWooCommerce', () => {
}
}

cy.get('#select2-store_country-container').click();
cy.get('.select2-search__field').type('Japan{enter}');
cy.get('#store_address').type('1234 abc st');
cy.get('#store_city').type('Kichijoji');
cy.get('[aria-labelledby="select2-store_state-container"]').click();
cy.get('.select2-search__field').type('Tokyo{enter}');
cy.get('#store_postcode').type('181-0004');
cy.contains("Let's go!").click();
// Store Details
cy.get('#inspector-text-control-0').type('1234 abc st');
cy.get('#woocommerce-select-control-0__control-input').click();
cy.get('#woocommerce-select-control-0__control-input').type('Tokyo{enter}');
cy.get('#inspector-text-control-2').type('Kichijoji');
cy.get('#inspector-text-control-3').type('181-0004');
cy.contains('Continue').click();
cy.get('div.woocommerce-profile-wizard__usage-wrapper').contains('Continue').click();

cy.get('.stripe-logo .wc-wizard-service-toggle').click();
// Industry
cy.get('label[for="inspector-checkbox-control-7"]').click();
cy.contains('Continue').click();

cy.get('[name="shipping_zones[domestic][flat_rate][cost]"]').type('100');
cy.get('[name="shipping_zones[intl][flat_rate][cost]"]').type('250');
// Products Types
cy.contains('Continue').click();

cy.contains('Skip this step').click();
cy.contains('Skip this step').click();
// Business Details
cy.get('label[for="woocommerce-select-control-1__control-input"]').click();
cy.get('#woocommerce-select-control__option-1-1-10').click();
cy.get('label[for="woocommerce-select-control-2__control-input"]').click();
cy.get('#woocommerce-select-control__option-2-no').click();
cy.get('input.components-form-toggle__input').each((toggle) => { toggle.click() });
cy.contains('Continue').click();

// Theme
cy.contains('Continue with my active them').click();

cy.visit('/wp-admin/edit.php?post_type=product&page=product_importer');

cy.get('#upload').selectFile({
Expand Down Expand Up @@ -168,6 +176,8 @@ Cypress.Commands.add('goToStore', () => {
Cypress.Commands.add('fillInAddress', () => {
cy.get('#billing_last_name').type('{selectAll}Johnson');
cy.get('#billing_first_name').type('{selectAll}Test');
cy.get('#select2-billing_country-container').click();
cy.get('.select2-search__field').type('Japan{enter}');
cy.get('#billing_postcode').type('{selectAll}181-0004');
cy.get('#billing_city').type('{selectAll}Musashino');
cy.get('#billing_address_1').type('{selectAll}a');
Expand Down
Loading