Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[plugin-web-app-to-rest-api] Add XPath support for resource validatio… #4683

Merged
merged 7 commits into from
Jan 2, 2024

Conversation

uarlouski
Copy link
Member

…n steps

@uarlouski uarlouski requested a review from a team as a code owner December 21, 2023 11:25
Copy link

github-actions bot commented Dec 21, 2023

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (505c96f) 97.40% compared to head (e1787af) 97.39%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4683      +/-   ##
============================================
- Coverage     97.40%   97.39%   -0.02%     
+ Complexity     6801     6797       -4     
============================================
  Files           917      916       -1     
  Lines         18876    18872       -4     
  Branches       1254     1254              
============================================
- Hits          18387    18381       -6     
- Misses          383      384       +1     
- Partials        106      107       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@uarlouski uarlouski force-pushed the feature/add-xpath-for-resource-steps branch from dbff6bf to d572ad6 Compare December 21, 2023 12:00
@uarlouski uarlouski force-pushed the feature/add-xpath-for-resource-steps branch from d572ad6 to 6a57cf3 Compare December 28, 2023 14:48
Comment on lines 41 to 43
return getElements(baseUri, html, d -> d.select(locator));
}
return getElements(baseUri, html, d -> d.selectXpath(locator));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Function should be moved to HtmlLocatorType

@@ -278,16 +280,17 @@ private static boolean isNotAbsolute(URI uri)
* c. If GET status code acceptable than check considered as passed otherwise failed;
* <b>Example:</b>
* <pre>
* Then all resources by selector a are valid on:
* Then all resources found by css selector `a` are valid on:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Then all resources found by css selector `a` are valid on:
* Then all resources found by CSS selector `a` are valid on:

@@ -0,0 +1,8 @@
Composite: Then all resources by selector `$cssSelector` from $html are valid
!-- DEPRECATED: 0.7.0, Then all resources found by $locatorType `$locator` in $html are valid
Then all resources found by css selector `<cssSelector>` in <html> are valid
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Then all resources found by css selector `<cssSelector>` in <html> are valid
Then all resources found by CSS selector `<cssSelector>` in <html> are valid


Composite: Then all resources by selector `$cssSelector` are valid on:$pages
!-- DEPRECATED: 0.7.0, Then all resources found by $locatorType `$locator` are valid on:$pages
Then all resources found by css selector `<cssSelector>` are valid on:<pages>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Then all resources found by css selector `<cssSelector>` are valid on:<pages>
Then all resources found by CSS selector `<cssSelector>` are valid on:<pages>

@@ -0,0 +1,8 @@
Composite: Then all resources by selector `$cssSelector` from $html are valid
!-- DEPRECATED: 0.7.0, Then all resources found by $locatorType `$locator` in $html are valid
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not a valid replacement pattern



Composite: Then all resources by selector `$cssSelector` are valid on:$pages
!-- DEPRECATED: 0.7.0, Then all resources found by $locatorType `$locator` are valid on:$pages
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not a valid replacement pattern

@uarlouski uarlouski requested a review from valfirst December 29, 2023 10:02
Comment on lines 48 to 47
public abstract Elements locate(String baseUri, String html, String locator);

public Elements locate(String html, String locator)
{
return locate("", html, locator);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public abstract Elements locate(String baseUri, String html, String locator);
public Elements locate(String html, String locator)
{
return locate("", html, locator);
}
public abstract Elements findElements(String baseUri, String html, String locator);
public Elements findElements(String html, String locator)
{
return findElements("", html, locator);
}

Comment on lines 50 to 51
Document document = mock(Document.class);
Elements elements = mock(Elements.class);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Document document = mock(Document.class);
Elements elements = mock(Elements.class);
Document document = mock();
Elements elements = mock();

@uarlouski uarlouski requested a review from valfirst December 29, 2023 13:57
this.description = description;
}

public abstract Elements findElements(String baseUri, String html, String locator);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public abstract Elements findElements(String baseUri, String html, String locator);
protected abstract Elements findElements(Document htmlDocument, String locator);
@Override
public Elements findElements(String baseUri, String html, String locator)
{
return findElements(Jsoup.parse(html, baseUri), locator);
}

or use Function as a field

@@ -0,0 +1,8 @@
Composite: Then all resources by selector `$cssSelector` from $html are valid
!-- DEPRECATED: 0.7.0, Then all resources found by $htmlLocatorType `$htmlLocator` in $html are valid
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not a valid replacement pattern



Composite: Then all resources by selector `$cssSelector` are valid on:$pages
!-- DEPRECATED: 0.7.0, Then all resources found by $htmlLocatorType `$htmlLocator` are valid on:$pages
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's not a valid replacement pattern

@uarlouski uarlouski force-pushed the feature/add-xpath-for-resource-steps branch from 3c901f6 to db4a30c Compare January 1, 2024 14:05
@uarlouski uarlouski force-pushed the feature/add-xpath-for-resource-steps branch from db4a30c to e1787af Compare January 1, 2024 15:33
Copy link

sonarqubecloud bot commented Jan 1, 2024

@valfirst valfirst merged commit 5bee812 into master Jan 2, 2024
8 of 9 checks passed
@valfirst valfirst deleted the feature/add-xpath-for-resource-steps branch January 2, 2024 06:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants