Skip to content
Draft
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/common/utils/getFullDocument.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import connector from '../../pageServices/connector';

export const getFullDocument = async () => {
export const getFullDocument = async (): Promise<string> => {
const documentResult = await connector.attachContentScript(() => JSON.stringify(document.documentElement.outerHTML));
return await documentResult[0].result;
return documentResult[0].result;
};
8 changes: 4 additions & 4 deletions src/features/filter/types/filter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ export interface Filter extends FilterType {
pageObjectId: PageObjectId;
}

export enum FilterKey {
JDIclassFilter = 'JDIclassFilter',
}

export interface FilterType {
[FilterKey.JDIclassFilter]: ClassFilterValue;
}

export type ClassFilterValue = Partial<Record<ElementClass, boolean>>;

export enum FilterKey {
JDIclassFilter = 'JDIclassFilter',
}

export interface JDIClassFilterValue {
Checked: boolean;
JDIclass: ElementClass;
Expand Down
7 changes: 3 additions & 4 deletions src/features/locators/utils/filterLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { ClassFilterValue } from '../../filter/types/filter.types';

export const filterLocatorsByClassFilter = (locators: ILocator[], filter: ClassFilterValue) => {
if (!filter) return locators;
const _locators = locators?.filter((locator) => {
const filterValue = filter;
return Object.hasOwn(filterValue, locator.type) ? get(filterValue, locator.type) : true;

return locators?.filter((locator) => {
return Object.hasOwn(filter, locator.type) ? get(filter, locator.type) : true;
});
return _locators;
};
5 changes: 4 additions & 1 deletion src/features/locators/utils/locatorsTreeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export const convertListToTree = (_list: ILocator[], searchString = '') => {
const treeParent = getParent(node.parent_id);
const origDepth = (list[map[node.parent_id]].depth || 0) + 1;
const children = treeParent.children;
children && children.push({ ...node, depth: origDepth });

if (children) {
children.push({ ...node, depth: origDepth });
}
} else {
tree.push({ ...node, searchState });
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/pageDocument/fetchPageDocument.thunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PageDocumentState } from './pageDocument.slice';

export const fetchPageDocument = createAsyncThunk('pageDocument/fetchPageDocument', async (_, { rejectWithValue }) => {
try {
const response: string = await getFullDocument();
const response = await getFullDocument();
return response;
} catch (error) {
return rejectWithValue(error.response.data);
Expand Down