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

Use string as scope #286

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions src/services/AdminApiContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@
grant_type: 'client_credentials',
client_id: options.client_id,
client_secret: options.client_secret,
scope: ['write'],
scope: 'write',
Copy link
Contributor

@pweyck pweyck Jan 24, 2025

Choose a reason for hiding this comment

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

we need to support older shopware versions (at least the LTS), so we should try both variations, if we can't detect the version (I believe that is only possible after auth)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, it should have always worked to provide plain string therefore there should be no need to switch the behaviour

},
});

const authData = (await authResponse.json()) as { access_token?: string };

Check failure on line 96 in src/services/AdminApiContext.ts

View workflow job for this annotation

GitHub Actions / test-saas

[chromium] › PageObjects/AdministrationSettings.spec.ts:3:1 › Administration page objects - Settings.

8) [chromium] › PageObjects/AdministrationSettings.spec.ts:3:1 › Administration page objects - Settings. SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at ../src/services/AdminApiContext.ts:96 94 | }); 95 | > 96 | const authData = (await authResponse.json()) as { access_token?: string }; | ^ 97 | 98 | if (!authData['access_token']) { 99 | throw new Error(`Failed to authenticate with client_id: ${options.client_id}`); at Function.authenticateWithClientCredentials (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:96:27) at Function.create (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:64:42) at Object.base.extend.AdminApiContext.scope (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/fixtures/ApiContexts.ts:16:37)

if (!authData['access_token']) {
throw new Error(`Failed to authenticate with client_id: ${options.client_id}`);
Expand All @@ -109,11 +109,11 @@
grant_type: 'password',
username: options.admin_username,
password: options.admin_password,
scope: ['write'],
scope: 'write',
},
});

const authData = (await authResponse.json()) as { access_token?: string };

Check failure on line 116 in src/services/AdminApiContext.ts

View workflow job for this annotation

GitHub Actions / test-saas

[chromium] › Fixtures.spec.ts:6:1 › All data fixtures

2) [chromium] › Fixtures.spec.ts:6:1 › All data fixtures ───────────────────────────────────────── SyntaxError: Unexpected end of JSON input at ../src/services/AdminApiContext.ts:116 114 | }); 115 | > 116 | const authData = (await authResponse.json()) as { access_token?: string }; | ^ 117 | 118 | if (!authData['access_token']) { 119 | throw new Error(`Failed to authenticate with user: ${options.admin_username}`); at Function.authenticateWithUserPassword (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:116:27) at Function.create (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:45:46) at Object.base.extend.AdminApiContext.scope (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/fixtures/ApiContexts.ts:16:37)

Check failure on line 116 in src/services/AdminApiContext.ts

View workflow job for this annotation

GitHub Actions / test-saas

[chromium] › Mailpit.spec.ts:3:1 › Verify sign-up email @Email

4) [chromium] › Mailpit.spec.ts:3:1 › Verify sign-up email @Email ──────────────────────────────── SyntaxError: Unexpected end of JSON input at ../src/services/AdminApiContext.ts:116 114 | }); 115 | > 116 | const authData = (await authResponse.json()) as { access_token?: string }; | ^ 117 | 118 | if (!authData['access_token']) { 119 | throw new Error(`Failed to authenticate with user: ${options.admin_username}`); at Function.authenticateWithUserPassword (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:116:27) at Function.create (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/services/AdminApiContext.ts:45:46) at Object.base.extend.AdminApiContext.scope (/home/runner/work/acceptance-test-suite/acceptance-test-suite/src/fixtures/ApiContexts.ts:16:37)

if (!authData['access_token']) {
throw new Error(`Failed to authenticate with user: ${options.admin_username}`);
Expand Down Expand Up @@ -150,4 +150,4 @@
async head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse> {
return this.context.head(url, options);
}
}
}
Loading