From a82b2b9d2d09b0f10d2ca13a653c50477009c757 Mon Sep 17 00:00:00 2001 From: Valery Yatsynovich Date: Mon, 15 Jul 2024 14:18:53 +0300 Subject: [PATCH] Bump jsoup from `38b4d372d4` to `f97e0b9bfa` (#5211) --- vividus-plugin-html/build.gradle | 2 +- .../steps/integration/ResourceCheckSteps.java | 15 +-------------- .../integration/ResourceCheckStepsTests.java | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/vividus-plugin-html/build.gradle b/vividus-plugin-html/build.gradle index 4ad752c6cf..b637765557 100644 --- a/vividus-plugin-html/build.gradle +++ b/vividus-plugin-html/build.gradle @@ -1,7 +1,7 @@ project.description = 'VIVIDUS plugin for HTML testing' dependencies { - api(group: 'com.github.vividus-framework', name: 'jsoup', version: '38b4d372d4') + api(group: 'com.github.vividus-framework', name: 'jsoup', version: 'f97e0b9bfa') implementation project(':vividus-engine') implementation project(':vividus-soft-assert') diff --git a/vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/ResourceCheckSteps.java b/vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/ResourceCheckSteps.java index 0f78b7965a..b903d2bca5 100644 --- a/vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/ResourceCheckSteps.java +++ b/vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/ResourceCheckSteps.java @@ -38,7 +38,6 @@ import org.jbehave.core.model.ExamplesTable; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; -import org.jsoup.select.Selector.SelectorParseException; import org.vividus.html.HtmlLocatorType; import org.vividus.html.JsoupUtils; import org.vividus.http.HttpMethod; @@ -163,7 +162,7 @@ private Optional parseElement(Element element, boolea return Optional.empty(); } - String elementCssSelector = getCssSelector(element); + String elementCssSelector = element.cssSelector(); if (elementUriAsString.isEmpty()) { return Optional.of(ResourceValidationError.EMPTY_HREF_SRC @@ -247,18 +246,6 @@ private static String getElementUri(Element element) return element.attr("src"); } - private String getCssSelector(Element element) - { - try - { - return element.cssSelector(); - } - catch (SelectorParseException exception) - { - return String.format("Unable to build CSS selector for '%s' element", element.tagName()); - } - } - private URI resolveUri(String uri) throws URISyntaxException { URI uriToCheck = new URI(uri); diff --git a/vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/steps/integration/ResourceCheckStepsTests.java b/vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/steps/integration/ResourceCheckStepsTests.java index 95a5d0f38c..164d11e810 100644 --- a/vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/steps/integration/ResourceCheckStepsTests.java +++ b/vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/steps/integration/ResourceCheckStepsTests.java @@ -237,7 +237,7 @@ void shouldCheckDesiredResourcesAndPostAttachment() throws InterruptedException, validate(resourceValidations, imageUri, "#image", CheckStatus.PASSED, N_A); validate(resourceValidations, EXTERNAL_SECTION_LINK, EXTERNAL_SECTION_LINK_SELECTOR, CheckStatus.PASSED, N_A); - validate(resourceValidations, gifImageUri, "Unable to build CSS selector for 'img' element", + validate(resourceValidations, gifImageUri, "html > body > img.image.\\(gif\\)", CheckStatus.PASSED, N_A); validate(resourceValidations, URI.create("https://images.ctfassets.net/us_cool_mint_pocketpaks_breath_strips.png"),