-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added E2E Test for Exceptions lecture(TWP54)
- Loading branch information
1 parent
64f9da8
commit 0b58c0e
Showing
1 changed file
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
def test_TWPl54_1(page): | ||
page.goto("lectures/TWP54/TWP54_3_en.html") | ||
|
||
# Run the exercise | ||
page.click("#ac_l54_3a_en >> *css=button >> text=Run") | ||
|
||
# Wait for the iframe to load | ||
page.wait_for_selector('iframe') | ||
|
||
# Get the iframe | ||
frame = page.frame(url="about:srcdoc") | ||
|
||
# Check if the iframe was found | ||
if frame is None: | ||
raise Exception("Could not find iframe") | ||
|
||
page.frame(url="about:srcdoc").click("input") | ||
# Fill input | ||
page.frame(url="about:srcdoc").fill("input", "Lisbon") | ||
# Click :nth-match(input, 2) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 2)") | ||
# Fill :nth-match(input, 2) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 2)", "Great Place!") | ||
# Click :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 3)") | ||
# Fill :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 3)", "Wall Street") | ||
# Click text=Save | ||
page.frame(url="about:srcdoc").click("text=Save") | ||
# Click :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 3)") | ||
# Fill :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 3)", "") | ||
# Click text=Save | ||
page.once("dialog", lambda dialog: dialog.dismiss()) | ||
page.frame(url="about:srcdoc").click("text=Save") | ||
|
||
def test_TWPl54_2(page): | ||
page.goto("lectures/TWP54/TWP54_3.html") | ||
|
||
# Run the exercise | ||
page.click("#ac_l54_3a >> *css=button >> text=Run") | ||
|
||
# Wait for the iframe to load | ||
page.wait_for_selector('iframe') | ||
|
||
# Get the iframe | ||
frame = page.frame(url="about:srcdoc") | ||
|
||
# Check if the iframe was found | ||
if frame is None: | ||
raise Exception("Could not find iframe") | ||
|
||
page.frame(url="about:srcdoc").click("input") | ||
# Fill input | ||
page.frame(url="about:srcdoc").fill("input", "Lisbon") | ||
# Click :nth-match(input, 2) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 2)") | ||
# Fill :nth-match(input, 2) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 2)", "Great Place!") | ||
# Click :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 3)") | ||
# Fill :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 3)", "Wall Street") | ||
# Click text=Save | ||
page.frame(url="about:srcdoc").click("text=Guardar") | ||
# Click :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").click(":nth-match(input, 3)") | ||
# Fill :nth-match(input, 3) | ||
page.frame(url="about:srcdoc").fill(":nth-match(input, 3)", "") | ||
# Click text=Save | ||
page.once("dialog", lambda dialog: dialog.dismiss()) | ||
page.frame(url="about:srcdoc").click("text=Guardar") | ||
|