@intuned/browser-dev 2.2.3-test-build.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +21 -0
- package/.eslintignore +10 -0
- package/.eslintrc.js +39 -0
- package/LICENSE +43 -0
- package/dist/ai/export.d.js +5 -0
- package/dist/ai/export.d.ts +641 -0
- package/dist/ai/extractStructuredData.js +320 -0
- package/dist/ai/extractStructuredDataUsingAi.js +139 -0
- package/dist/ai/extractionHelpers/screenshotHelpers.js +56 -0
- package/dist/ai/extractionHelpers/validateSchema.js +148 -0
- package/dist/ai/index.d.ts +641 -0
- package/dist/ai/index.js +19 -0
- package/dist/ai/isPageLoaded.js +77 -0
- package/dist/ai/prompt.js +39 -0
- package/dist/ai/tests/testCheckAllTypesAreStrings.spec.js +137 -0
- package/dist/ai/tests/testExtractFromContent.spec.js +372 -0
- package/dist/ai/tests/testExtractStructuredData.spec.js +646 -0
- package/dist/ai/tests/testIsPageLoaded.spec.js +277 -0
- package/dist/ai/tools/index.js +48 -0
- package/dist/ai/types/errors.js +67 -0
- package/dist/ai/types/models.js +45 -0
- package/dist/ai/types/types.js +48 -0
- package/dist/ai/validators.js +167 -0
- package/dist/common/Logger/index.js +60 -0
- package/dist/common/Logger/types.js +5 -0
- package/dist/common/SdkError.js +50 -0
- package/dist/common/aiModelsValidations.js +32 -0
- package/dist/common/browser_scripts.js +2596 -0
- package/dist/common/ensureBrowserScripts.js +18 -0
- package/dist/common/extendedTest.js +148 -0
- package/dist/common/extractionHelpers.js +19 -0
- package/dist/common/formatZodError.js +18 -0
- package/dist/common/fuzzySearch/fuzzySearch.test.js +250 -0
- package/dist/common/fuzzySearch/levenshtein-search.js +298 -0
- package/dist/common/fuzzySearch/utils.js +23 -0
- package/dist/common/getModelProvider.js +18 -0
- package/dist/common/getSimplifiedHtml.js +122 -0
- package/dist/common/hashObject.js +32 -0
- package/dist/common/html2markdown/convertElementToMarkdown.js +469 -0
- package/dist/common/html2markdown/index.js +19 -0
- package/dist/common/jwtTokenManager.js +18 -0
- package/dist/common/loadRuntime.js +16 -0
- package/dist/common/locatorHelpers.js +41 -0
- package/dist/common/matching/collectStrings.js +32 -0
- package/dist/common/matching/levenshtein.js +40 -0
- package/dist/common/matching/matching.js +317 -0
- package/dist/common/matching/types.js +1 -0
- package/dist/common/noEmpty.js +9 -0
- package/dist/common/saveSnapshotWithExamples.js +60 -0
- package/dist/common/tests/testEnsureBrowserScript.spec.js +31 -0
- package/dist/common/xpathMapping.js +107 -0
- package/dist/helpers/clickUntilExhausted.js +85 -0
- package/dist/helpers/downloadFile.js +125 -0
- package/dist/helpers/export.d.js +5 -0
- package/dist/helpers/export.d.ts +1220 -0
- package/dist/helpers/extractMarkdown.js +35 -0
- package/dist/helpers/filterEmptyValues.js +54 -0
- package/dist/helpers/gotoUrl.js +98 -0
- package/dist/helpers/index.d.ts +1220 -0
- package/dist/helpers/index.js +128 -0
- package/dist/helpers/processDate.js +25 -0
- package/dist/helpers/resolveUrl.js +64 -0
- package/dist/helpers/sanitizeHtml.js +74 -0
- package/dist/helpers/saveFileToS3.js +50 -0
- package/dist/helpers/scrollToLoadContent.js +57 -0
- package/dist/helpers/tests/extendedTest.js +130 -0
- package/dist/helpers/tests/testClickUntilExhausted.spec.js +387 -0
- package/dist/helpers/tests/testDownloadFile.spec.js +204 -0
- package/dist/helpers/tests/testExtractMarkdown.spec.js +290 -0
- package/dist/helpers/tests/testFilterEmptyValues.spec.js +151 -0
- package/dist/helpers/tests/testGoToUrl.spec.js +37 -0
- package/dist/helpers/tests/testProcessDate.spec.js +13 -0
- package/dist/helpers/tests/testResolveUrl.spec.js +341 -0
- package/dist/helpers/tests/testSanitizeHtml.spec.js +330 -0
- package/dist/helpers/tests/testScrollToLoadContent.spec.js +163 -0
- package/dist/helpers/tests/testValidateDataUsingSchema.spec.js +342 -0
- package/dist/helpers/tests/testWithDomSettledWait.spec.js +164 -0
- package/dist/helpers/tests/testWithNetworkIdleWait.spec.js +114 -0
- package/dist/helpers/types/Attachment.js +115 -0
- package/dist/helpers/types/CustomTypeRegistry.js +48 -0
- package/dist/helpers/types/RunEnvironment.js +18 -0
- package/dist/helpers/types/ValidationError.js +17 -0
- package/dist/helpers/types/index.js +51 -0
- package/dist/helpers/uploadFileToS3.js +154 -0
- package/dist/helpers/utils/getS3Client.js +22 -0
- package/dist/helpers/utils/index.js +73 -0
- package/dist/helpers/utils/isDownload.js +10 -0
- package/dist/helpers/utils/isGenerateCodeMode.js +9 -0
- package/dist/helpers/utils/isLocator.js +9 -0
- package/dist/helpers/utils/jwtTokenManager.js +18 -0
- package/dist/helpers/validateDataUsingSchema.js +103 -0
- package/dist/helpers/waitForDomSettled.js +90 -0
- package/dist/helpers/withNetworkSettledWait.js +91 -0
- package/dist/index.d.js +16 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +16 -0
- package/dist/intunedServices/ApiGateway/aiApiGateway.js +99 -0
- package/dist/intunedServices/ApiGateway/factory.js +13 -0
- package/dist/intunedServices/ApiGateway/providers/Anthropic.js +26 -0
- package/dist/intunedServices/ApiGateway/providers/Gemini.js +29 -0
- package/dist/intunedServices/ApiGateway/providers/OpenAI.js +29 -0
- package/dist/intunedServices/ApiGateway/tests/testApiGateway.spec.js +224 -0
- package/dist/intunedServices/ApiGateway/types.js +11 -0
- package/dist/intunedServices/cache/cache.js +61 -0
- package/dist/intunedServices/cache/index.js +12 -0
- package/dist/intunedServices/cache/tests/testCache.spec.js +117 -0
- package/dist/optimized-extractors/common/buildExamplesPrompt.js +12 -0
- package/dist/optimized-extractors/common/buildImagesFromPage.js +55 -0
- package/dist/optimized-extractors/common/extractStructuredDataUsingClaude.js +135 -0
- package/dist/optimized-extractors/common/extractStructuredDataUsingGoogle.js +37 -0
- package/dist/optimized-extractors/common/extractStructuredDataUsingOpenAi.js +132 -0
- package/dist/optimized-extractors/common/extractStrucutredDataUsingAiInstance.js +122 -0
- package/dist/optimized-extractors/common/findTableHeaders.js +162 -0
- package/dist/optimized-extractors/common/index.js +55 -0
- package/dist/optimized-extractors/common/isTableHeaderOrFooter.js +84 -0
- package/dist/optimized-extractors/common/matching/matching.js +212 -0
- package/dist/optimized-extractors/common/matching/matching.test.js +655 -0
- package/dist/optimized-extractors/common/matching/types.js +18 -0
- package/dist/optimized-extractors/common/matching/utils.js +184 -0
- package/dist/optimized-extractors/common/utils.js +58 -0
- package/dist/optimized-extractors/export.d.js +5 -0
- package/dist/optimized-extractors/export.d.ts +397 -0
- package/dist/optimized-extractors/extractArray.js +120 -0
- package/dist/optimized-extractors/extractObject.js +104 -0
- package/dist/optimized-extractors/index.d.ts +397 -0
- package/dist/optimized-extractors/index.js +31 -0
- package/dist/optimized-extractors/listExtractionHelpers/__tests__/dynamicListExtractor.spec.js +312 -0
- package/dist/optimized-extractors/listExtractionHelpers/__tests__/findSetOfXpathsToCreateAnArrayExtractor.test.js +22 -0
- package/dist/optimized-extractors/listExtractionHelpers/__tests__/getContainerElement.test.js +21 -0
- package/dist/optimized-extractors/listExtractionHelpers/__tests__/partOfSameArrayXpath.test.js +42 -0
- package/dist/optimized-extractors/listExtractionHelpers/__tests__/verifyThatAllXpathsArePartOfSameArray.test.js +9 -0
- package/dist/optimized-extractors/listExtractionHelpers/dynamicListExtractor.js +152 -0
- package/dist/optimized-extractors/listExtractionHelpers/errors.js +46 -0
- package/dist/optimized-extractors/listExtractionHelpers/getListMatches.js +14 -0
- package/dist/optimized-extractors/listExtractionHelpers/runAiExtraction.js +240 -0
- package/dist/optimized-extractors/listExtractionHelpers/typesAndSchema.js +5 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/extractPropertiesUsingGPTFromArray.js +277 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/extractStructuredListUsingAi.js +44 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/getListContainerXpath.js +94 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/getRelativeContainerXpathSelector.js +20 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/getSimplifiedHtmlPerListItem.js +21 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/tablesUtils.js +48 -0
- package/dist/optimized-extractors/listExtractionHelpers/utils/validateOptions.js +52 -0
- package/dist/optimized-extractors/models/anthropicModel.js +23 -0
- package/dist/optimized-extractors/models/openaiModel.js +23 -0
- package/dist/optimized-extractors/objectExtractionHelpers/AIExtractors.js +73 -0
- package/dist/optimized-extractors/objectExtractionHelpers/__tests__/checksumUtils.test.js +103 -0
- package/dist/optimized-extractors/objectExtractionHelpers/__tests__/testObjectExtractorFromLocator.spec.js +107 -0
- package/dist/optimized-extractors/objectExtractionHelpers/__tests__/testObjectExtractorFromPage.spec.js +107 -0
- package/dist/optimized-extractors/objectExtractionHelpers/calculateObjectExampleHash.js +28 -0
- package/dist/optimized-extractors/objectExtractionHelpers/captureSnapshot.js +26 -0
- package/dist/optimized-extractors/objectExtractionHelpers/checksumUtils.js +32 -0
- package/dist/optimized-extractors/objectExtractionHelpers/constants.js +7 -0
- package/dist/optimized-extractors/objectExtractionHelpers/dynamicObjectExtractor.js +106 -0
- package/dist/optimized-extractors/objectExtractionHelpers/errors.js +42 -0
- package/dist/optimized-extractors/objectExtractionHelpers/findDomMatches.js +54 -0
- package/dist/optimized-extractors/objectExtractionHelpers/getSimplifiedHtml.js +122 -0
- package/dist/optimized-extractors/objectExtractionHelpers/typesAndSchemas.js +5 -0
- package/dist/optimized-extractors/objectExtractionHelpers/validateDynamicObjectExtractorOptions.js +52 -0
- package/dist/optimized-extractors/types/aiModelsValidation.js +45 -0
- package/dist/optimized-extractors/types/errors.js +42 -0
- package/dist/optimized-extractors/types/jsonSchema.d.js +5 -0
- package/dist/optimized-extractors/types/jsonSchema.d.ts +50 -0
- package/dist/optimized-extractors/types/types.js +5 -0
- package/dist/optimized-extractors/validators.js +152 -0
- package/dist/vite-env.d.js +1 -0
- package/dist/vite-env.d.ts +9 -0
- package/docs.md +14 -0
- package/generated-docs/ai/functions/extractStructuredData.mdx +255 -0
- package/generated-docs/ai/functions/isPageLoaded.mdx +88 -0
- package/generated-docs/ai/interfaces/ArraySchema.mdx +36 -0
- package/generated-docs/ai/interfaces/BasicSchema.mdx +14 -0
- package/generated-docs/ai/interfaces/BooleanSchema.mdx +28 -0
- package/generated-docs/ai/interfaces/ImageBufferContentItem.mdx +16 -0
- package/generated-docs/ai/interfaces/ImageUrlContentItem.mdx +16 -0
- package/generated-docs/ai/interfaces/NumberSchema.mdx +35 -0
- package/generated-docs/ai/interfaces/ObjectSchema.mdx +39 -0
- package/generated-docs/ai/interfaces/StringSchema.mdx +35 -0
- package/generated-docs/ai/interfaces/TextContentItem.mdx +14 -0
- package/generated-docs/ai/type-aliases/ContentItem.mdx +12 -0
- package/generated-docs/ai/type-aliases/JsonSchema.mdx +47 -0
- package/generated-docs/ai/type-aliases/SUPPORTED_MODELS.mdx +85 -0
- package/generated-docs/helpers/functions/downloadFile.mdx +99 -0
- package/generated-docs/helpers/functions/extractMarkdown.mdx +56 -0
- package/generated-docs/helpers/functions/filterEmptyValues.mdx +51 -0
- package/generated-docs/helpers/functions/goToUrl.mdx +124 -0
- package/generated-docs/helpers/functions/processDate.mdx +55 -0
- package/generated-docs/helpers/functions/resolveUrl.mdx +165 -0
- package/generated-docs/helpers/functions/sanitizeHtml.mdx +113 -0
- package/generated-docs/helpers/functions/saveFileToS3.mdx +127 -0
- package/generated-docs/helpers/functions/scrollToLoadContent.mdx +89 -0
- package/generated-docs/helpers/functions/uploadFileToS3.mdx +121 -0
- package/generated-docs/helpers/functions/validateDataUsingSchema.mdx +90 -0
- package/generated-docs/helpers/functions/waitForDomSettled.mdx +91 -0
- package/generated-docs/helpers/functions/withNetworkSettledWait.mdx +76 -0
- package/generated-docs/helpers/interfaces/Attachment.mdx +56 -0
- package/generated-docs/helpers/interfaces/S3Configs.mdx +52 -0
- package/generated-docs/helpers/interfaces/SanitizeHtmlOptions.mdx +22 -0
- package/generated-docs/helpers/type-aliases/AttachmentType.mdx +10 -0
- package/generated-docs/helpers/type-aliases/FileType.mdx +61 -0
- package/generated-docs/helpers/type-aliases/Trigger.mdx +62 -0
- package/how-to-run-tests.md +10 -0
- package/intuned-runtime-setup.md +13 -0
- package/package.json +119 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _extendedTest = require("../../../common/extendedTest");
|
|
4
|
+
var _utils = require("./utils");
|
|
5
|
+
var _types = require("./types");
|
|
6
|
+
async function matchStringsWithDomContent(page, data, container) {
|
|
7
|
+
const result = await page.evaluate(async ({
|
|
8
|
+
searchTexts,
|
|
9
|
+
container
|
|
10
|
+
}) => {
|
|
11
|
+
const result = await window.__INTUNED__.matchStringsWithDomContent(container ?? document.documentElement, searchTexts);
|
|
12
|
+
return result;
|
|
13
|
+
}, {
|
|
14
|
+
searchTexts: data,
|
|
15
|
+
container
|
|
16
|
+
});
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
(0, _extendedTest.describe)("Attribute Matching Tests", () => {
|
|
20
|
+
(0, _extendedTest.test)("should match a url in a e commerce website", async ({
|
|
21
|
+
context,
|
|
22
|
+
page
|
|
23
|
+
}) => {
|
|
24
|
+
const domString = `<section class="vivant-color-picker-0-x-container vivant-color-picker-0-x-container--product-summary-default vtex-product-summary-2-x-container vtex-product-summary-2-x-container--product-summary-default vivant-color-picker-0-x-containerNormal vivant-color-picker-0-x-containerNormal--product-summary-default vtex-product-summary-2-x-containerNormal vtex-product-summary-2-x-containerNormal--product-summary-default overflow-hidden br3 h-100 w-100 flex flex-column justify-between center tc" style="max-width:300px"><a href="https://www.esprit.com.co/camisa-en-tela-tipo-satin-para-mujer-419f031-cru110602/p" class="vivant-color-picker-0-x-clearLink vivant-color-picker-0-x-clearLink--product-summary-default vtex-product-summary-2-x-clearLink vtex-product-summary-2-x-clearLink--product-summary-default h-100 flex flex-column"><article class="vivant-color-picker-0-x-element vivant-color-picker-0-x-element--product-summary-default vtex-product-summary-2-x-element vtex-product-summary-2-x-element--product-summary-default pointer pt3 pb4 flex flex-column h-100"><div class="vtex-flex-layout-0-x-flexRow vtex-flex-layout-0-x-flexRow--product-image-and-quick-view"><div class="flex mt0 mb0 pt0 pb0 justify-start vtex-flex-layout-0-x-flexRowContent vtex-flex-layout-0-x-flexRowContent--product-image-and-quick-view items-stretch w-100"><div class="pr0 items-stretch flex" style="width:auto"><div class="vtex-product-summary-2-x-imageContainer vtex-product-summary-2-x-imageWrapper db w-100 center"><div class="dib relative vtex-product-summary-2-x-imageContainer vtex-product-summary-2-x-imageStackContainer"><img src="https://esprit.vtexassets.com/arquivos/ids/1502202-500-auto?v=638602845646730000&width=500&height=auto&aspect=true" loading="lazy" alt="Camisa en tela tipo satín para mujer" class="vtex-product-summary-2-x-imageNormal vtex-product-summary-2-x-image vtex-product-summary-2-x-mainImageHovered" fetchpriority="low" crossorigin="anonymous"></div></div></div><div class="pr0 items-stretch flex" style="width:auto"><div tabindex="0" role="button" class="vtex-modal-layout-0-x-triggerContainer vtex-modal-layout-0-x-triggerContainer--quickview bg-transparent pa0 bw0 dib"><div class="vtex-rich-text-0-x-container vtex-rich-text-0-x-container--quickview-trigger-text vtex-rich-text-0-x-container--plp-check-product-text flex tl items-start justify-start t-body c-on-base"><div class="vtex-rich-text-0-x-wrapper vtex-rich-text-0-x-wrapper--quickview-trigger-text vtex-rich-text-0-x-wrapper--plp-check-product-text"><p class="lh-copy vtex-rich-text-0-x-paragraph vtex-rich-text-0-x-paragraph--quickview-trigger-text vtex-rich-text-0-x-paragraph--plp-check-product-text">COMPRA RÁPIDA</p></div></div></div></div><div class="pr0 items-stretch flex" style="width:auto"><div class="esprit-esprit-store-7-x-main_flags_container"><div class="esprit-esprit-store-7-x-flag" style="background: rgb(60, 77, 176);">20% dcto</div></div></div></div></div><div class="vtex-flex-layout-0-x-flexRow vtex-flex-layout-0-x-flexRow--product-name-and-wishlist"><div class="flex mt0 mb0 pt0 pb0 justify-start vtex-flex-layout-0-x-flexRowContent vtex-flex-layout-0-x-flexRowContent--product-name-and-wishlist items-stretch w-100"><div class="pr0 items-stretch flex" style="width:auto"><div class="vtex-product-summary-2-x-nameContainer flex items-start justify-center pv6"><h3 class="vtex-product-summary-2-x-productNameContainer mv0 vtex-product-summary-2-x-nameWrapper overflow-hidden c-on-base f5"><span class="vtex-product-summary-2-x-productBrand vtex-product-summary-2-x-brandName t-body">Camisa en tela tipo satín para mujer<!-- --> </span></h3></div></div><div class="pr0 items-stretch flex" style="width:auto"><div class="vtex-wish-list-1-x-wishlistIconContainer"><button tabindex="0" class="vtex-button bw1 ba fw5 v-mid relative pa0 lh-solid br2 min-h-regular t-action bg-transparent b--transparent c-action-primary hover-b--transparent hover-bg-action-secondary hover-b--action-secondary pointer " type="button"><div class="vtex-button__label flex items-center justify-center h-100 ph6 " style="padding-top: 0.25em; padding-bottom: 0.32em;"><span class="vtex-wish-list-1-x-wishlistIcon vtex-wish-list-1-x-outline vtex-wish-list-1-x-iconSize"></span></div></button></div></div></div></div><div class="vivant-color-picker-0-x-summary-container"><div class="vivant-color-picker-0-x-variants-container vivant-color-picker-0-x-element-loading vivant-color-picker-0-x-element-loading--loaded"><div class="vivant-color-picker-0-x-variants"><button class="vivant-color-picker-0-x-image-container vivant-color-picker-0-x-image-container--is-active"><img class="vivant-color-picker-0-x-imageElement" src="https://esprit.vtexassets.com/arquivos/34_419F031_CRU110602.jpg?v=870" alt="Camisa en tela tipo satín para mujer" crossorigin="anonymous"></button></div></div></div><div class="lukshop-product-size-0-x-container_stopped_element lukshop-product-size-0-x-container_stopped_element--summary-product-sizes"><div class="lukshop-product-size-0-x-size lukshop-product-size-0-x-size--summary-product-sizes"><p class="lukshop-product-size-0-x-size_title lukshop-product-size-0-x-size_title--summary-product-sizes">Tallas disponibles</p><div class="lukshop-product-size-0-x-size_content lukshop-product-size-0-x-size_content--summary-product-sizes"><button class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_L ">L</button><button class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_M ">M</button><button class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_S ">S</button><button disabled="" class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_XL lukshop-product-size-0-x-size_button_disable lukshop-product-size-0-x-size_button_disable--summary-product-sizes ">XL</button><button class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_XS ">XS</button><button class="lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes lukshop-product-size-0-x-size_button lukshop-product-size-0-x-size_button--summary-product-sizes_XXL ">XXL</button></div></div></div><div class="vtex-flex-layout-0-x-flexRow vtex-flex-layout-0-x-flexRow--selling-and-list-price"><div class="flex mt0 mb0 pt0 pb0 justify-start vtex-flex-layout-0-x-flexRowContent vtex-flex-layout-0-x-flexRowContent--selling-and-list-price items-stretch w-100"><div class="pr0 items-stretch flex" style="width:auto"><span class="vtex-product-price-1-x-listPrice"><span class="vtex-product-price-1-x-listPriceValue strike"><span class="vtex-product-price-1-x-currencyContainer"><span class="vtex-product-price-1-x-currencyCode">$</span><span class="vtex-product-price-1-x-currencyLiteral"> </span><span class="vtex-product-price-1-x-currencyInteger">129</span><span class="vtex-product-price-1-x-currencyGroup">.</span><span class="vtex-product-price-1-x-currencyInteger">900</span><span class="vtex-product-price-1-x-currencyDecimal">,</span><span class="vtex-product-price-1-x-currencyFraction">00</span></span></span></span></div><div class="pr0 items-stretch flex" style="width:auto"><span class="vtex-product-price-1-x-sellingPrice vtex-product-price-1-x-sellingPrice--hasListPrice"><span class="vtex-product-price-1-x-sellingPriceValue"><span class="vtex-product-price-1-x-currencyContainer"><span class="vtex-product-price-1-x-currencyCode">$</span><span class="vtex-product-price-1-x-currencyLiteral"> </span><span class="vtex-product-price-1-x-currencyInteger">103</span><span class="vtex-product-price-1-x-currencyGroup">.</span><span class="vtex-product-price-1-x-currencyInteger">920</span><span class="vtex-product-price-1-x-currencyDecimal">,</span><span class="vtex-product-price-1-x-currencyFraction">00</span></span></span></span></div></div></div></article></a></section>`;
|
|
25
|
+
const data = "https://www.esprit.com.co/camisa-en-tela-tipo-satin-para-mujer-419f031-cru110602/p";
|
|
26
|
+
await page.setContent(domString);
|
|
27
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
28
|
+
const matchResults = matches[data];
|
|
29
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
30
|
+
});
|
|
31
|
+
(0, _extendedTest.test)("should match full attribute", async ({
|
|
32
|
+
page
|
|
33
|
+
}) => {
|
|
34
|
+
const data = "https://www.google.com";
|
|
35
|
+
const domString = `
|
|
36
|
+
<a href="https://www.google.com">
|
|
37
|
+
<p>Hello, world!</p>
|
|
38
|
+
</a>
|
|
39
|
+
`;
|
|
40
|
+
await page.setContent(domString);
|
|
41
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
42
|
+
const matchResults = matches[data];
|
|
43
|
+
console.log(matchResults);
|
|
44
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
45
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBe("href");
|
|
46
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("a");
|
|
47
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FULL);
|
|
48
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("https://www.google.com");
|
|
49
|
+
});
|
|
50
|
+
(0, _extendedTest.test)("should match partial attribute", async ({
|
|
51
|
+
page
|
|
52
|
+
}) => {
|
|
53
|
+
const domString = `<img alt="intuned is a startup" />`;
|
|
54
|
+
const data = "intuned";
|
|
55
|
+
await page.setContent(domString);
|
|
56
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
57
|
+
const matchResults = matches[data];
|
|
58
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(1);
|
|
59
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBe("alt");
|
|
60
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("img");
|
|
61
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.PARTIAL);
|
|
62
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intuned");
|
|
63
|
+
});
|
|
64
|
+
(0, _extendedTest.test)("should match full fuzzy attribute", async ({
|
|
65
|
+
page
|
|
66
|
+
}) => {
|
|
67
|
+
const domString = `
|
|
68
|
+
<div class="container">
|
|
69
|
+
<header>
|
|
70
|
+
<h1>Welcome to Our Website</h1>
|
|
71
|
+
<nav>
|
|
72
|
+
<ul>
|
|
73
|
+
<li><a href="#home">Home</a></li>
|
|
74
|
+
<li><a href="#about">About</a></li>
|
|
75
|
+
<li><a href="#contact">Contact</a></li>
|
|
76
|
+
</ul>
|
|
77
|
+
</nav>
|
|
78
|
+
</header>
|
|
79
|
+
<main>
|
|
80
|
+
<aside>
|
|
81
|
+
<img alt="Lorem ipsum dolor sit amet" src="example.jpg" />
|
|
82
|
+
</aside>
|
|
83
|
+
</main>
|
|
84
|
+
<footer>
|
|
85
|
+
<p>© 2023 Our Company. All rights reserved.</p>
|
|
86
|
+
</footer>
|
|
87
|
+
</div>
|
|
88
|
+
`;
|
|
89
|
+
const data = "Lorem psum dolor it amet";
|
|
90
|
+
await page.setContent(domString);
|
|
91
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
92
|
+
const matchResults = matches[data];
|
|
93
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(1);
|
|
94
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
95
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBe("alt");
|
|
96
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("img");
|
|
97
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("Lorem ipsum dolor sit amet");
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
(0, _extendedTest.describe)("Text Content Matching Tests", () => {
|
|
101
|
+
(0, _extendedTest.test)("should match full text content", async ({
|
|
102
|
+
page
|
|
103
|
+
}) => {
|
|
104
|
+
const domString = `
|
|
105
|
+
<div>
|
|
106
|
+
<p>intuned is an rpa company</p>
|
|
107
|
+
</div>
|
|
108
|
+
`;
|
|
109
|
+
const data = "intuned is an rpa company";
|
|
110
|
+
await page.setContent(domString);
|
|
111
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
112
|
+
const matchResults = matches[data];
|
|
113
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
114
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBeNull();
|
|
115
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
116
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FULL);
|
|
117
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intuned is an rpa company");
|
|
118
|
+
});
|
|
119
|
+
(0, _extendedTest.test)("should match partial text content", async ({
|
|
120
|
+
page
|
|
121
|
+
}) => {
|
|
122
|
+
const domString = `
|
|
123
|
+
<div>
|
|
124
|
+
<p>intuned is a startup</p>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
const data = "intuned is a";
|
|
128
|
+
await page.setContent(domString);
|
|
129
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
130
|
+
const matchResults = matches[data];
|
|
131
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
132
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBeNull();
|
|
133
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
134
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.PARTIAL);
|
|
135
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intuned is a");
|
|
136
|
+
});
|
|
137
|
+
(0, _extendedTest.test)("should match fuzzy full text content", async ({
|
|
138
|
+
page
|
|
139
|
+
}) => {
|
|
140
|
+
const domString = `
|
|
141
|
+
<div class="container">
|
|
142
|
+
<article>
|
|
143
|
+
<h2>Latest News</h2>
|
|
144
|
+
<p>intned</p>
|
|
145
|
+
</article>
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
const data = "intuned";
|
|
149
|
+
await page.setContent(domString);
|
|
150
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
151
|
+
const matchResults = matches[data];
|
|
152
|
+
console.log(matchResults);
|
|
153
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
154
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
155
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
156
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intned");
|
|
157
|
+
});
|
|
158
|
+
(0, _extendedTest.test)("should match fuzzy partial text content", async ({
|
|
159
|
+
page
|
|
160
|
+
}) => {
|
|
161
|
+
const domString = `
|
|
162
|
+
<div class="content-wrapper">
|
|
163
|
+
<p>intned is a startup revolutionizing the industry</p>
|
|
164
|
+
</div>
|
|
165
|
+
`;
|
|
166
|
+
const data = "intuned";
|
|
167
|
+
await page.setContent(domString);
|
|
168
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
169
|
+
const matchResults = matches[data];
|
|
170
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
171
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBeNull();
|
|
172
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
173
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
174
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intned");
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
(0, _extendedTest.describe)("Direct Text Node Matching Tests", () => {
|
|
178
|
+
(0, _extendedTest.test)("should match full direct text node", async ({
|
|
179
|
+
page
|
|
180
|
+
}) => {
|
|
181
|
+
const domString = `<p>intuned is awesome<span>rami</span></p>`;
|
|
182
|
+
const data = "intuned is awesome";
|
|
183
|
+
await page.setContent(domString);
|
|
184
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
185
|
+
const matchResults = matches[data];
|
|
186
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
187
|
+
(0, _extendedTest.expect)(matchResults[1].attribute).toBeNull();
|
|
188
|
+
(0, _extendedTest.expect)(matchResults[1].tag).toBe("p");
|
|
189
|
+
(0, _extendedTest.expect)(matchResults[1].match_mode).toBe(_types.MatchMode.PARTIAL);
|
|
190
|
+
(0, _extendedTest.expect)(matchResults[1].matched_value).toBe("intuned is awesome");
|
|
191
|
+
});
|
|
192
|
+
(0, _extendedTest.test)("should match partial direct text node", async ({
|
|
193
|
+
page
|
|
194
|
+
}) => {
|
|
195
|
+
const domString = `<p>intuned is a startup<span>rami</span></p>`;
|
|
196
|
+
const data = "intuned";
|
|
197
|
+
await page.setContent(domString);
|
|
198
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
199
|
+
const matchResults = matches[data];
|
|
200
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
201
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBeNull();
|
|
202
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
203
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.PARTIAL);
|
|
204
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intuned");
|
|
205
|
+
});
|
|
206
|
+
(0, _extendedTest.test)("should match fuzzy full direct text node", async ({
|
|
207
|
+
page
|
|
208
|
+
}) => {
|
|
209
|
+
const domString = `<p>intned<span>rami</span></p>`;
|
|
210
|
+
const data = "intuned";
|
|
211
|
+
await page.setContent(domString);
|
|
212
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
213
|
+
const matchResults = matches[data];
|
|
214
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
215
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
216
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
217
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intned");
|
|
218
|
+
});
|
|
219
|
+
(0, _extendedTest.test)("should match fuzzy partial direct text node", async ({
|
|
220
|
+
page
|
|
221
|
+
}) => {
|
|
222
|
+
const domString = `<p>intned is a startup<span>rami</span></p>`;
|
|
223
|
+
const data = "intuned";
|
|
224
|
+
await page.setContent(domString);
|
|
225
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
226
|
+
const matchResults = matches[data];
|
|
227
|
+
console.log(matchResults);
|
|
228
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
229
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
230
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
231
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intned");
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
(0, _extendedTest.describe)("Rank Matching Tests", () => {
|
|
235
|
+
(0, _extendedTest.test)("should give high rank for large matches", async ({
|
|
236
|
+
page
|
|
237
|
+
}) => {
|
|
238
|
+
const original = "This is a long string with more than twenty characters to test the ranking system for large matches.";
|
|
239
|
+
const match = "This is a long string with mre than twenty charaters to test the ranking sstem for large matches.";
|
|
240
|
+
const matchResult = {
|
|
241
|
+
fuzzyDistance: 0,
|
|
242
|
+
matchType: "direct-text",
|
|
243
|
+
matchText: match,
|
|
244
|
+
sourceText: original,
|
|
245
|
+
isFuzzy: false,
|
|
246
|
+
nodeXpath: "",
|
|
247
|
+
matchXpath: "",
|
|
248
|
+
exact: false
|
|
249
|
+
};
|
|
250
|
+
const rank = (0, _utils.rankMatch)(original, matchResult);
|
|
251
|
+
(0, _extendedTest.expect)(rank).toBe("HIGH");
|
|
252
|
+
});
|
|
253
|
+
(0, _extendedTest.test)("should give low rank for small matches with non-punctuation difference", async ({
|
|
254
|
+
page
|
|
255
|
+
}) => {
|
|
256
|
+
const original = "itunedhq";
|
|
257
|
+
const match = "intunedhq";
|
|
258
|
+
const matchResult = {
|
|
259
|
+
fuzzyDistance: 0,
|
|
260
|
+
matchType: "direct-text",
|
|
261
|
+
matchText: match,
|
|
262
|
+
sourceText: original,
|
|
263
|
+
isFuzzy: false,
|
|
264
|
+
nodeXpath: "",
|
|
265
|
+
matchXpath: "",
|
|
266
|
+
exact: false
|
|
267
|
+
};
|
|
268
|
+
const rank = (0, _utils.rankMatch)(original, matchResult);
|
|
269
|
+
(0, _extendedTest.expect)(rank).toBe("LOW");
|
|
270
|
+
});
|
|
271
|
+
(0, _extendedTest.test)("should give high rank for small matches with only punctuation difference", async ({
|
|
272
|
+
page
|
|
273
|
+
}) => {
|
|
274
|
+
const original = "22-11-2022";
|
|
275
|
+
const match = "22/11/2022";
|
|
276
|
+
const matchResult = {
|
|
277
|
+
fuzzyDistance: 0,
|
|
278
|
+
matchType: "direct-text",
|
|
279
|
+
matchText: match,
|
|
280
|
+
sourceText: original,
|
|
281
|
+
isFuzzy: false,
|
|
282
|
+
nodeXpath: "",
|
|
283
|
+
matchXpath: "",
|
|
284
|
+
exact: false
|
|
285
|
+
};
|
|
286
|
+
const rank = (0, _utils.rankMatch)(original, matchResult);
|
|
287
|
+
(0, _extendedTest.expect)(rank).toBe("HIGH");
|
|
288
|
+
});
|
|
289
|
+
(0, _extendedTest.test)("should give low rank for small matches with differences", async ({
|
|
290
|
+
page
|
|
291
|
+
}) => {
|
|
292
|
+
const original = "2/11/2024";
|
|
293
|
+
const match = "22/11/2024";
|
|
294
|
+
const matchResult = {
|
|
295
|
+
fuzzyDistance: 0,
|
|
296
|
+
matchType: "direct-text",
|
|
297
|
+
matchText: match,
|
|
298
|
+
sourceText: original,
|
|
299
|
+
isFuzzy: false,
|
|
300
|
+
nodeXpath: "",
|
|
301
|
+
matchXpath: "",
|
|
302
|
+
exact: false
|
|
303
|
+
};
|
|
304
|
+
const rank = (0, _utils.rankMatch)(original, matchResult);
|
|
305
|
+
(0, _extendedTest.expect)(rank).toBe("LOW");
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
(0, _extendedTest.describe)("Fuzzy Matching Tests", () => {
|
|
309
|
+
(0, _extendedTest.test)("should match fuzzy strings", async ({
|
|
310
|
+
page
|
|
311
|
+
}) => {
|
|
312
|
+
const domString = `
|
|
313
|
+
<div class="container">
|
|
314
|
+
<article>
|
|
315
|
+
<h2>Latest News</h2>
|
|
316
|
+
<p>This is an even longer super long string that is intended to replace the previous content. It serves as a comprehensive placeholder for testing purposes and is designed to be significantly longer than the original text. This extended string will help ensure that the matching functionality can effectively handle various lengths of input, including those that are much more substantial than typical cases. The goal is to thoroughly test the robustness and performance of the matching algorithm under different scenarios, particularly when faced with lengthy and complex strings that may be encountered in real-world applications.</p>
|
|
317
|
+
</article>
|
|
318
|
+
</div>
|
|
319
|
+
`;
|
|
320
|
+
const data = "This is an even longer super lon is intended to replace the previous conent. It serves as a comprehsive placeholder for testing purposes and is designed to be significantly longer than the original text. This extended string will help ensure that the matching functionality can effectively handle various lengths of input, including those that are much more substantial than typical cases. The goal is to thoroughly test the robustness and performance of the matching algorithm under different scenarios, particularly when faced with lengthy and complex strings that may be encountered in real-world applications.";
|
|
321
|
+
await page.setContent(domString);
|
|
322
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
323
|
+
const matchResults = matches[data];
|
|
324
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
325
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
326
|
+
console.log(matchResults[0]);
|
|
327
|
+
});
|
|
328
|
+
(0, _extendedTest.test)("should not match non-fuzzy strings", async ({
|
|
329
|
+
page
|
|
330
|
+
}) => {
|
|
331
|
+
const domString = `<li> – Asynchronous Module Definition, used with module loaders like RequireJS</li>`;
|
|
332
|
+
const data = "with module loades like RequireJS";
|
|
333
|
+
await page.setContent(domString);
|
|
334
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
335
|
+
const matchResults = matches[data];
|
|
336
|
+
console.log(matchResults);
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
(0, _extendedTest.describe)("Case and Punctuation Matching Tests", () => {
|
|
340
|
+
(0, _extendedTest.test)("should match HTML casing and punctuation", async ({
|
|
341
|
+
page
|
|
342
|
+
}) => {
|
|
343
|
+
const domString = `
|
|
344
|
+
<div>
|
|
345
|
+
<p>Hello, World! This is a Test.</p>
|
|
346
|
+
<span>Another EXAMPLE; with Punctuation;</span>
|
|
347
|
+
</div>
|
|
348
|
+
`;
|
|
349
|
+
const data = ["hello world this is a test", "another example with punctuation"];
|
|
350
|
+
await page.setContent(domString);
|
|
351
|
+
const matches = await matchStringsWithDomContent(page, data);
|
|
352
|
+
(0, _extendedTest.expect)(matches[data[0]]).toHaveLength(2);
|
|
353
|
+
(0, _extendedTest.expect)(matches[data[0]][0].matched_value).toBe("Hello, World! This is a Test");
|
|
354
|
+
(0, _extendedTest.expect)(matches[data[0]][0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
355
|
+
(0, _extendedTest.expect)(matches[data[1]]).toHaveLength(2);
|
|
356
|
+
(0, _extendedTest.expect)(matches[data[1]][0].matched_value).toBe("Another EXAMPLE; with Punctuation");
|
|
357
|
+
(0, _extendedTest.expect)(matches[data[1]][0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
358
|
+
const matchedValues = [matches[data[0]][0].matched_value, matches[data[1]][0].matched_value];
|
|
359
|
+
const matches2 = await matchStringsWithDomContent(page, matchedValues, await page.locator("p").elementHandle());
|
|
360
|
+
(0, _extendedTest.expect)(matches2[matchedValues[0]].every(i => i.fuzzy_distance === null)).toBeTruthy();
|
|
361
|
+
(0, _extendedTest.expect)(matches2[matchedValues[1]].every(i => i.fuzzy_distance === null)).toBeTruthy();
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
(0, _extendedTest.describe)("Hallucination Protection Tests", () => {
|
|
365
|
+
(0, _extendedTest.test)("multi line match given container", async ({
|
|
366
|
+
page
|
|
367
|
+
}) => {
|
|
368
|
+
const domString = `
|
|
369
|
+
<div class="col-xs-6">
|
|
370
|
+
<fieldset id="fsFirmInformation">
|
|
371
|
+
<legend class="collapsable" onclick="ToggleFieldSet(this);" data-toggle="tooltip" title="Click here to show or hide this section.">
|
|
372
|
+
Firm Information
|
|
373
|
+
<img src="/Images/collapse.png" class="collapsable">
|
|
374
|
+
</legend>
|
|
375
|
+
<div id="divName" class="row">
|
|
376
|
+
<div class="col-xs-4">
|
|
377
|
+
<label>Firm Name:</label>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="col-xs-7">
|
|
380
|
+
Evan Rocks Transportation LLC
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
<div id="divDba" class="row">
|
|
384
|
+
<div class="col-xs-4">
|
|
385
|
+
<label>DBA Name:</label>
|
|
386
|
+
</div>
|
|
387
|
+
<div class="col-xs-7">
|
|
388
|
+
Evan Rocks Transportation LLC
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
<div class="row">
|
|
392
|
+
<div class="col-xs-4">
|
|
393
|
+
<label>Firm Website:</label>
|
|
394
|
+
</div>
|
|
395
|
+
<div class="col-xs-7">
|
|
396
|
+
<div id="divNormalUrl">
|
|
397
|
+
None
|
|
398
|
+
</div>
|
|
399
|
+
<div id="divSafeUrl" hidden="hidden" style="display: none;">
|
|
400
|
+
<a onclick="DisplayGoToFirmWebsite();">None</a>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="row">
|
|
405
|
+
<div class="col-xs-4">
|
|
406
|
+
<label>Firm Address:</label>
|
|
407
|
+
</div>
|
|
408
|
+
<div class="col-xs-7">
|
|
409
|
+
4679 E Calle Glen
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
<div class="row keepWithPrev bump">
|
|
413
|
+
<div class="col-xs-7 col-xs-offset-4">
|
|
414
|
+
Kingman , Arizona 86409
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
<div class="row">
|
|
418
|
+
<div class="col-xs-4">
|
|
419
|
+
<label>Firm County Location:</label>
|
|
420
|
+
</div>
|
|
421
|
+
<div class="col-xs-7">
|
|
422
|
+
Mohave
|
|
423
|
+
</div>
|
|
424
|
+
</div>
|
|
425
|
+
<div class="row keepWithPrev bump">
|
|
426
|
+
<div class="col-xs-4">
|
|
427
|
+
<label>Firm Work Territory:</label>
|
|
428
|
+
</div>
|
|
429
|
+
<div class="col-xs-7">
|
|
430
|
+
<a href="/Location/MapLocationById/19127" type="submit" id="runReport" target="_blank">
|
|
431
|
+
View Map
|
|
432
|
+
</a>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
|
|
436
|
+
<div class="row">
|
|
437
|
+
<div class="col-xs-4">
|
|
438
|
+
<label>Primary Contact:</label>
|
|
439
|
+
</div>
|
|
440
|
+
<div class="col-xs-7">
|
|
441
|
+
Rebecca Mayhood
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
<div class="row keepWithPrev">
|
|
445
|
+
<div class="col-xs-4">
|
|
446
|
+
<label>Firm Phone:</label>
|
|
447
|
+
</div>
|
|
448
|
+
<div class="col-xs-7">
|
|
449
|
+
530-414-0369
|
|
450
|
+
</div>
|
|
451
|
+
</div>
|
|
452
|
+
|
|
453
|
+
<div class="row keepWithPrev bump">
|
|
454
|
+
<div class="col-xs-4">
|
|
455
|
+
<label>Firm Email:</label>
|
|
456
|
+
</div>
|
|
457
|
+
<div class="col-xs-7">
|
|
458
|
+
evanrockstransllc@gmail.com
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
<div class="row">
|
|
462
|
+
<div class="col-xs-4">
|
|
463
|
+
<label>Secondary Contact:</label>
|
|
464
|
+
</div>
|
|
465
|
+
<div class="col-xs-7">
|
|
466
|
+
Elmo Norman
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
<div class="row keepWithPrev">
|
|
470
|
+
<div class="col-xs-4">
|
|
471
|
+
<label>Secondary Phone:</label>
|
|
472
|
+
</div>
|
|
473
|
+
<div class="col-xs-7">
|
|
474
|
+
530-386-4744
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
<div class="row keepWithPrev">
|
|
479
|
+
<div class="col-xs-4">
|
|
480
|
+
<label>Secondary Email:</label>
|
|
481
|
+
</div>
|
|
482
|
+
<div class="col-xs-7">
|
|
483
|
+
elmo_0398@yahoo.com
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
</fieldset>
|
|
488
|
+
</div>
|
|
489
|
+
`;
|
|
490
|
+
const data = "4679 E Calle Glen, Kingman, Arizona 86409";
|
|
491
|
+
await page.setContent(domString);
|
|
492
|
+
const matches = await matchStringsWithDomContent(page, [data], await page.locator("#fsFirmInformation").elementHandle());
|
|
493
|
+
(0, _extendedTest.expect)(matches[data]).toHaveLength(1);
|
|
494
|
+
const matchedValue = matches[data][0].matched_value;
|
|
495
|
+
const matches2 = await matchStringsWithDomContent(page, [matchedValue], await page.locator("#fsFirmInformation").elementHandle());
|
|
496
|
+
(0, _extendedTest.expect)(matches2[matchedValue].every(i => i.fuzzy_distance === null)).toBeTruthy();
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
(0, _extendedTest.describe)("Encoded & Matching Tests", () => {
|
|
500
|
+
(0, _extendedTest.test)("should match encoded &", async ({
|
|
501
|
+
page
|
|
502
|
+
}) => {
|
|
503
|
+
const domString = `
|
|
504
|
+
<div>
|
|
505
|
+
<p>intuned &/p; cosine</p>
|
|
506
|
+
</div>
|
|
507
|
+
`;
|
|
508
|
+
const data = "intuned & cosine";
|
|
509
|
+
await page.setContent(domString);
|
|
510
|
+
const matches = await matchStringsWithDomContent(page, [data]);
|
|
511
|
+
const matchResults = matches[data];
|
|
512
|
+
(0, _extendedTest.expect)(matchResults).toHaveLength(2);
|
|
513
|
+
(0, _extendedTest.expect)(matchResults[0].attribute).toBeNull();
|
|
514
|
+
(0, _extendedTest.expect)(matchResults[0].tag).toBe("p");
|
|
515
|
+
(0, _extendedTest.expect)(matchResults[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
516
|
+
(0, _extendedTest.expect)(matchResults[0].matched_value).toBe("intuned &/p; cosine");
|
|
517
|
+
}, {
|
|
518
|
+
headless: false
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
(0, _extendedTest.describe)("test attributes fuzzy matching", () => {
|
|
522
|
+
(0, _extendedTest.test)("should be able to match attributes fuzzy", async ({
|
|
523
|
+
page
|
|
524
|
+
}) => {
|
|
525
|
+
const domString = `
|
|
526
|
+
<div class="col-xs-6">
|
|
527
|
+
<fieldset id="fsFirmInformation">
|
|
528
|
+
<legend class="collapsable" onclick="ToggleFieldSet(this);" data-toggle="tooltip" title="Click here to show or hide this section.">
|
|
529
|
+
Firm Information
|
|
530
|
+
<img src="/Images/collapse.png" class="collapsable">
|
|
531
|
+
</legend>
|
|
532
|
+
<div id="divName" class="row">
|
|
533
|
+
<div class="col-xs-4">
|
|
534
|
+
<label>Firm Name:</label>
|
|
535
|
+
</div>
|
|
536
|
+
<div class="col-xs-7">
|
|
537
|
+
Evan Rocks Transportation LLC
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
<div id="divDba" class="row">
|
|
541
|
+
<div class="col-xs-4">
|
|
542
|
+
<label>DBA Name:</label>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="col-xs-7">
|
|
545
|
+
Evan Rocks Transportation LLC
|
|
546
|
+
</div>
|
|
547
|
+
</div>
|
|
548
|
+
<div class="row">
|
|
549
|
+
<div class="col-xs-4">
|
|
550
|
+
<label>Firm Website:</label>
|
|
551
|
+
</div>
|
|
552
|
+
<div class="col-xs-7">
|
|
553
|
+
<div id="divNormalUrl">
|
|
554
|
+
None
|
|
555
|
+
</div>
|
|
556
|
+
<div id="divSafeUrl" hidden="hidden" style="display: none;">
|
|
557
|
+
<a onclick="DisplayGoToFirmWebsite();">None</a>
|
|
558
|
+
</div>
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
<div class="row">
|
|
562
|
+
<div class="col-xs-4">
|
|
563
|
+
<label>Firm Address:</label>
|
|
564
|
+
</div>
|
|
565
|
+
<div class="col-xs-7">
|
|
566
|
+
4679 E Calle Glen
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
<div class="row keepWithPrev bump">
|
|
570
|
+
<div class="col-xs-7 col-xs-offset-4">
|
|
571
|
+
Kingman , Arizona 86409
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
<div class="row">
|
|
575
|
+
<div class="col-xs-4">
|
|
576
|
+
<label>Firm County Location:</label>
|
|
577
|
+
</div>
|
|
578
|
+
<div class="col-xs-7">
|
|
579
|
+
Mohave
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
<div class="row keepWithPrev bump">
|
|
583
|
+
<div class="col-xs-4">
|
|
584
|
+
<label>Firm Work Territory:</label>
|
|
585
|
+
</div>
|
|
586
|
+
<div class="col-xs-7">
|
|
587
|
+
<a href="/Location/MapLocationById/19127" type="submit" id="runReport" target="_blank">
|
|
588
|
+
View Map
|
|
589
|
+
</a>
|
|
590
|
+
</div>
|
|
591
|
+
</div>
|
|
592
|
+
|
|
593
|
+
<div class="row" myAttr="my name is rami theeb">
|
|
594
|
+
<div class="col-xs-4">
|
|
595
|
+
<label>Primary Contact:</label>
|
|
596
|
+
</div>
|
|
597
|
+
<div class="col-xs-7">
|
|
598
|
+
Rebecca Mayhood
|
|
599
|
+
</div>
|
|
600
|
+
</div>
|
|
601
|
+
<div class="row keepWithPrev">
|
|
602
|
+
<div class="col-xs-4">
|
|
603
|
+
<label>Firm Phone:</label>
|
|
604
|
+
</div>
|
|
605
|
+
<div class="col-xs-7">
|
|
606
|
+
530-414-0369
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
|
|
610
|
+
<div class="row keepWithPrev bump">
|
|
611
|
+
<div class="col-xs-4">
|
|
612
|
+
<label>Firm Email:</label>
|
|
613
|
+
</div>
|
|
614
|
+
<div class="col-xs-7">
|
|
615
|
+
evanrockstransllc@gmail.com
|
|
616
|
+
</div>
|
|
617
|
+
</div>
|
|
618
|
+
<div class="row">
|
|
619
|
+
<div class="col-xs-4">
|
|
620
|
+
<label>Secondary Contact:</label>
|
|
621
|
+
</div>
|
|
622
|
+
<div class="col-xs-7">
|
|
623
|
+
Elmo Norman
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
<div class="row keepWithPrev">
|
|
627
|
+
<div class="col-xs-4">
|
|
628
|
+
<label>Secondary Phone:</label>
|
|
629
|
+
</div>
|
|
630
|
+
<div class="col-xs-7">
|
|
631
|
+
530-386-4744
|
|
632
|
+
</div>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<div class="row keepWithPrev">
|
|
636
|
+
<div class="col-xs-4">
|
|
637
|
+
<label>Secondary Email:</label>
|
|
638
|
+
</div>
|
|
639
|
+
<div class="col-xs-7">
|
|
640
|
+
elmo_0398@yahoo.com
|
|
641
|
+
</div>
|
|
642
|
+
</div>
|
|
643
|
+
|
|
644
|
+
</fieldset>
|
|
645
|
+
</div>
|
|
646
|
+
`;
|
|
647
|
+
const data = "my name is rmi theeb";
|
|
648
|
+
await page.setContent(domString);
|
|
649
|
+
const matches = await matchStringsWithDomContent(page, [data, "Firm Website"], await page.locator("#fsFirmInformation").elementHandle());
|
|
650
|
+
const dateMatches = matches[data];
|
|
651
|
+
(0, _extendedTest.expect)(dateMatches).toHaveLength(1);
|
|
652
|
+
(0, _extendedTest.expect)(dateMatches[0].matched_value).toBe("my name is rami theeb");
|
|
653
|
+
(0, _extendedTest.expect)(dateMatches[0].match_mode).toBe(_types.MatchMode.FUZZY);
|
|
654
|
+
});
|
|
655
|
+
});
|