-
-
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.
Bugfix/inner text html by selector (#347)
* Fixed inner text * Fixed inner html * Updated set inner html and inner text * Changed mechanism of reading and writing inner text and html * updated makefile * Added e2e tests * Updated makefile * Updated changelog * Reverted dynamic page example
- Loading branch information
Showing
14 changed files
with
340 additions
and
80 deletions.
There are no files selected for viewing
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
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 @@ | ||
const e = React.createElement; | ||
|
||
const ITEMS = [{"artist":"Lil Tecca","track":"Ransom"},{"artist":"NLE Choppa","track":"Shotta Flow (Feat. Blueface) [Remix]"},{"artist":"Baby Jesus (DaBaby)","track":"Suge"},{"artist":"NLE Choppa","track":"Shotta Flow 3"},{"artist":"Lil Tecca ","track":"Lil Tecca - Did It Again"},{"artist":"NLE Choppa","track":"Shotta Flow"},{"artist":"Ynw Melly","track":"Dangerously In Love (772 Love Pt. 2)"},{"artist":"POLO G","track":"Polo G feat. Lil TJay - Pop Out"},{"artist":"MUSTARD","track":"Ballin' (feat. Roddy Ricch)"},{"artist":"Lil Nas X","track":"Panini"},{"artist":"Juice WRLD","track":"Juice Wrld - RUN"},{"artist":"Shordie Shordie","track":"Betchua (Bitchuary)"},{"artist":"Post Malone","track":"Goodbyes (feat. Young Thug)"},{"artist":"LIL UZI VERT","track":"Sanguine Paradise"},{"artist":"Calboy","track":"Envy Me"},{"artist":"Ambjaay","track":"Uno"},{"artist":"Lil Tecca","track":"Lil Tecca - Bossanova"},{"artist":"Lil Baby","track":"Baby"},{"artist":"Lil Tjay","track":"Lil Tjay - Brothers (Prod by JDONTHATRACK & Protegebeatz)"},{"artist":"YK Osiris","track":"Worth It"}]; | ||
|
||
export default class ListsPage extends React.Component { | ||
render() { | ||
const items = ITEMS.map((i) => { | ||
return e("li", { className: "list-group-item track"}, [ | ||
e("div", { className: "track-details"}, [ | ||
e("h5", { className: "track-artist"}, i.artist), | ||
e("small", { className: "track-name"}, i.track) | ||
]) | ||
]) | ||
}); | ||
|
||
return e("div", { id: "tracks" }, [ | ||
e("ul", { className: "list-group track-list" }, items) | ||
]) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,34 @@ | ||
LET url = @dynamic | ||
LET url = @dynamic + "/#/lists" | ||
LET doc = DOCUMENT(url, true) | ||
LET el = ELEMENT(doc, ".jumbotron") | ||
|
||
LET expected = `Welcome to Ferret E2E test page!` | ||
LET actual = INNER_HTML(el, "h1") | ||
LET expected = [ | ||
{"details":'<h5 class="track-artist">Lil Tecca</h5><small class="track-name">Ransom</small>'}, | ||
{"details":'<h5 class="track-artist">NLE Choppa</h5><small class="track-name">Shotta Flow (Feat. Blueface) [Remix]</small>'}, | ||
{"details":'<h5 class="track-artist">Baby Jesus (DaBaby)</h5><small class="track-name">Suge</small>'}, | ||
{"details":'<h5 class="track-artist">NLE Choppa</h5><small class="track-name">Shotta Flow 3</small>'}, | ||
{"details":'<h5 class="track-artist">Lil Tecca </h5><small class="track-name">Lil Tecca - Did It Again</small>'}, | ||
{"details":'<h5 class="track-artist">NLE Choppa</h5><small class="track-name">Shotta Flow</small>'}, | ||
{"details":'<h5 class="track-artist">Ynw Melly</h5><small class="track-name">Dangerously In Love (772 Love Pt. 2)</small>'}, | ||
{"details":'<h5 class="track-artist">POLO G</h5><small class="track-name">Polo G feat. Lil TJay - Pop Out</small>'}, | ||
{"details":`<h5 class="track-artist">MUSTARD</h5><small class="track-name">Ballin' (feat. Roddy Ricch)</small>`}, | ||
{"details":'<h5 class="track-artist">Lil Nas X</h5><small class="track-name">Panini</small>'}, | ||
{"details":'<h5 class="track-artist">Juice WRLD</h5><small class="track-name">Juice Wrld - RUN</small>'}, | ||
{"details":'<h5 class="track-artist">Shordie Shordie</h5><small class="track-name">Betchua (Bitchuary)</small>'}, | ||
{"details":'<h5 class="track-artist">Post Malone</h5><small class="track-name">Goodbyes (feat. Young Thug)</small>'}, | ||
{"details":'<h5 class="track-artist">LIL UZI VERT</h5><small class="track-name">Sanguine Paradise</small>'}, | ||
{"details":'<h5 class="track-artist">Calboy</h5><small class="track-name">Envy Me</small>'}, | ||
{"details":'<h5 class="track-artist">Ambjaay</h5><small class="track-name">Uno</small>'}, | ||
{"details":'<h5 class="track-artist">Lil Tecca</h5><small class="track-name">Lil Tecca - Bossanova</small>'}, | ||
{"details":'<h5 class="track-artist">Lil Baby</h5><small class="track-name">Baby</small>'}, | ||
{"details":'<h5 class="track-artist">Lil Tjay</h5><small class="track-name">Lil Tjay - Brothers (Prod by JDONTHATRACK & Protegebeatz)</small>'}, | ||
{"details":'<h5 class="track-artist">YK Osiris</h5><small class="track-name">Worth It</small>'} | ||
] | ||
|
||
LET r1 = '(\n|\s)' | ||
LET r2 = '(\n|\s)' | ||
LET actual = ( | ||
FOR item IN ELEMENTS(doc, '.track-list li') | ||
RETURN { | ||
details: INNER_HTML(item, '.track-details'), | ||
} | ||
) | ||
|
||
RETURN EXPECT(REGEXP_REPLACE(expected, r1, ''), REGEXP_REPLACE(TRIM(actual), r2, '')) | ||
RETURN EXPECT(expected, actual) |
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,25 @@ | ||
LET url = @dynamic + "/#/lists" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
LET expected = [ | ||
{"details":'<h5 class="track-artist">MEDUZA</h5><small class="track-name">Piece Of Your Heart (feat. Goodboys)</small>'}, | ||
{"details":'<h5 class="track-artist">Metanoia Music</h5><small class="track-name">Che Crozz x Orbis - Lift Me Up</small>'} | ||
] | ||
|
||
LET html = ( | ||
FOR t IN expected | ||
RETURN '<li><div class="track-details">' + t.details + '</div></li>' | ||
) | ||
|
||
INNER_HTML_SET(doc, '.track-list', CONCAT_SEPARATOR('\n', html)) | ||
|
||
LET list = ELEMENT(doc, '.track-list') | ||
|
||
LET actual = ( | ||
FOR item IN ELEMENTS(doc, '.track-list li') | ||
RETURN { | ||
details: INNER_HTML(item, '.track-details'), | ||
} | ||
) | ||
|
||
RETURN EXPECT(expected, actual) |
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 |
---|---|---|
@@ -1,11 +1,34 @@ | ||
LET url = @dynamic | ||
LET url = @dynamic + "/#/lists" | ||
LET doc = DOCUMENT(url, true) | ||
LET el = ELEMENT(doc, ".jumbotron") | ||
|
||
LET expected = `Welcome to Ferret E2E test page!` | ||
LET actual = INNER_TEXT(el, "h1") | ||
LET expected = [ | ||
{"artist":"Lil Tecca","track":"Ransom"}, | ||
{"artist":"NLE Choppa","track":"Shotta Flow (Feat. Blueface) [Remix]"}, | ||
{"artist":"Baby Jesus (DaBaby)","track":"Suge"}, | ||
{"artist":"NLE Choppa","track":"Shotta Flow 3"}, | ||
{"artist":"Lil Tecca","track":"Lil Tecca - Did It Again"}, | ||
{"artist":"NLE Choppa","track":"Shotta Flow"}, | ||
{"artist":"Ynw Melly","track":"Dangerously In Love (772 Love Pt. 2)"}, | ||
{"artist":"POLO G","track":"Polo G feat. Lil TJay - Pop Out"}, | ||
{"artist":"MUSTARD","track":"Ballin' (feat. Roddy Ricch)"}, | ||
{"artist":"Lil Nas X","track":"Panini"}, | ||
{"artist":"Juice WRLD","track":"Juice Wrld - RUN"}, | ||
{"artist":"Shordie Shordie","track":"Betchua (Bitchuary)"}, | ||
{"artist":"Post Malone","track":"Goodbyes (feat. Young Thug)"}, | ||
{"artist":"LIL UZI VERT","track":"Sanguine Paradise"}, | ||
{"artist":"Calboy","track":"Envy Me"}, | ||
{"artist":"Ambjaay","track":"Uno"}, | ||
{"artist":"Lil Tecca","track":"Lil Tecca - Bossanova"}, | ||
{"artist":"Lil Baby","track":"Baby"}, | ||
{"artist":"Lil Tjay","track":"Lil Tjay - Brothers (Prod by JDONTHATRACK & Protegebeatz)"}, | ||
{"artist":"YK Osiris","track":"Worth It"} | ||
] | ||
LET actual = ( | ||
FOR item IN ELEMENTS(doc, '.track-list li') | ||
RETURN { | ||
artist: TRIM(INNER_TEXT(item, '.track-artist')), | ||
track: TRIM(INNER_TEXT(item, '.track-name')) | ||
} | ||
) | ||
|
||
LET r1 = '(\n|\s)' | ||
LET r2 = '(\n|\s)' | ||
|
||
RETURN EXPECT(REGEXP_REPLACE(expected, r1, ''), REGEXP_REPLACE(TRIM(actual), r2, '')) | ||
RETURN EXPECT(expected, actual) |
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,37 @@ | ||
LET url = @dynamic + "/#/lists" | ||
LET doc = DOCUMENT(url, true) | ||
|
||
LET expected = [ | ||
{ | ||
"artist":'MEDUZA', | ||
"track": 'Piece Of Your Heart (feat. Goodboys)' | ||
}, | ||
{ | ||
"artist": 'Metanoia Music', | ||
"track": 'Che Crozz x Orbis - Lift Me Up' | ||
} | ||
] | ||
|
||
LET f = ( | ||
FOR item, idx IN ELEMENTS(doc, '.track-list li') | ||
LIMIT 2 | ||
LET value = expected[idx] | ||
|
||
INNER_HTML_SET(item, '.track-artist', value.artist) | ||
INNER_HTML_SET(item, '.track-name', value.track) | ||
|
||
RETURN NONE | ||
) | ||
|
||
LET list = ELEMENT(doc, '.track-list') | ||
|
||
LET actual = ( | ||
FOR item IN ELEMENTS(doc, '.track-list li') | ||
LIMIT 2 | ||
RETURN { | ||
artist: TRIM(INNER_TEXT(item, '.track-artist')), | ||
track: TRIM(INNER_TEXT(item, '.track-name')) | ||
} | ||
) | ||
|
||
RETURN EXPECT(expected, actual) |
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
Oops, something went wrong.