Skip to content
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

chore: Move new OAuth e2e tests into 'core' directory #9307

Merged
merged 3 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
mockGetOAuthApps,
} from 'support/intercepts/profile';
import { ui } from 'support/ui';
import { randomLabel } from 'support/util/random';
import { randomLabel, randomSecret } from 'support/util/random';
import { OAuthClient } from '@linode/api-v4/types';

/**
Expand Down Expand Up @@ -104,6 +104,10 @@ const createOAuthApp = (oauthApp: OAuthClient) => {
.findByTitle('Client Secret')
.should('be.visible')
.within(() => {
cy.get('input[id="client-secret"]')
.should('be.visible')
.should('have.value', oauthApp.secret);

ui.button
.findByTitle('I Have Saved My Client Secret')
.should('be.visible')
Expand All @@ -127,9 +131,11 @@ describe('Add OAuth Apps', () => {
const oauthApps = oauthClientFactory.buildList(2);
const privateOauthApp = oauthApps[0];
privateOauthApp.label = randomLabel(5);
privateOauthApp.secret = randomSecret(64);
const publicOauthApp = oauthApps[1];
publicOauthApp.label = randomLabel(5);
publicOauthApp.public = true;
publicOauthApp.secret = randomSecret(64);

interceptGetProfile().as('getProfile');
cy.visitWithLogin('/profile/clients');
Expand All @@ -145,8 +151,7 @@ describe('Add OAuth Apps', () => {
interceptGetProfile().as('getProfile');
mockGetOAuthApps(oauthApps).as('getOAuthApps');
cy.visitWithLogin('/profile/clients');
cy.wait('@getProfile');
cy.wait('@getOAuthApps');
cy.wait(['@getProfile', '@getOAuthApps']);
cy.findByText(privateOauthApp.label)
.closest('tr')
.within(() => {
Expand Down
2 changes: 0 additions & 2 deletions packages/manager/cypress/support/api/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export const deleteAllTestOAuthApps = async (): Promise<void> => {
getOAuthClients({ page_size: pageSize, page })
);

console.log(`oauth apps: ${JSON.stringify(oauthApps)}`);

const deletionPromises = oauthApps
.filter((oauthApp: OAuthClient) => isTestLabel(oauthApp.label))
.map(async (oauthApp: OAuthClient) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/factories/accountOAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export const oauthClientFactory = Factory.Sync.makeFactory<OAuthClient>({
redirect_uri: 'http://localhost:3000/api/auth/callback/linode',
status: 'active',
thumbnail_url: null,
secret: Factory.each((id) => `1a2b3c4d5e6f0123456789abcdef${id}`),
secret: '<REDACTED>',
});