diff --git a/manifest.json b/manifest.json index ccf4c7c7..ddcb4a1b 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "JDN", "description": "JDN – helps Test Automation Engineer to create Page Objects in the test automation framework and speed up test development", "devtools_page": "index.html", - "version": "3.13.542", + "version": "3.13.543", "icons": { "128": "icon128.png" }, diff --git a/package.json b/package.json index 5fdf30d3..082ecef8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdn-ai-chrome-extension", - "version": "3.13.542", + "version": "3.13.543", "description": "jdn-ai chrome extension", "scripts": { "start": "webpack --watch --env devenv", diff --git a/src/app/store/store.ts b/src/app/store/store.ts index f42d9bb2..1425caee 100644 --- a/src/app/store/store.ts +++ b/src/app/store/store.ts @@ -10,7 +10,7 @@ import { logger } from "./middlewares/logger"; import { scriptNotifier } from "../../pageServices/scriptNotifier"; import { changePageMiddleware } from "./middlewares/changePage.middleware"; import { updateSocketMessageHandler } from "../../services/webSocketMessageHandler"; -import { onSetActive } from "../../features/locators/reducers/onSetActive.middleware"; +import { shouldRunGeneration } from "../../features/locators/reducers/shouldRunGeneration.middleware"; import { quitThrottlerMiddleware } from "../../common/utils/throttler"; const rootReducer = { @@ -34,7 +34,14 @@ export const store = configureStore({ "main/setScriptMessage", ], }, - }).concat([logger, scriptNotifier, cancellableActions, changePageMiddleware, onSetActive, quitThrottlerMiddleware]), + }).concat([ + logger, + scriptNotifier, + cancellableActions, + changePageMiddleware, + shouldRunGeneration, + quitThrottlerMiddleware, + ]), }); store.subscribe(() => updateMessageHandler(store.dispatch, store.getState())); diff --git a/src/features/locators/reducers/onSetActive.middleware.ts b/src/features/locators/reducers/shouldRunGeneration.middleware.ts similarity index 62% rename from src/features/locators/reducers/onSetActive.middleware.ts rename to src/features/locators/reducers/shouldRunGeneration.middleware.ts index 227361a9..3620f73f 100644 --- a/src/features/locators/reducers/onSetActive.middleware.ts +++ b/src/features/locators/reducers/shouldRunGeneration.middleware.ts @@ -1,10 +1,12 @@ import { Middleware } from "@reduxjs/toolkit"; -import { Locator } from "../types/locator.types"; +import { ElementId, Locator } from "../types/locator.types"; import { runLocatorsGeneration } from "./runLocatorsGeneration.thunk"; import { getNoLocatorsElements, hasAllLocators } from "../utils/utils"; +import { selectLocatorById } from "../selectors/locators.selectors"; -export const onSetActive: Middleware = (store) => (next) => (action) => { +export const shouldRunGeneration: Middleware = (store) => (next) => (action) => { const { type, payload } = action; + const state = store.getState(); switch (type) { case "locators/elementGroupSetActive": { @@ -20,14 +22,19 @@ export const onSetActive: Middleware = (store) => (next) => (action) => { } break; } + case "locators/toggleElementGeneration": case "locators/setActiveSingle": case "locators/elementSetActive": { - const noLocators = !hasAllLocators(payload); + const _locator = + typeof payload === "string" ? selectLocatorById(state, payload as ElementId) : (payload as Locator); + if (!_locator) break; + + const noLocators = !hasAllLocators(_locator); if (noLocators) { store.dispatch( // @ts-ignore runLocatorsGeneration({ - locators: [payload as Locator], + locators: [_locator as Locator], generateMissingLocator: true, }) ); diff --git a/src/features/onboarding/OnboardingProvider.tsx b/src/features/onboarding/OnboardingProvider.tsx index 50d83454..3cfa288e 100644 --- a/src/features/onboarding/OnboardingProvider.tsx +++ b/src/features/onboarding/OnboardingProvider.tsx @@ -75,6 +75,9 @@ export const OnboardingProvider: FC = ({ children }) => { onClickPrev?: (...args: any) => void ) => { setStepRefs((prevRefs) => { + /* case for skippeed step, see `locatorPageSteps` at useOnBoardingRef.ts */ + if (!prevRefs[name]) return prevRefs; + const { target: currentTarget, onClickNext: currentNext, onClickPrev: currentPrev } = prevRefs[name]; return { ...prevRefs,