File size: 2,071 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
 * @group gutenberg
 * @group jetpack-wpcom-integration
 */
import {
	BlockFlow,
	PayWithPaypalBlockFlow,
	// OpenTableFlow,
	DonationsFormFlow,
	AdFlow,
	envVariables,
	PaywallFlow,
	// PaymentsBlockFlow,
	// envVariables,
} from '@automattic/calypso-e2e';
import { createBlockTests } from './shared/block-smoke-testing';

const blockFlows: BlockFlow[] = [
	new PayWithPaypalBlockFlow( {
		name: 'Test Paypal Block',
		price: 900,
		email: 'test@wordpress.com',
	} ),
	// Skip OpenTable block test for now, block is broken due to upstream API changes.
	// https://github.com/Automattic/jetpack/issues/39410
	// new OpenTableFlow( {
	// 	restaurant: 'Miku Restaurant - Vancouver',
	// } ),
	new DonationsFormFlow(
		{
			frequency: 'Yearly',
			currency: 'CAD',
		},
		{
			frequency: 'Yearly',
			customAmount: 50,
			predefinedAmount: 5,
		}
	),
];

// We're just skipping the Payments Button test for now due to this bug:
// https://github.com/Automattic/jetpack/issues/30785
// You can't close the inserter, and it's just messing things up!
// // Stripe is not connected to this WordPress.com account, so skipping on Atomic
// if ( ! envVariables.TEST_ON_ATOMIC ) {
// 	blockFlows.push( new PaymentsBlockFlow( { buttonText: 'Donate to Me' } ) );
// }

// The Ad block is only available on more premium plans that imply AT.
// Furthermore, private sites are not eligible to monetize due to the site
// being, well, private.
if (
	envVariables.JETPACK_TARGET === 'wpcom-deployment' &&
	envVariables.TEST_ON_ATOMIC === true &&
	envVariables.ATOMIC_VARIATION !== 'private'
) {
	blockFlows.push( new AdFlow( {} ) );
}

// Paywall also does not apply to Private sites.
if ( envVariables.ATOMIC_VARIATION !== 'private' ) {
	// Splice instead of push because the Donations block should be the last item
	// because clicking "Pay now" behavior is slightly unpredictable.
	blockFlows.splice(
		-1,
		0,
		new PaywallFlow( {
			prePaywallText: 'Pre-paywall text',
			postPaywallText: 'Post-paywall text',
		} )
	);
}

createBlockTests( 'Blocks: Jetpack Earn', blockFlows );