Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 55e8406

Browse files
committed
Remove PLG related code from e2e tests
1 parent dced3c1 commit 55e8406

5 files changed

Lines changed: 4 additions & 78 deletions

File tree

vscode/e2e/features/auth.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ test.describe('Auth', () => {
1616
const [sidebar] = await uix.cody.WebView.all({ page }, { atLeast: 1 })
1717
// Open the sign in form
1818
await expect(sidebar.content.getByText('Sign in to Sourcegraph')).toBeVisible()
19-
await sidebar.content.getByRole('button', { name: 'Sourcegraph logo Continue' }).click()
2019
// Instance URL
2120
await sidebar.content.getByText('Sourcegraph Instance URL').click()
2221
await sidebar.content.getByPlaceholder('Example: https://instance.').click()

vscode/test/e2e/auth.test.ts

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import { expect } from '@playwright/test'
22
import { SERVER_URL, VALID_TOKEN, VALID_TOKEN_PERSON2 } from '../fixtures/mock-server'
33
import { expectSignInPage, sidebarSignin } from './common'
4-
import {
5-
type ClientConfigSingletonRefetchIntervalOverride,
6-
type DotcomUrlOverride,
7-
type EnterpriseTestOptions,
8-
type ExpectedV2Events,
9-
signOut,
10-
test,
11-
} from './helpers'
4+
import { type DotcomUrlOverride, type ExpectedV2Events, signOut, test } from './helpers'
125

136
test.extend<ExpectedV2Events>({
147
// list of V2 telemetry events we expect this test to log, add to this list as needed
@@ -24,7 +17,6 @@ test.extend<ExpectedV2Events>({
2417
],
2518
})('requires a valid auth token and allows logouts', async ({ page, sidebar }) => {
2619
await expect(sidebar!.getByText('Sign in to Sourcegraph')).toBeVisible()
27-
await sidebar!.getByRole('button', { name: 'Sourcegraph logo Continue' }).click()
2820
await sidebar!.getByText('Sourcegraph Instance URL').click()
2921
await sidebar!.getByPlaceholder('Example: https://instance.').click()
3022
await sidebar!.getByPlaceholder('Example: https://instance.').fill(SERVER_URL)
@@ -57,9 +49,6 @@ test
5749
.extend<DotcomUrlOverride>({
5850
dotcomUrl: SERVER_URL,
5951
})
60-
.extend<EnterpriseTestOptions>({
61-
shouldUseEnterprise: true,
62-
})
6352
.extend<ExpectedV2Events>({
6453
// list of V2 telemetry events we expect this test to log, add to this list as needed
6554
expectedV2Events: [
@@ -81,41 +70,6 @@ test
8170
).toBeVisible()
8271
})
8372

84-
const refetchInterval = 500
85-
test
86-
.extend<DotcomUrlOverride>({
87-
dotcomUrl: SERVER_URL,
88-
})
89-
.extend<ClientConfigSingletonRefetchIntervalOverride>({
90-
clientConfigSingletonRefetchInterval: refetchInterval,
91-
})
92-
.extend<ExpectedV2Events>({
93-
// list of V2 telemetry events we expect this test to log, add to this list as needed
94-
expectedV2Events: [
95-
'cody.extension:installed',
96-
'cody.auth.login:clicked',
97-
'cody.auth.login.token:clicked',
98-
'cody.auth:disconnected',
99-
'cody.signInNotification:shown',
100-
],
101-
})(
102-
'logs out the user when userShouldUseEnterprise is set to true',
103-
async ({ page, sidebar, server }) => {
104-
await sidebarSignin(page, sidebar, { skipAssertions: true })
105-
await server.setUserShouldUseEnterprise(true)
106-
await expectSignInPage(page)
107-
await expect(
108-
page
109-
.frameLocator('iframe')
110-
.first()
111-
.frameLocator('iframe[title="Chat"]')
112-
.getByText('Based on your email address')
113-
).toBeVisible({
114-
timeout: refetchInterval * 10,
115-
})
116-
}
117-
)
118-
11973
// TODO: Fix flaky test
12074
test.extend<ExpectedV2Events>({
12175
expectedV2Events: [
@@ -131,7 +85,6 @@ test.extend<ExpectedV2Events>({
13185
})
13286
.skip('switch account via account dropwdown menu in webview', async ({ page, sidebar }) => {
13387
await expect(sidebar!.getByText('Sign in to Sourcegraph')).toBeVisible()
134-
await sidebar!.getByRole('button', { name: 'Sourcegraph logo Continue' }).click()
13588
await sidebar!.getByText('Sourcegraph Instance URL').click()
13689
await sidebar!.getByPlaceholder('Example: https://instance.').click()
13790
await sidebar!.getByPlaceholder('Example: https://instance.').fill(SERVER_URL)

vscode/test/e2e/common.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export const sidebarSignin = async (
1919
}
2020
await focusSidebar(page)
2121

22-
await sidebar.getByRole('button', { name: 'Sourcegraph logo Continue' }).click()
23-
2422
await sidebar.getByText('Sourcegraph Instance URL').click()
2523
await sidebar.getByPlaceholder('Example: https://instance.').click()
2624
await sidebar.getByPlaceholder('Example: https://instance.').fill(SERVER_URL)

vscode/test/e2e/helpers.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ interface WorkspaceSettings {
4444
[key: string]: string | boolean | number
4545
}
4646

47-
export type EnterpriseTestOptions = {
48-
shouldUseEnterprise: boolean
49-
}
50-
5147
// Playwright test extension: Extra VSCode settings to write to
5248
// .vscode/settings.json.
5349
export interface ExtraWorkspaceSettings {
@@ -123,9 +119,6 @@ export const test = base
123119
.extend<ClientConfigSingletonRefetchIntervalOverride>({
124120
clientConfigSingletonRefetchInterval: undefined,
125121
})
126-
.extend<EnterpriseTestOptions>({
127-
shouldUseEnterprise: [false, { option: true }],
128-
})
129122
.extend<TestConfiguration>({
130123
preAuthenticate: false,
131124
})
@@ -161,11 +154,9 @@ export const test = base
161154
})
162155
.extend<{ server: MockServer }>({
163156
server: [
164-
async ({ shouldUseEnterprise }, use) => {
157+
// biome-ignore lint/correctness/noEmptyPattern: Playwright ascribes meaning to the empty pattern: No dependencies.
158+
async ({}, use) => {
165159
MockServer.run(async server => {
166-
if (shouldUseEnterprise !== undefined) {
167-
server.setUserShouldUseEnterprise(shouldUseEnterprise)
168-
}
169160
await use(server)
170161
})
171162
},

vscode/test/fixtures/mock-server.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ class GraphQlMock {
176176
export class MockServer {
177177
graphQlMocks: Map<string, GraphQlMock> = new Map();
178178
availableLLMs: ServerModelConfiguration | undefined = getServerSentModelsMock();
179-
userShouldUseEnterprise: boolean = false;
180179
featureFlags: Map<string, boolean> = new Map([]);
181180

182181
constructor(public readonly express: express.Express) {}
@@ -190,10 +189,6 @@ export class MockServer {
190189
return mock;
191190
}
192191

193-
public setUserShouldUseEnterprise(value: boolean) {
194-
this.userShouldUseEnterprise = value;
195-
}
196-
197192
public setAvailableLLMs(config: ServerModelConfiguration) {
198193
this.availableLLMs = config;
199194
}
@@ -262,17 +257,12 @@ export class MockServer {
262257

263258
/** Whether to simulate that rate limits have been hit */
264259
let chatRateLimited = false;
265-
/** Whether the user is Pro (true), Free (false) or not a dotCom user (undefined) */
266-
let chatRateLimitPro: boolean | undefined;
267260
app.post("/.api/completions/stream", (req, res) => {
268261
const apiVersion = Number.parseInt(req?.query?.["api-version"] as string ?? '1', 10)
269262
if (chatRateLimited) {
270263
res.set({
271264
"retry-after": new Date().toString(),
272265
"x-ratelimit-limit": "12345",
273-
...(chatRateLimitPro !== undefined && {
274-
"x-is-cody-pro-user": `${chatRateLimitPro}`,
275-
}),
276266
});
277267
res.sendStatus(429);
278268
return;
@@ -342,22 +332,18 @@ export class MockServer {
342332

343333
app.post("/.test/completions/triggerRateLimit", (req, res) => {
344334
chatRateLimited = true;
345-
chatRateLimitPro = undefined;
346335
res.sendStatus(200);
347336
});
348337
app.post("/.test/completions/triggerRateLimit/free", (req, res) => {
349338
chatRateLimited = true;
350-
chatRateLimitPro = false;
351339
res.sendStatus(200);
352340
});
353341
app.post("/.test/completions/triggerRateLimit/pro", (req, res) => {
354342
chatRateLimited = true;
355-
chatRateLimitPro = true;
356343
res.sendStatus(200);
357344
});
358345
app.post("/.test/completions/triggerRateLimit/enterprise", (req, res) => {
359346
chatRateLimited = true;
360-
chatRateLimitPro = undefined;
361347
res.sendStatus(200);
362348
});
363349
app.post("/.api/completions/code", (req, res) => {
@@ -415,8 +401,7 @@ export class MockServer {
415401
attributionEnabled: attribution !== 'none',
416402
attribution,
417403
// When server-sent LLMs have been set, we enable the models api
418-
modelsAPIEnabled: !!controller.availableLLMs,
419-
userShouldUseEnterprise: controller.userShouldUseEnterprise,
404+
modelsAPIEnabled: !!controller.availableLLMs
420405
}),
421406
);
422407
});

0 commit comments

Comments
 (0)