Skip to content

Commit f868c75

Browse files
Mock client verification request in E2E tests
1 parent c1f1040 commit f868c75

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/manager/cypress/support/e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ chai.use(function (chai, utils) {
6464
import { blockAnalytics } from './setup/block-analytics';
6565
import { deleteInternalHeader } from './setup/delete-internal-header';
6666
import { mockFeatureFlagClientstream } from './setup/feature-flag-clientstream';
67+
import { mockLoginClientVerification } from './setup/login-client-verification';
6768
import { mockAccountRequest } from './setup/mock-account-request';
6869
import { mockFeatureFlagRequests } from './setup/mock-feature-flags-request';
6970
import { trackApiRequests } from './setup/request-tracking';
@@ -72,5 +73,6 @@ trackApiRequests();
7273
mockAccountRequest();
7374
mockFeatureFlagRequests();
7475
mockFeatureFlagClientstream();
76+
mockLoginClientVerification();
7577
deleteInternalHeader();
7678
blockAnalytics();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { makeResponse } from 'support/util/response';
2+
3+
/**
4+
* Mock responses to the login `/oauth/verify` route to prevent redirect to login.
5+
*/
6+
export const mockLoginClientVerification = () => {
7+
const LOGIN_ROOT = Cypress.env('REACT_APP_LOGIN_ROOT');
8+
beforeEach(() => {
9+
cy.intercept(
10+
`${LOGIN_ROOT}/oauth/verify?client_id=*`,
11+
makeResponse({
12+
match: true,
13+
})
14+
);
15+
});
16+
};

0 commit comments

Comments
 (0)