File size: 1,526 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
/**
 * @group calypso-pr
 * @group jetpack-wpcom-integration
 */

import {
	DataHelper,
	EditorPage,
	envToFeatureKey,
	envVariables,
	getTestAccountByFeature,
	TestAccount,
} from '@automattic/calypso-e2e';
import { Browser, Page } from 'playwright';
import { skipDescribeIf } from '../../jest-helpers';

declare const browser: Browser;

const isPrivateSite = envVariables.TEST_ON_ATOMIC && envVariables.ATOMIC_VARIATION === 'private';
/**
 * Tests features offered by Jetpack Social.
 *
 * Keywords: Social, Jetpack, Publicize
 */
skipDescribeIf( isPrivateSite )(
	DataHelper.createSuiteTitle( 'Social: Editor Smoke test' ),
	function () {
		let page: Page;
		let editorPage: EditorPage;

		let siteSlug: string;

		beforeAll( async () => {
			page = await browser.newPage();
			editorPage = new EditorPage( page );

			const accountName = getTestAccountByFeature( envToFeatureKey( envVariables ) );
			const testAccount = new TestAccount( accountName );
			siteSlug = testAccount.getSiteURL( { protocol: false } );
			await testAccount.authenticate( page );
		} );

		it( 'Verify that Social UI is visible', async function () {
			await editorPage.visit( 'post', { siteSlug } );

			// Open the Jetpack sidebar.
			await editorPage.openSettings( 'Jetpack' );

			// Expand the Publicize panel.
			await editorPage.expandSection( 'Share this post' );

			const editorParent = await editorPage.getEditorParent();

			const toggle = editorParent.getByLabel( 'Share when publishing' );

			await toggle.waitFor();
		} );
	}
);