File size: 2,717 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
 * @group calypso-pr
 * @group gutenberg
 * @group jetpack-wpcom-integration
 */

import {
	DataHelper,
	envVariables,
	SidebarComponent,
	TestAccount,
	getTestAccountByFeature,
	envToFeatureKey,
	FullSiteEditorPage,
} from '@automattic/calypso-e2e';
import { Browser, Page } from 'playwright';

declare const browser: Browser;

/**
 * This is a temporary smoke test for FSE on WordPress.com until a more comprehensive E2E strategy
 * can be designed and implemented.
 *
 * The goal here is to catch major breaks with the integration --- i.e. Calypso navigation no long working,
 * or getting a WSOD when trying to load the editor.
 *
 *
 * Keywords: FSE, Full Site Editor, Gutenberg
 */
describe( DataHelper.createSuiteTitle( 'Site Editor Smoke Test' ), function () {
	let page: Page;
	let testAccount: TestAccount;
	let fullSiteEditorPage: FullSiteEditorPage;

	const features = envToFeatureKey( envVariables );
	const accountName = getTestAccountByFeature( { ...features, variant: 'siteEditor' }, [
		// None of our CoBlocks users use block themes, so we need to fall back to the default Gutenberg users
		// if COBLOCKS_EDGE is set.
		{
			gutenberg: 'stable',
			coblocks: 'edge',
			siteType: 'simple',
			variant: 'siteEditor',
			accountName: 'siteEditorSimpleSiteUser',
		},
		{
			gutenberg: 'edge',
			coblocks: 'edge',
			siteType: 'simple',
			variant: 'siteEditor',
			accountName: 'siteEditorSimpleSiteEdgeUser',
		},
		{
			gutenberg: 'stable',
			coblocks: 'edge',
			siteType: 'atomic',
			variant: 'siteEditor',
			accountName: 'siteEditorAtomicSiteUser',
		},
		{
			gutenberg: 'edge',
			coblocks: 'edge',
			siteType: 'atomic',
			variant: 'siteEditor',
			accountName: 'siteEditorAtomicSiteEdgeUser',
		},
	] );

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

		testAccount = new TestAccount( accountName );
		await testAccount.authenticate( page );
	} );

	it( 'Navigate to Full Site Editor', async function () {
		fullSiteEditorPage = new FullSiteEditorPage( page );

		// Explicitly doing sidebar navigation to ensure Calypso navigation is intact.
		const sidebarComponent = new SidebarComponent( page );
		await sidebarComponent.navigate( 'Appearance', 'Editor' );
	} );

	it( 'Editor endpoint loads', async function () {
		await page.waitForURL( /site-editor/ );
	} );

	it( 'Open the Page template', async function () {
		await fullSiteEditorPage.prepareForInteraction();

		await fullSiteEditorPage.ensureNavigationTopLevel();
		await fullSiteEditorPage.clickFullSiteNavigatorButton( 'Templates' );
		await fullSiteEditorPage.openTemplateEditor( 'Index' );
	} );

	it( 'Editor canvas loads', async function () {
		await fullSiteEditorPage.waitUntilLoaded();
	} );
} );