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

Issue 1375: rework generation flow #1390

Merged
merged 16 commits into from
Jul 20, 2023
Merged

Issue 1375: rework generation flow #1390

merged 16 commits into from
Jul 20, 2023

Conversation

MariiaNebesnova
Copy link
Contributor

No description provided.

@@ -14,7 +14,7 @@ export const checkSession = async (setStateCallback: (val: boolean) => void) =>
});
};

export const getSessionId = async () => {
export const initLocatorSocketController = async (xpathConfig: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest also type xpathConfig: MainState["xpathConfig"] like in src/features/locators/utils/locatorGenerationController.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thank you!


export const getLocator = (locatorValue: LocatorValue, locatorType: LocatorType = LocatorType.xPath) => {
if (locatorType !== LocatorType.cssSelector) return locatorValue.xPath;
return locatorValue.cssSelector;
return locatorValue.cssSelector || CALCULATING;
Copy link
Member

@arslanbekova arslanbekova Jul 19, 2023

Choose a reason for hiding this comment

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

Can we have a situation when xPath also will be calculating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we can't. CALCULATING is shown when Css is undefined. xPath can't be undefined, at least it will be fullXpath value


export const runCssSelectorGeneration = async (locators: Locator[]) => {
sendMessage.generateSelectorGroupByHash({ elements: locators, fireCallbackMessage: true });
return Promise.resolve("started");
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest use LocatorsGenerationStatus enum here like in src/features/locators/utils/runXpathGeneration.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. done

@@ -57,7 +57,9 @@ export const changeLocatorElement = createAsyncThunk(
jdnHash: foundHash,
locator: {
...(isCSSLocator ? { cssSelector: locator, xPath: fullXpath } : { xPath: locator, cssSelector }),
taskStatus: LocatorTaskStatus.SUCCESS,
...(isCSSLocator
Copy link
Member

Choose a reason for hiding this comment

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

I think we can avoid this redundant checking and just add cssSelectorStatus or xPathStatus property with the others on line 59

@MariiaNebesnova MariiaNebesnova merged commit 258c47c into master Jul 20, 2023
2 checks passed
@MariiaNebesnova MariiaNebesnova deleted the issue_1375 branch July 20, 2023 10:13
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.

4 participants