Completed
Push — master ( e2f88d...1979c4 )
by Roy
02:13
created

test.describe(ꞌCheckout flowꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
nc 1
dl 0
loc 3
rs 10
cc 1
nop 0
1
/**
2
 * External dependencies
3
 */
4
import config from 'config';
5
import chai from 'chai';
6
import chaiAsPromised from 'chai-as-promised';
7
import test from 'selenium-webdriver/testing';
8
9
/**
10
 * Internal dependencies
11
 */
12
import * as t from './lib/test-helper';
13
14
chai.use( chaiAsPromised );
15
const assert = chai.assert;
16
17
test.describe( 'Checkout flow', function() {
18
	this.timeout( config.get( 'mochaTimeoutMs' ) );
19
20
	test.before( function() {
21
		this.timeout( config.get( 'startBrowserTimeoutMs' ) );
22
	} );
23
24
	test.before( t.startBrowser );
25
26
	test.describe( 'Pay with Stripe Non 3DS Required', function() {
27
		config.get( 'stripeCC' ).forEach( stripeSetting => {
28
			test.before( () => {
29
				t.setStripeSettings( stripeSetting );
30
			} );
31
32
			test.beforeEach( t.asGuestCustomer );
33
34
			test.it( 'Credit card', function() {
35
				t.openOnePaymentProduct().addToCart();
36
				t.payWithStripe( true );
37
38
				assert.eventually.ok( t.redirectedTo( '/checkout/order-received/' ) );
39
			} );
40
		} );
41
	} );
42
43
	test.describe( 'Pay with Stripe Non 3DS Required Non Inline', function() {
44
		config.get( 'stripeCCNoInline' ).forEach( stripeSetting => {
45
			test.before( () => {
46
				t.setStripeSettings( stripeSetting );
47
			} );
48
49
			test.beforeEach( t.asGuestCustomer );
50
51
			test.it( 'Credit card', function() {
52
				t.openOnePaymentProduct().addToCart();
53
				t.payWithStripe( false );
54
55
				assert.eventually.ok( t.redirectedTo( '/checkout/order-received/' ) );
56
			} );
57
		} );
58
	} );
59
60
	test.after( t.quitBrowser );
61
} );
62