forked from Automattic/wp-calypso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetpack E2E: add Social Connection spec using Tumblr. (Automattic#81073)
* packages/calypso-e2e/src/secrets/types.ts packages/calypso-e2e/src/secrets/secrets-manager.ts packages/calypso-e2e/src/secrets/encrypted.enc - update secrets with new social connections category packages/calypso-e2e/src/lib/pages/marketing-page.ts - add methods to handle social connections packages/calypso-e2e/src/types/rest-api-client.types.ts - new methods to get and delete publicize connections test/e2e/specs/tools/social-connections__tumblr.ts - add new spec to connect and disconnect social connection * packages/calypso-e2e/src/lib/pages/marketing-page.ts - change return signature of validateSocialConnected method. * test/e2e/specs/tools/social-connections__tumblr.ts - replace Object.forEach with for...of loops * test/e2e/specs/tools/social-connections__tumblr.ts - replace sidebar navigation with direct visits to the page. packages/calypso-e2e/src/lib/pages/marketing-page.ts - add a `waitForLoadState` wait for the popup. * packages/calypso-e2e/src/rest-api-client.ts - add JSDoc * test/e2e/specs/tools/social-connections__tumblr.ts - add exception for private sites
- Loading branch information
1 parent
675ef33
commit 8fed7df
Showing
7 changed files
with
256 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* @group jetpack-wpcom-integration | ||
*/ | ||
|
||
import { | ||
envToFeatureKey, | ||
getTestAccountByFeature, | ||
envVariables, | ||
DataHelper, | ||
MarketingPage, | ||
RestAPIClient, | ||
TestAccount, | ||
SecretsManager, | ||
} from '@automattic/calypso-e2e'; | ||
import { Page, Browser } from 'playwright'; | ||
import { skipDescribeIf } from '../../jest-helpers'; | ||
|
||
declare const browser: Browser; | ||
|
||
/** | ||
* Sets up a Tumblr social connection for the site. | ||
* | ||
* Note, Private sites do not support Social/Publicize connections. | ||
* | ||
* Keywords: Social Connections, Marketing, Jetpack, Tumblr, Publicize | ||
*/ | ||
skipDescribeIf( envVariables.ATOMIC_VARIATION === 'private' )( | ||
DataHelper.createSuiteTitle( 'Social Connections: Set up Tumblr' ), | ||
function () { | ||
let page: Page; | ||
let popup: Page; | ||
|
||
let testAccount: TestAccount; | ||
let restAPIClient: RestAPIClient; | ||
let marketingPage: MarketingPage; | ||
|
||
beforeAll( async () => { | ||
page = await browser.newPage(); | ||
|
||
const features = envToFeatureKey( envVariables ); | ||
const accountName = getTestAccountByFeature( features ); | ||
testAccount = new TestAccount( accountName ); | ||
await testAccount.authenticate( page ); | ||
|
||
restAPIClient = new RestAPIClient( testAccount.credentials ); | ||
|
||
// Check whether a Tumblr connection exists. | ||
const connections = await restAPIClient.getAllPublicizeConnections( | ||
testAccount.credentials.testSites?.primary.id as number | ||
); | ||
|
||
// If it does, remove the connection. | ||
for ( const connection of connections ) { | ||
if ( connection.label === 'Tumblr' ) { | ||
console.info( | ||
`Removing existing connection for Tumblr for accountName ${ accountName }.` | ||
); | ||
await restAPIClient.deletePublicizeConnection( connection.site_ID, connection.ID ); | ||
} | ||
} | ||
|
||
marketingPage = new MarketingPage( page ); | ||
} ); | ||
|
||
it( 'Navigate to Tools > Marketing page', async function () { | ||
await marketingPage.visit( testAccount.getSiteURL( { protocol: false } ) ); | ||
} ); | ||
|
||
it( 'Click on Connections tab', async function () { | ||
await marketingPage.clickTab( 'Connections' ); | ||
} ); | ||
|
||
it( 'Click on the "Connect" button for Tumblr', async function () { | ||
popup = await marketingPage.clickSocialConnectButton( 'Tumblr' ); | ||
} ); | ||
|
||
it( 'Set up Tumblr', async function () { | ||
await marketingPage.setupTumblr( popup, SecretsManager.secrets.socialAccounts.tumblr ); | ||
} ); | ||
|
||
it( 'Tumblr is connected', async function () { | ||
await marketingPage.validateSocialConnected( 'Tumblr' ); | ||
} ); | ||
} | ||
); |