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

[tests-only] [full-ci] adding step for getting bearer token with api #11368

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

S-Panta
Copy link
Contributor

@S-Panta S-Panta commented Aug 16, 2024

Description

This PR adds an implementation for getting bearer tokens using API rather than from UI via login.

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • locally and CI

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests
  • Documentation
  • Maintenance (e.g. dependency updates or tooling)

Copy link

update-docs bot commented Aug 16, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@S-Panta S-Panta self-assigned this Aug 16, 2024
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch from 3655d8b to a626370 Compare August 19, 2024 07:07
@S-Panta S-Panta changed the title [WIP] [do-not-merge] adding step for getting bearer token with api [WIP] adding step for getting bearer token with api Aug 19, 2024
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch 2 times, most recently from 89ea0ad to 06aa9e9 Compare August 19, 2024 08:23
@S-Panta S-Panta changed the title [WIP] adding step for getting bearer token with api [tests-only] [full-ci] adding step for getting bearer token with api Aug 19, 2024
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch 4 times, most recently from 90901de to 6d62fdb Compare August 22, 2024 08:58
@S-Panta S-Panta marked this pull request as ready for review August 22, 2024 09:23
tests/e2e/cucumber/environment/index.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/objects/runtime/session.ts Show resolved Hide resolved
tests/e2e/support/utils/tokenHelper.ts Outdated Show resolved Hide resolved
tests/e2e/cucumber/environment/index.ts Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch from 6d62fdb to 6d6bb6c Compare August 23, 2024 07:12
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch from 6d6bb6c to 0fc872e Compare August 26, 2024 07:20
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/api/token/utils.ts Outdated Show resolved Hide resolved
tests/e2e/support/utils/tokenHelper.ts Outdated Show resolved Hide resolved
@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch from 0fc872e to 44c8a8a Compare August 26, 2024 10:26
@S-Panta S-Panta requested a review from saw-jan August 26, 2024 10:26
@saw-jan
Copy link
Member

saw-jan commented Aug 27, 2024

You have to either remove (if possible) or skip this block of code with this PR:

if (!config.basicAuth) {
const body = await response.json()
const tokenEnvironment = TokenEnvironmentFactory(tokenType)
tokenEnvironment.setToken({
user: { ...user },
token: {
userId: user.id,
accessToken: body.access_token,
refreshToken: body.refresh_token
}
})
}
}

@S-Panta
Copy link
Contributor Author

S-Panta commented Aug 27, 2024

You have to either remove (if possible) or skip this block of code with this PR:

if (!config.basicAuth) {
const body = await response.json()
const tokenEnvironment = TokenEnvironmentFactory(tokenType)
tokenEnvironment.setToken({
user: { ...user },
token: {
userId: user.id,
accessToken: body.access_token,
refreshToken: body.refresh_token
}
})
}
}

If this line is removed, PR fails on keycloak test because the login flow still holds true for that. Currently, this fixed is directed to fix the pagination feature file. We do no login in pagination and therefore this code isn't initiated.
If I am not mistaken, this is the drone error when I tried to deleted that line https://drone.owncloud.com/owncloud/web/46616/18/13

@saw-jan
Copy link
Member

saw-jan commented Aug 27, 2024

If this line is removed, PR fails on keycloak test because the login flow still holds true for that. Currently, this fixed is directed to >fix the pagination feature file. We do no login in pagination and therefore this code isn't initiated.

yeah, that's why I gave you an option.

You have to either remove (if possible) or skip this block of code with this PR:

run this block of code only when running with keycloak

@S-Panta S-Panta force-pushed the get-bearer-token-for-e2e-test branch from 44c8a8a to 24fb783 Compare August 27, 2024 11:40
@S-Panta S-Panta requested a review from saw-jan August 27, 2024 11:40
Copy link

sonarcloud bot commented Aug 27, 2024

Copy link
Member

@saw-jan saw-jan left a comment

Choose a reason for hiding this comment

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

LGTM

@saw-jan saw-jan merged commit 90fcb21 into master Aug 27, 2024
3 checks passed
@saw-jan saw-jan deleted the get-bearer-token-for-e2e-test branch August 27, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting bearer token for e2e tests using api
3 participants