Skip to content

Commit f260197

Browse files
committed
Update the offline demo page with the associated test
1 parent fd20ad5 commit f260197

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

examples/offline_examples/demo_page.html

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ <h3>Automation Practice</h3>
318318
<tr>
319319
<td>Input Slider Control:</td>
320320
<td>
321-
<input type="range" min="0" max="4" step="1"
322-
id="mySlider" name="sliderName" value="2"
321+
<input type="range" min="0" max="100" step="10"
322+
id="mySlider" name="sliderName" value="50"
323323
style="width: 88%;" class="slider"
324324
onclick="sliderFunction1()"
325325
onchange="sliderFunction1()"
@@ -439,26 +439,8 @@ <h3>Automation Practice</h3>
439439
var s = document.getElementById("mySlider");
440440
var p = document.getElementById("progressBar");
441441
var pl = document.getElementById("progressLabel");
442-
if (s.value == "0") {
443-
p.value = "0";
444-
pl.textContent = "Progress Bar: (0%)";
445-
}
446-
if (s.value == "1") {
447-
p.value = "25";
448-
pl.textContent = "Progress Bar: (25%)";
449-
}
450-
if (s.value == "2") {
451-
p.value = "50";
452-
pl.textContent = "Progress Bar: (50%)";
453-
}
454-
if (s.value == "3") {
455-
p.value = "75";
456-
pl.textContent = "Progress Bar: (75%)";
457-
}
458-
if (s.value == "4") {
459-
p.value = "100";
460-
pl.textContent = "Progress Bar: (100%)";
461-
}
442+
p.value = s.value;
443+
pl.textContent = "Progress Bar: (" + p.value + "%)";
462444
}
463445
</script>
464446
<script>

examples/offline_examples/test_demo_page.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from selenium.webdriver.common.keys import Keys
21
from seleniumbase import BaseCase
32

43

@@ -19,22 +18,25 @@ def test_demo_page(self):
1918
self.update_text("textarea.area1", "Testing Time!\n")
2019
self.update_text('[name="preText2"]', "Typing Text!")
2120

21+
# Verify that a hover dropdown link changes page text
22+
self.assert_text("Automation Practice", "h3")
23+
self.hover_and_click("#myDropdown", "#dropOption2")
24+
self.assert_text("Link Two Selected", "h3")
25+
2226
# Verify that a button click changes text on the page
2327
self.assert_text("This Text is Green", "#pText")
2428
self.click("#myButton")
2529
self.assert_text("This Text is Purple", "#pText")
2630

27-
# Verify that the hover dropdown option changes text
28-
self.assert_text("Automation Practice", "h3")
29-
self.hover_and_click("#myDropdown", "#dropOption2")
30-
self.assert_text("Link Two Selected", "h3")
31+
# Assert that the given SVG is visible on the page
32+
self.assert_element('svg[name="svgName"]')
3133

32-
# Verify that moving a "slider" updates a progrss bar
34+
# Verify that a slider control updates a progrss bar
3335
self.assert_element('progress[value="50"]')
34-
self.send_keys("#myslider", Keys.RIGHT + Keys.RIGHT)
36+
self.press_right_arrow("#myslider", times=5)
3537
self.assert_element('progress[value="100"]')
3638

37-
# Verify that the "select" option updates a meter bar
39+
# Verify that a "select" option updates a meter bar
3840
self.assert_element('meter[value="0.25"]')
3941
self.select_option_by_text("#mySelect", "Set to 75%")
4042
self.assert_element('meter[value="0.75"]')
@@ -61,8 +63,5 @@ def test_demo_page(self):
6163
self.click("#radioButton2")
6264
self.assert_true(self.is_selected("#radioButton2"))
6365

64-
# Assert that the SVG is visible on the page
65-
self.assert_element('svg[name="svgName"]')
66-
6766
# Assert the title of the current web page
6867
self.assert_title("Web Testing Page")

0 commit comments

Comments
 (0)