-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetpack E2E: expand the Marketing: SEO spec. #81199
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,98 @@ | ||
/** | ||
* @group calypso-pr | ||
* @group jetpack-wpcom-integration | ||
*/ | ||
|
||
import { DataHelper, SidebarComponent, MarketingPage, TestAccount } from '@automattic/calypso-e2e'; | ||
import { | ||
getTestAccountByFeature, | ||
envToFeatureKey, | ||
envVariables, | ||
DataHelper, | ||
SidebarComponent, | ||
MarketingPage, | ||
TestAccount, | ||
NoticeComponent, | ||
} from '@automattic/calypso-e2e'; | ||
import { Page, Browser } from 'playwright'; | ||
|
||
declare const browser: Browser; | ||
|
||
/** | ||
* Quick test to verify various SEO text fields and previews render. | ||
* | ||
* This is a feature exclusive to Business plans and higher. | ||
* | ||
* Keywords: Jetpack, SEO, Traffic, Marketing. | ||
*/ | ||
describe( DataHelper.createSuiteTitle( 'Marketing: SEO Preview' ), function () { | ||
let marketingPage: MarketingPage; | ||
const externalPreviewText = DataHelper.getRandomPhrase(); | ||
|
||
let page: Page; | ||
let testAccount: TestAccount; | ||
let marketingPage: MarketingPage; | ||
|
||
beforeAll( async () => { | ||
page = await browser.newPage(); | ||
|
||
const testAccount = new TestAccount( 'atomicUser' ); | ||
// Simple sites do not have the ability to change SEO parameters. | ||
const accountName = getTestAccountByFeature( envToFeatureKey( envVariables ), [ | ||
{ | ||
gutenberg: 'stable', | ||
siteType: 'simple', | ||
accountName: 'atomicUser', | ||
}, | ||
{ | ||
gutenberg: 'edge', | ||
siteType: 'simple', | ||
accountName: 'atomicUser', | ||
}, | ||
] ); | ||
testAccount = new TestAccount( accountName ); | ||
await testAccount.authenticate( page ); | ||
|
||
marketingPage = new MarketingPage( page ); | ||
} ); | ||
|
||
it( 'Navigate to Tools > Marketing page', async function () { | ||
const sidebarComponent = new SidebarComponent( page ); | ||
await sidebarComponent.navigate( 'Tools', 'Marketing' ); | ||
if ( envVariables.ATOMIC_VARIATION === 'ecomm-plan' ) { | ||
await marketingPage.visit( testAccount.getSiteURL( { protocol: false } ) ); | ||
} else { | ||
const sidebarComponent = new SidebarComponent( page ); | ||
await sidebarComponent.navigate( 'Tools', 'Marketing' ); | ||
} | ||
} ); | ||
|
||
it( 'Click on Traffic tab', async function () { | ||
marketingPage = new MarketingPage( page ); | ||
await marketingPage.clickTab( 'Traffic' ); | ||
} ); | ||
|
||
it( 'Enter SEO meta description', async function () { | ||
await marketingPage.enterWebsiteMetaInformation(); | ||
it( 'Enter and verify SEO page title front page structure', async function () { | ||
const frontPageText = DataHelper.getRandomPhrase(); | ||
await marketingPage.enterPageTitleStructure( 'Front Page', frontPageText ); | ||
|
||
await marketingPage.validatePreviewTextForPageStructureCategory( frontPageText ); | ||
} ); | ||
|
||
it( 'Enter SEO external preview description', async function () { | ||
await marketingPage.enterExternalPreviewText( externalPreviewText ); | ||
} ); | ||
|
||
it( 'Open and close SEO preview', async function () { | ||
await marketingPage.openSEOPreview(); | ||
await marketingPage.closeSEOPreview(); | ||
it( 'Open SEO preview', async function () { | ||
await marketingPage.clickButton( 'Show Previews' ); | ||
} ); | ||
|
||
it( 'Verify preview for Facebook', async function () { | ||
await marketingPage.validateExternalPreview( 'Facebook', externalPreviewText ); | ||
} ); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion (non-blocking): How do you feel about adding saving the settings into this test spec? I think it should be easily designable to handle concurrencies, because i think the previews seem to be based on local unsaved state. I figured validating that the save web request goes through okay might be nice addition! But totally not required. 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your hunch is correct, and I was able to work saving the changes into the flow. Nice suggestion! |
||
it( 'Close SEO preview', async function () { | ||
await marketingPage.clickButton( 'Close preview' ); | ||
} ); | ||
|
||
it( 'Save changes', async function () { | ||
await marketingPage.saveSettings(); | ||
|
||
const noticeComponent = new NoticeComponent( page ); | ||
await noticeComponent.noticeShown( 'Settings saved successfully!' ); | ||
} ); | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: You've done such a nice job in these PRs updating the locator syntax as you go! I really appreciate that! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.