Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test(site): add e2e tests for experiments#12940

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 20 commits intomainfrom12508-experiments
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
20 commits
Select commitHold shift + click to select a range
d903728
test(site): add e2e tests for experiments
mtojekApr 11, 2024
088fb74
actually not an enterprise test
mtojekApr 11, 2024
22bed46
Config changes
mtojekApr 11, 2024
90a40e0
Merge branch 'main' into 12508-experiments
mtojekApr 11, 2024
b05c0f5
focus
mtojekApr 11, 2024
f95b64d
fmt
mtojekApr 11, 2024
005b543
scrollIntoViewIfNeeded
mtojekApr 11, 2024
cdd9f30
network
mtojekApr 11, 2024
599d22d
Try
mtojekApr 11, 2024
b8c4b65
Try
mtojekApr 11, 2024
48bf58d
Next try
mtojekApr 11, 2024
7a032f1
WIP
mtojekApr 11, 2024
d644d99
WIP
mtojekApr 11, 2024
dc42233
viewport
mtojekApr 11, 2024
aaf80fc
Merge branch 'main' into 12508-experiments
mtojekApr 11, 2024
d15f10d
WIP
mtojekApr 11, 2024
d5a8a91
fmt
mtojekApr 11, 2024
0e3dd73
Merge branch 'main' into 12508-experiments
mtojekApr 11, 2024
be19aa2
Merge branch 'main' into 12508-experiments
mtojekApr 12, 2024
f9aa07b
More timeout?
mtojekApr 12, 2024
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
4 changes: 4 additions & 0 deletionssite/e2e/constants.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,3 +37,7 @@ export const requireEnterpriseTests = Boolean(
process.env.CODER_E2E_REQUIRE_ENTERPRISE_TESTS,
);
export const enterpriseLicense = process.env.CODER_E2E_ENTERPRISE_LICENSE ?? "";

// Fake experiments to verify that site presents them as enabled.
export const e2eFakeExperiment1 = "e2e-fake-experiment-1";
export const e2eFakeExperiment2 = "e2e-fake-experiment-2";
14 changes: 12 additions & 2 deletionssite/e2e/playwright.config.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
import { defineConfig } from "@playwright/test";
import * as path from "path";
import { coderMain, coderPort, coderdPProfPort, gitAuth } from "./constants";
import {
coderMain,
coderPort,
coderdPProfPort,
e2eFakeExperiment1,
e2eFakeExperiment2,
gitAuth,
} from "./constants";

export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;

Expand All@@ -22,7 +29,7 @@ export default defineConfig({
testMatch: /.*\.spec\.ts/,
dependencies: ["testsSetup"],
use: { storageState },
timeout:20_000,
timeout:50_000,
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Otherwise:

2024-04-12T07:59:03.3989632Z ==> Errors2024-04-12T07:59:03.3990075Z �[31mTest timeout of 20000ms exceeded.�[39m2024-04-12T07:59:03.3991129Z /home/runner/actions-runner/_work/coder/coder/site/e2e/helpers.ts:357:2024-04-12T07:59:03.3992071Z    at helpers.ts:3572024-04-12T07:59:03.3992271Z 2024-04-12T07:59:03.3992405Z   355 |   });2024-04-12T07:59:03.3992661Z   356 |2024-04-12T07:59:03.3993276Z > 357 |   await page.getByTestId("agent-status-ready").waitFor({ state: "visible" });2024-04-12T07:59:03.3993951Z       |                                                ^2024-04-12T07:59:03.3994334Z   358 |   return cp;2024-04-12T07:59:03.3994667Z   359 | };2024-04-12T07:59:03.3994999Z   360 |2024-04-12T07:59:03.3995440Z Error: locator.waitFor: Test timeout of 20000ms exceeded.2024-04-12T07:59:03.3995871Z Call log:2024-04-12T07:59:03.3996400Z   �[2m- waiting for getByTestId('agent-status-ready') to be visible�[22m

link

},
],
reporter: [["./reporter.ts"]],
Expand DownExpand Up@@ -60,6 +67,8 @@ export default defineConfig({
.join(" "),
env: {
...process.env,
// Otherwise, the runner fails on Mac with: could not determine kind of name for C.uuid_string_t
CGO_ENABLED: "0",

// This is the test provider for git auth with devices!
CODER_GITAUTH_0_ID: gitAuth.deviceProvider,
Expand DownExpand Up@@ -101,6 +110,7 @@ export default defineConfig({
gitAuth.validatePath,
),
CODER_PPROF_ADDRESS: "127.0.0.1:" + coderdPProfPort,
CODER_EXPERIMENTS: e2eFakeExperiment1 + "," + e2eFakeExperiment2,
},
reuseExistingServer: false,
},
Expand Down
39 changes: 39 additions & 0 deletionssite/e2e/tests/deployment/general.spec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
import { expect, test } from "@playwright/test";
import * as API from "api/api";
import { setupApiCalls } from "../../api";
import { e2eFakeExperiment1, e2eFakeExperiment2 } from "../../constants";

test("experiments", async ({ page }) => {
await setupApiCalls(page);

// Load experiments from backend API
const availableExperiments = await API.getAvailableExperiments();

// Verify if the site lists the same experiments
await page.goto("/deployment/general", { waitUntil: "networkidle" });

const experimentsLocator = page.locator(
"div.options-table tr.option-experiments ul.option-array",
);
await expect(experimentsLocator).toBeVisible();

// Firstly, check if all enabled experiments are listed
expect(
experimentsLocator.locator(
`li.option-array-item-${e2eFakeExperiment1}.option-enabled`,
),
).toBeVisible;
expect(
experimentsLocator.locator(
`li.option-array-item-${e2eFakeExperiment2}.option-enabled`,
),
).toBeVisible;

// Secondly, check if available experiments are listed
for (const experiment of availableExperiments.safe) {
const experimentLocator = experimentsLocator.locator(
`li.option-array-item-${experiment}`,
);
await expect(experimentLocator).toBeVisible();
}
});
5 changes: 4 additions & 1 deletionsite/src/pages/DeploySettingsPage/Option.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@ export const OptionValue: FC<OptionValueProps> = (props) => {

if (typeof value === "object" && !Array.isArray(value)) {
return (
<ul css={{ listStyle: "none" }}>
<ul css={{ listStyle: "none" }} className="option-array">
{Object.entries(value)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([option, isEnabled]) => (
Expand All@@ -64,6 +64,9 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
color: theme.palette.text.disabled,
},
]}
className={`option-array-item-${option} ${
isEnabled ? "option-enabled" : "option-disabled"
}`}
>
<div
css={{
Expand Down
4 changes: 2 additions & 2 deletionssite/src/pages/DeploySettingsPage/OptionsTable.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ const OptionsTable: FC<OptionsTableProps> = ({ options, additionalValues }) => {
}

return (
<TableContainer>
<TableContainer className="options-table">
<Table
css={css`
& td {
Expand DownExpand Up@@ -57,7 +57,7 @@ const OptionsTable: FC<OptionsTableProps> = ({ options, additionalValues }) => {
return null;
}
return (
<TableRow key={option.flag}>
<TableRow key={option.flag} className={"option-" + option.flag}>
<TableCell>
<OptionName>{option.name}</OptionName>
<OptionDescription>{option.description}</OptionDescription>
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp