Skip to content

Commit 0833b06

Browse files
committed
Fixed failing e2e tests
1 parent 47de4f8 commit 0833b06

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/base-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export abstract class AblyBaseCommand extends InteractiveBaseCommand {
472472
// Make sure we have authentication after potentially modifying options
473473
if (!clientOptions.key && !clientOptions.token) {
474474
this.fail(
475-
"Authentication required. Please provide either an API key, a token, or log in first.",
475+
'Authentication required. Please provide either an API key, a token, or log in first. Run "ably accounts login" to configure authentication.',
476476
flags,
477477
"auth",
478478
);

src/spaces-base-command.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ export abstract class SpacesBaseCommand extends AblyBaseCommand {
186186
// First create an Ably client
187187
this.realtimeClient = await this.createAblyRealtimeClient(flags);
188188
if (!this.realtimeClient) {
189-
this.fail("Failed to create Ably client", flags, "client");
189+
this.fail(
190+
'Failed to create Ably client. Run "ably accounts login" to configure authentication, or set the ABLY_API_KEY environment variable.',
191+
flags,
192+
"client",
193+
);
190194
}
191195

192196
// Create a Spaces client using the Ably client
@@ -235,7 +239,11 @@ export abstract class SpacesBaseCommand extends AblyBaseCommand {
235239
this.logCliEvent(flags, "connection", "failed", errorMsg, {
236240
state: connection.state,
237241
});
238-
this.fail(errorMsg, flags, "connection");
242+
this.fail(
243+
`${errorMsg}. Use --verbose to see detailed connection logs.`,
244+
flags,
245+
"connection",
246+
);
239247
}
240248

241249
await new Promise<void>((resolve, reject) => {

test/e2e/auth/auth-keys-e2e.test.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ describe.skipIf(SHOULD_SKIP_CONTROL_E2E)("Auth Keys E2E Tests", () => {
100100
const createdKey = createRecord.key as Record<string, unknown>;
101101
const keyFullName = createdKey.keyName as string;
102102

103-
// Now get that key by its name
103+
// Now get that key by its name (appId is embedded in keyFullName)
104104
const getResult = await runCommand(
105-
["auth", "keys", "get", keyFullName, "--app", testAppId, "--json"],
105+
["auth", "keys", "get", keyFullName, "--json"],
106106
{
107107
env: { ABLY_ACCESS_TOKEN: E2E_ACCESS_TOKEN || "" },
108108
},
@@ -139,18 +139,9 @@ describe.skipIf(SHOULD_SKIP_CONTROL_E2E)("Auth Keys E2E Tests", () => {
139139

140140
// Update the key name
141141
const updatedName = `updated-key-${Date.now()}`;
142+
// appId is embedded in keyFullName, no --app needed
142143
const updateResult = await runCommand(
143-
[
144-
"auth",
145-
"keys",
146-
"update",
147-
keyFullName,
148-
"--app",
149-
testAppId,
150-
"--name",
151-
updatedName,
152-
"--json",
153-
],
144+
["auth", "keys", "update", keyFullName, "--name", updatedName, "--json"],
154145
{
155146
env: { ABLY_ACCESS_TOKEN: E2E_ACCESS_TOKEN || "" },
156147
},

0 commit comments

Comments
 (0)