Skip to content

Commit

Permalink
Merge branch 'feature/2567-kickoff-mc-ads-account-creation' into upda…
Browse files Browse the repository at this point in the history
…te/2596-connect-ads-account
  • Loading branch information
ankitrox committed Oct 28, 2024
2 parents 6f85011 + 8ab1be0 commit 60a101a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 1 addition & 10 deletions tests/e2e/specs/setup-mc/step-1-accounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ test.describe( 'Set up accounts', () => {
} );

test( 'should see the merchant center id and ads account id if connected', async () => {
await setUpAccountsPage.fulfillAdsAccounts( [ { id: 12345 } ] );
await setUpAccountsPage.mockAdsAccountConnected();
await setUpAccountsPage.mockMCConnected();
await setUpAccountsPage.mockMCHasAccounts();
await setUpAccountsPage.mockAdsStatusClaimed();

const googleAccountCard =
Expand Down Expand Up @@ -456,12 +452,7 @@ test.describe( 'Set up accounts', () => {
test.beforeAll( async () => {
await setUpAccountsPage.mockAdsAccountConnected();
await setUpAccountsPage.mockMCConnected();

await setUpAccountsPage.fulfillAdsAccountStatus( {
has_access: true,
invite_link: '',
step: 'link_merchant',
} );
await setUpAccountsPage.mockAdsAccountConnected();

await setUpAccountsPage.goto();
} );
Expand Down
10 changes: 9 additions & 1 deletion tests/e2e/utils/mock-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export default class MockRequests {
this.page = page;
}

/**
* Fulfill a request multiple times.
*
* @param {number} times The number of times to fulfill the request.
* @return {this} A proxied instance intercepts the subsequent fulfillRequest calls to attach the `times` option.
*/
fulfillTimes( times ) {
return new Proxy( this, {
get( target, property ) {
Expand All @@ -35,7 +41,7 @@ export default class MockRequests {
* @param {Object} payload The payload to send.
* @param {number} status The HTTP status in the response.
* @param {Array} methods The HTTP methods in the request to be fulfill.
* @param {number} times The number of times to fulfill the request.
* @param {number} [times] The number of times to fulfill the request. Optional.
* @return {Promise<void>}
*/
async fulfillRequest( url, payload, status = 200, methods = [], times ) {
Expand Down Expand Up @@ -148,6 +154,7 @@ export default class MockRequests {
* Fulfill the MC connection request.
*
* @param {Object} payload
* @return {Promise<void>}
*/
async fulfillMCConnection( payload ) {
await this.fulfillRequest( /\/wc\/gla\/mc\/connection\b/, payload );
Expand Down Expand Up @@ -207,6 +214,7 @@ export default class MockRequests {
* Fulfill the Ads Connection request.
*
* @param {Object} payload
* @return {Promise<void>}
*/
async fulfillAdsConnection( payload ) {
await this.fulfillRequest( /\/wc\/gla\/ads\/connection\b/, payload );
Expand Down

0 comments on commit 60a101a

Please sign in to comment.