Skip to content

Conversation

@irinakartun
Copy link
Contributor

Description:

implemented regression tests for toolset oauth

Checklist:

  • the pull request name complies with Conventional Commits
  • the pull request name starts with fix(<scope>):, feat(<scope>):, feature(<scope>):, chore(<scope>):, hotfix(<scope>): or e2e(<scope>):. If contains breaking changes then the pull request name must start with fix(<scope>)!:, feat(<scope>)!:, feature(<scope>)!:, chore(<scope>)!:, hotfix(<scope>)!: or e2e(<scope>)!: where <scope> is name of affected project: chat, chat-e2e, overlay, shared, sandbox-overlay, etc.
  • the pull request name ends with (Issue #<TICKET_ID>) (comma-separated list of issues)
  • I confirm that do not share any confidential information like API keys or any other secrets and private URLs

@irinakartun irinakartun requested a review from nartovm as a code owner December 5, 2025 13:16
@irinakartun
Copy link
Contributor Author

irinakartun commented Dec 5, 2025

/deploy-review

GitHub actions run: 19964147621

Stage Status
deploy-review Success ✅
e2e-test / chat Success ✅
e2e-test / overlay Success ✅


export class ToolsetApiHelper extends BaseApiHelper {
public async createToolset(toolsetModel: Toolset) {
const url = `${API.toolsetCreateHost()}/${this.userBucket ?? BucketUtil.getBucket()}/${toolsetModel.display_name}${ItemUtil.entityIdSeparator}${toolsetModel.display_version}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider breaking it into multiple lines, it is hard to read. I also do the same way, but probably we need to stop.

Recommendation: Consider breaking it into multiple lines
const bucket = this.userBucket ?? BucketUtil.getBucket();
const entityPath = `${toolsetModel.display_name}${ItemUtil.entityIdSeparator}${toolsetModel.display_version}`;
const url = `${API.toolsetCreateHost()}/${bucket}/${entityPath}`;
`

export class OAuthMockHelper {
private page: Page;
private readonly initialToolset: Toolset;
private initialToolset: Toolset;
Copy link
Contributor

Choose a reason for hiding this comment

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

The name initialToolset suggests immutability, but it's now mutable

Rename to currentToolset or toolset

}

public async setupToolsetRoutes(): Promise<void> {
public async setupUpdatedToolsetRoutes(
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens to previously merged changes if this is called multiple times?

We need a jsdoc here, smth like: (AI generated)

/**
 * Updates the toolset routes with partial toolset properties.
 * Merges the provided properties with the current toolset state.
 * Note: Subsequent calls will merge with the already-modified toolset.
 * @param updatedToolsetProps - Partial toolset properties to merge
 */


public async setupSignOutRoute(): Promise<void> {
const signOutUrl = `**${API.api}/ops/${ServerSlugs.TOOLSET_SIGN_OUT}`;
// Intercept OAuth redirect
Copy link
Contributor

Choose a reason for hiding this comment

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

But it's intercepting sign-out, isn't it?


export enum OAuthOptions {
WithLogin = 'With login',
WithConfig = 'With login & config',
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename WithConfig to the WithLoginAndConfig

Add try-catch or validation?

// Intercept OAuth redirect
await this.page.route(signOutUrl, async (route, request) => {
this.state.isSignedIn = false;
this.state.signOutRequest = request.postDataJSON();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could throw unhandled exception

await this.waitForExpectedResponses(
() => this.navigateToUrl(entityEditorAttributes.entityEditorPath),
expectedResponses,
private async openEditEntityPage(
Copy link
Contributor

Choose a reason for hiding this comment

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

openEditToolsetPage() is public, but openEditEntityPage() is private

why? Looks like it was an intention, but I have to ask

AddToolsetSettingsFormSelector.authDetailsContainer,
);
public oAuthOptions = this.authDetailsContainer
.getChildElementBySelector(Tags.label)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a data-qa locator to the React element?

await oauthMockHelper.cleanup();
});

async function verifySuccessfulLogin() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Extract to shared helper or assertion method

.filter({ has: this.page.getByRole('radio') });
public oAuthOption = (loginOption: OAuthOptions) =>
this.oAuthOptions.locator(`[${Attributes.id}="${loginOption}"]`);
public signInButton = this.authDetailsContainer.getChildElementBySelector(
Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, probably we need to rename all the sign in selectors to "log in"? Because the button title is "Log in"
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants