Skip to content

Commit 5bed44c

Browse files
committed
Fixing e2e tests
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parent 6de93d1 commit 5bed44c

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

site/e2e/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export const users = {
2525
password: defaultPassword,
2626
email: "owner@coder.com",
2727
},
28+
admin: {
29+
username: "admin",
30+
password: defaultPassword,
31+
email: "admin@coder.com",
32+
},
2833
templateAdmin: {
2934
username: "template-admin",
3035
password: defaultPassword,

site/e2e/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ export async function importTemplate(
12041204
// organization.
12051205
const orgPicker = page.getByLabel("Belongs to *");
12061206
const organizationsEnabled = await orgPicker.isVisible();
1207-
if (organizationsEnabled) {
1207+
if (organizationsEnabled && await orgPicker.isEnabled()) { // The org picker is disabled if there is only one org.
12081208
if (orgName !== defaultOrganizationName) {
12091209
throw new Error(
12101210
`No provisioners registered for ${orgName}, creating this template will fail`,

site/e2e/tests/presets/prebuilds.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@ import {
1111
import { beforeCoderTest } from "../../hooks";
1212

1313
test.beforeEach(async ({ page }) => {
14+
// TODO: we can improve things here by supporting using the standard web server BUT:
15+
// 1. we can't use the in-memory db because we didn't implement many dbmem functions
16+
// 2. we'd have to require terraform provisioners are setup (see requireTerraformTests)
17+
if(!test.info().config.webServer?.reuseExistingServer) {
18+
console.warn('test requires existing server with terraform provisioners');
19+
test.skip()
20+
}
21+
1422
beforeCoderTest(page);
15-
await login(page);
23+
await login(page, users.admin);
1624
});
1725

1826
const waitForBuildTimeout = 120_000; // Builds can take a while, let's give them at most 2m.
@@ -28,6 +36,8 @@ const expectedPrebuilds = 2;
2836

2937
// NOTE: requires the `workspace-prebuilds` experiment enabled!
3038
test("create template with desired prebuilds", async ({ page, baseURL }) => {
39+
test.setTimeout(300_000);
40+
3141
requiresLicense();
3242

3343
// Create new template.
@@ -124,7 +134,7 @@ test("claim prebuild matching selected preset", async ({ page, baseURL }) => {
124134
await text.waitFor({ timeout: 30_000 });
125135

126136
// Logout as unprivileged user, and login as admin.
127-
await login(page, users.owner);
137+
await login(page, users.admin);
128138

129139
// Navigate back to prebuilds page to see that a new prebuild replaced the claimed one.
130140
await page.goto(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy