Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Skip domains tests if domain registration is unavailable #1373

Merged
merged 10 commits into from
Aug 1, 2018
11 changes: 11 additions & 0 deletions lib/components/domain-registration-unavailable-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @format */

import { By } from 'selenium-webdriver';

import AsyncBaseContainer from '../async-base-container';

export default class RegistrationUnavailableComponent extends AsyncBaseContainer {
constructor( driver ) {
super( driver, By.css( '.empty-content' ) );
}
}
37 changes: 34 additions & 3 deletions specs/wp-manage-domains-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ReaderPage from '../lib/pages/reader-page.js';
import StatsPage from '../lib/pages/stats-page.js';

import FindADomainComponent from '../lib/components/find-a-domain-component.js';
import RegistrationUnavailableComponent from '../lib/components/domain-registration-unavailable-component';
import SecurePaymentComponent from '../lib/components/secure-payment-component.js';
import ShoppingCartWidgetComponent from '../lib/components/shopping-cart-widget-component.js';
import SidebarComponent from '../lib/components/sidebar-component.js';
Expand Down Expand Up @@ -72,7 +73,17 @@ describe( `[${ host }] Managing Domains: (${ screenSize }) @parallel`, function(
} );

step( 'Can see the domain search component', async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
return await findADomainComponent.waitForResults();
} );

Expand Down Expand Up @@ -139,7 +150,17 @@ describe( `[${ host }] Managing Domains: (${ screenSize }) @parallel`, function(
} );

step( 'Can see the domain search component', async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
return await findADomainComponent.waitForResults();
} );

Expand Down Expand Up @@ -216,7 +237,17 @@ describe( `[${ host }] Managing Domains: (${ screenSize }) @parallel`, function(
} );

step( 'Can see the domain search component', async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
return await findADomainComponent.waitForResults();
} );

Expand Down
97 changes: 89 additions & 8 deletions specs/wp-signup-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import NoSitesComponent from '../lib/components/no-sites-component';
import * as SlackNotifier from '../lib/slack-notifier';

import EmailClient from '../lib/email-client.js';
import RegistrationUnavailableComponent from '../lib/components/domain-registration-unavailable-component';

const mochaTimeOut = config.get( 'mochaTimeoutMS' );
const startBrowserTimeoutMS = config.get( 'startBrowserTimeoutMS' );
Expand Down Expand Up @@ -93,7 +94,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page, and Can search for a blog name, can see and select a free .wordpress address in the results',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to check for unavailability as this uses a free wordpress.com address which doesn't depend on the domains service

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I'll add checking only for paid domains and remove these.

try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedBlogAddresses,
Expand Down Expand Up @@ -242,7 +253,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
} );

step( 'Can then see the domains page ', async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
let displayed = await findADomainComponent.displayed();
await eyesHelper.eyesScreenshot( driver, eyes, 'Domains Page' );
return assert.strictEqual( displayed, true, 'The choose a domain page is not displayed' );
Expand Down Expand Up @@ -438,7 +459,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page and can search for a blog name, can see and select a free WordPress.com blog address in results',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedBlogAddresses,
Expand Down Expand Up @@ -603,7 +634,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page and can search for a blog name, can see and select a free WordPress.com blog address in results',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedBlogAddresses,
Expand Down Expand Up @@ -975,7 +1016,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page, and can search for a blog name, can see and select a paid .live address in results ',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( expectedDomainName );
return await findADomainComponent.selectDomainAddress( expectedDomainName );
}
Expand Down Expand Up @@ -1127,7 +1178,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
'Can then see the domains page, and Can search for a blog name, can see and select a free .wordpress address in the results',
async function() {
const expectedBlogAddresses = dataHelper.getExpectedFreeAddresses( blogName );
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedBlogAddresses,
Expand Down Expand Up @@ -1238,7 +1299,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page and can search for a blog name, can see and select a free WordPress.com blog address in results',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedBlogAddresses,
Expand Down Expand Up @@ -1367,7 +1438,17 @@ describe( `[${ host }] Sign Up (${ screenSize }, ${ locale })`, function() {
step(
'Can then see the domains page, and Can search for a blog name, can see and select a free .art.blog address in the results',
async function() {
const findADomainComponent = await FindADomainComponent.Expect( driver );
let findADomainComponent;
try {
findADomainComponent = await FindADomainComponent.Expect( driver );
} catch ( err ) {
if ( await RegistrationUnavailableComponent.Expect( driver ) ) {
await SlackNotifier.warn( 'SKIPPING: Domain registration is currently unavailable. ', {
suppressDuplicateMessages: true,
} );
return this.skip();
}
}
await findADomainComponent.searchForBlogNameAndWaitForResults( blogName );
await findADomainComponent.checkAndRetryForFreeBlogAddresses(
expectedDomainName,
Expand Down