Skip to content
Merged
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
1 change: 1 addition & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ services:
source: https://github.com/pronamic/woocommerce-subscriptions.git
post_install_commands:
- git -C "$$PLUGIN_DIR" fetch -q origin 2459d9c8662884d62b9a92221eb21c7c6c051a62 && git -C "$$PLUGIN_DIR" checkout -q 2459d9c8662884d62b9a92221eb21c7c6c051a62
- wp option update woocommerce_subscriptions_apportion_recurring_price yes-upgrade
wordpress_custom_themes:
- slug: libresign
source: https://github.com/LibreSign/wordpress-theme.git
Expand Down
6 changes: 4 additions & 2 deletions tests/E2E/PlanChange.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';

import { nextcloud } from './support/nextcloud';
import { agreeToTheTerms, aSubscriber, logInToTheStore, placeTheOrder, plansInTheStore, STORE_URL } from './support/store';
import { subscriptionStatus } from './support/wordpress';
import { orderTotal, subscriptionStatus } from './support/wordpress';

const GIGABYTE = 1024 ** 3;

Expand All @@ -23,7 +23,7 @@ test.describe( 'Changing plan', () => {
await expect( page.getByRole( 'link', { name: 'Professional', exact: true } ) ).toHaveCount( 0 );
} );

test( 'upgrading from Basic to Enterprise raises the workspace storage to 800 GB', async ( { browser, page } ) => {
test( 'upgrading from Basic to Enterprise charges the prorated difference and raises the workspace storage to 800 GB', async ( { browser, page } ) => {
const { customer, subscriptionId } = await aSubscriber( page, 'Nilo' );
await logInToTheStore( page, customer.email, customer.password );

Expand All @@ -37,6 +37,8 @@ test.describe( 'Changing plan', () => {
await page.getByRole( 'button', { name: 'Switch subscription' } ).click();
await expect( page ).toHaveURL( /\/checkout\/order-received\/\d+\//, { timeout: 90_000 } );

const switchOrderId = Number( page.url().match( /order-received\/(\d+)\// )![ 1 ] );
expect( orderTotal( switchOrderId ) ).toBeGreaterThan( 0 );
expect( subscriptionStatus( subscriptionId ) ).toBe( 'active' );
expect( await nextcloud.account( customer.email ) ).toMatchObject( { enabled: true, quota: { quota: 800 * GIGABYTE } } );
await nextcloud.expectToLogIn( browser, customer.email, customer.password );
Expand Down
1 change: 0 additions & 1 deletion tests/E2E/support/seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
'woocommerce_email_from_name' => 'LibreSign',
'woocommerce_email_from_address' => 'noreply@example.com',
'woocommerce_subscriptions_allow_switching' => 'grouped',
'woocommerce_subscriptions_apportion_recurring_price' => 'no',
'woocommerce_subscriptions_enable_early_renewal' => 'yes',
'woocommerce_subscriptions_enable_retry' => 'no',
'woocommerce_subscriptions_multiple_purchase' => 'yes',
Expand Down
4 changes: 4 additions & 0 deletions tests/E2E/support/wordpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function orderStatus( orderId: number ): string {
return wpEval( `echo wc_get_order( ${ orderId } )->get_status();` );
}

export function orderTotal( orderId: number ): number {
return Number( wpEval( `echo wc_get_order( ${ orderId } )->get_total();` ) );
}

export function runTheScheduledNextcloudSyncRetry( orderId: number ): void {
wpEval( `
if ( ! as_next_scheduled_action( 'agm_retry_nextcloud_sync', array( 'order_id' => ${ orderId } ), 'nextcloud-admin-group-manager' ) ) {
Expand Down
Loading