-
-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added remote type reference resolver * Added support of XPath query selector * Added CDP e2e testss covering XPath integration * Added additional CDP e2e tests covering XPath integration * Added type check to QuerySelector casting function * Fixed XPath e2e tests * Fixed vuln issue * Added support of XPath selectors to http driver * Added e2e tests for XPAth
- Loading branch information
Showing
167 changed files
with
2,228 additions
and
1,055 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...s/dynamic/doc/click/click_by_selector.fql → e2e/tests/dynamic/doc/click/click_by_css.fql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
LET url = @lab.cdn.dynamic + "/#/events" | ||
LET page = DOCUMENT(url, true) | ||
|
||
T::TRUE(CLICK(page, X("//button[@id='wait-class-random-btn']"))) | ||
|
||
WAIT_CLASS(page, "#wait-class-random-content", "alert-success", 10000) | ||
|
||
RETURN TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
LET url = @lab.cdn.dynamic + "/#/forms" | ||
LET page = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(page, "form") | ||
|
||
LET input = ELEMENT(page, "#text_input") | ||
|
||
INPUT(input, "Foo") | ||
|
||
T::TRUE(CLICK(page, X(".//*[@id='text_input']"), 2)) | ||
|
||
INPUT(input, "Bar") | ||
|
||
WAIT(100) | ||
|
||
RETURN T::EQ(input.value, "Bar") |
2 changes: 1 addition & 1 deletion
2
e2e/tests/dynamic/doc/element/exists.fql → ...sts/dynamic/doc/element/exists_by_css.fql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
LET url = @lab.cdn.dynamic | ||
LET doc = DOCUMENT(url, { driver: "cdp" }) | ||
|
||
T::TRUE(ELEMENT_EXISTS(doc, X(".//*[contains(@class, 'text-center')]"))) | ||
T::FALSE(ELEMENT_EXISTS(doc, X(".//*[contains(@class, 'foo-bar')]"))) | ||
|
||
RETURN NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
LET url = @lab.cdn.dynamic + "/#/events" | ||
LET page = DOCUMENT(url, { driver: "cdp" }) | ||
|
||
FOCUS(page, "#focus-input") | ||
|
||
WAIT_CLASS(page, "#focus-content", "alert-success") | ||
|
||
RETURN TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
LET url = @lab.cdn.dynamic + "/#/events" | ||
LET page = DOCUMENT(url, { driver: "cdp" }) | ||
|
||
FOCUS(page, X("//*[@id='focus-input']")) | ||
|
||
WAIT_CLASS(page, "#focus-content", "alert-success") | ||
|
||
RETURN TRUE |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
LET url = @lab.cdn.dynamic | ||
LET doc = DOCUMENT(url, { driver: "cdp" }) | ||
LET selector = X('//*[@id="root"]/div/main/div') | ||
|
||
WAIT_ELEMENT(doc, "#layout") | ||
|
||
LET expected = '<div><h1>Welcome to Ferret E2E test page!</h1></div><div><p class="lead">It has several pages for testing different possibilities of the library</p></div>' | ||
LET actual = INNER_HTML(doc, selector) | ||
|
||
RETURN T::EQ(REGEX_REPLACE(TRIM(actual), '(\n|\s)', ''), REGEX_REPLACE(expected, '\s', '')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
LET url = @lab.cdn.dynamic | ||
LET doc = DOCUMENT(url, true) | ||
LET selector = X('//*[@id="root"]/div/main/div/*') | ||
|
||
WAIT_ELEMENT(doc, "#layout") | ||
|
||
LET expected = [ | ||
'<h1>Welcome to Ferret E2E test page!</h1>', | ||
'<p class="lead">It has several pages for testing different possibilities of the library</p>' | ||
] | ||
LET actual = INNER_HTML_ALL(doc, selector) | ||
|
||
RETURN T::EQ(actual, expected) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
LET url = @lab.cdn.dynamic | ||
LET doc = DOCUMENT(url, { driver: "cdp" }) | ||
LET selector = X('.//*[@id="root"]/div/main/div/*/h1') | ||
|
||
WAIT_ELEMENT(doc, "#layout") | ||
|
||
LET expected = 'Welcome to Ferret E2E test page!' | ||
LET actual = INNER_TEXT(doc, selector) | ||
|
||
RETURN T::EQ(REGEX_REPLACE(TRIM(actual), '(\n|\s)', ''), REGEX_REPLACE(expected, '\s', '')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
LET url = @lab.cdn.dynamic | ||
LET doc = DOCUMENT(url, true) | ||
LET selector = X('.//*[@id="root"]/div/main/div/*') | ||
|
||
WAIT_ELEMENT(doc, "#layout") | ||
|
||
LET expected = [ | ||
'Welcome to Ferret E2E test page!', | ||
'It has several pages for testing different possibilities of the library' | ||
] | ||
LET actual = ( | ||
FOR str IN INNER_TEXT_ALL(doc, selector) | ||
RETURN REGEX_REPLACE(TRIM(str), '\n', '') | ||
) | ||
|
||
RETURN T::EQ(actual, expected) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/forms" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "form") | ||
|
||
LET output = ELEMENT(doc, "#text_output") | ||
|
||
INPUT(doc, X("//*[@id='text_input']"), "foo") | ||
|
||
RETURN T::EQ(output.innerText, "foo") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
LET url = @lab.cdn.dynamic + "/#/pagination" | ||
LET page = DOCUMENT(url, true) | ||
|
||
LET items = ( | ||
FOR i IN PAGINATION(page, X("//li[contains(@class, 'page-item-next') and contains(@class, 'page-item') and not(contains(@class, 'disabled'))]")) | ||
RETURN i | ||
) | ||
|
||
RETURN T::LEN(items, 5) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/forms" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "form") | ||
|
||
LET output = ELEMENT(doc, "#multi_select_output") | ||
LET result = SELECT(doc, X("//*[@id='multi_select_input']"), ["1", "2", "4"]) | ||
|
||
T::EQ(output.innerText, "1, 2, 4") | ||
T::EQ(JSON_STRINGIFY(result), '["1","2","4"]') | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/forms" | ||
LET doc = DOCUMENT(url, { driver: "cdp" }) | ||
|
||
WAIT_ELEMENT(doc, "form") | ||
|
||
LET output = ELEMENT(doc, "#select_output") | ||
LET result = SELECT(doc, X("//*[@id='select_input']"), ["4"]) | ||
|
||
T::EQ(output.innerText, "4") | ||
T::EQ(JSON_STRINGIFY(result), '["4"]') | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
CLICK_ALL(doc, "#wait-class-btn, #wait-class-random-btn") | ||
T::LEN(ELEMENTS(doc, X("//*[@id='wait-class-content' or @id='wait-class-random-content']")), 2) | ||
WAIT_ATTR_ALL(doc, X("//*[@id='wait-class-content' or @id='wait-class-random-content']"), "class", "alert alert-success", 10000) | ||
|
||
RETURN TRUE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
LET selector = X("//*[@id='wait-class-btn']") | ||
LET attrName = "data-ferret-x" | ||
LET attrVal = "foobar" | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
LET el = ELEMENT(doc, selector) | ||
LET prev = el.attributes | ||
|
||
ATTR_SET(el, attrName, attrVal) | ||
WAIT_ATTR(doc, selector, attrName, attrVal, 30000) | ||
|
||
LET curr = el.attributes | ||
|
||
T::NONE(prev[attrName]) | ||
T::EQ(attrVal, curr[attrName], "attributes should be updated") | ||
|
||
RETURN TRUE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
CLICK_ALL(doc, "#wait-class-btn, #wait-class-random-btn") | ||
WAIT_CLASS_ALL(doc, X("//*[@id='wait-class-content' or @id='wait-class-random-content']"), "alert-success", 10000) | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
// with fixed timeout | ||
CLICK(doc, "#wait-class-btn") | ||
WAIT_CLASS(doc, X("//*[@id='wait-class-content']"), "alert-success") | ||
|
||
// with random timeout | ||
CLICK(doc, "#wait-class-random-btn") | ||
WAIT_CLASS(doc, X("//*[@id='wait-class-random-content']"), "alert-success", 10000) | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
LET pageSelector = X("//*[@id='page-events']") | ||
LET elemSelector = X("//*[@id='wait-element-content']") | ||
LET btnSelector = "#wait-element-btn" | ||
|
||
WAIT_ELEMENT(doc, pageSelector) | ||
|
||
CLICK(doc, btnSelector) | ||
|
||
WAIT_ELEMENT(doc, elemSelector, 10000) | ||
|
||
T::TRUE(ELEMENT_EXISTS(doc, elemSelector), "element not found") | ||
|
||
RETURN NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
// with fixed timeout | ||
CLICK(doc, "#wait-no-class-btn") | ||
WAIT(1000) | ||
PRINT(ATTR_GET(ELEMENT(doc, "#wait-no-class-content"), "class")) | ||
WAIT_NO_ATTR(doc, X("//*[@id='wait-no-class-content']"), "class", "alert alert-success") | ||
|
||
// with random timeout | ||
CLICK(doc, "#wait-no-class-random-btn") | ||
WAIT_NO_ATTR(doc, X("//*[@id='wait-no-class-random-content']"), "class", "alert alert-success", 10000) | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
CLICK_ALL(doc, "#wait-no-class-btn, #wait-no-class-random-btn") | ||
WAIT_NO_CLASS_ALL(doc, X("//*[@id='wait-no-class-content' or @id='wait-no-class-random-content']"), "alert-success", 10000) | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
// with fixed timeout | ||
CLICK(doc, "#wait-no-class-btn") | ||
WAIT_NO_CLASS(doc, X("//*[@id='wait-no-class-content']"), "alert-success") | ||
|
||
// with random timeout | ||
CLICK(doc, "#wait-no-class-random-btn") | ||
WAIT_NO_CLASS(doc, X("//*[@id='wait-no-class-random-content']"), "alert-success", 10000) | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
LET pageSelector = "#page-events" | ||
LET elemSelector = X("//*[@id='wait-no-element-content']") | ||
LET btnSelector = "#wait-no-element-btn" | ||
|
||
WAIT_ELEMENT(doc, pageSelector) | ||
|
||
CLICK(doc, btnSelector) | ||
|
||
WAIT_NO_ELEMENT(doc, elemSelector, 10000) | ||
|
||
T::FALSE(ELEMENT_EXISTS(doc, elemSelector), "element should not be found") | ||
|
||
RETURN NONE |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
LET url = @lab.cdn.dynamic + "?redirect=/events" | ||
LET doc = DOCUMENT(url, true) | ||
LET selector = X("//*[@id='wait-class-btn' or @id='wait-class-random-btn']") | ||
|
||
WAIT_ELEMENT(doc, "#page-events") | ||
|
||
LET n = ( | ||
FOR el IN ELEMENTS(doc, selector) | ||
ATTR_SET(el, "style", "color: black") | ||
|
||
RETURN NONE | ||
) | ||
|
||
WAIT_STYLE_ALL(doc, selector, "color", "rgb(0, 0, 0)", 10000) | ||
|
||
LET n2 = ( | ||
FOR el IN ELEMENTS(doc, selector) | ||
ATTR_SET(el, "style", "color: red") | ||
|
||
RETURN NONE | ||
) | ||
|
||
WAIT_NO_STYLE_ALL(doc, selector, "color", "rgb(0, 0, 0)", 10000) | ||
|
||
LET results = ( | ||
FOR el IN ELEMENTS(doc, selector) | ||
RETURN el.style.color | ||
) | ||
|
||
T::EQ(results, ["rgb(255, 0, 0)","rgb(255, 0, 0)"]) | ||
|
||
RETURN NONE |
File renamed without changes.
Oops, something went wrong.