Skip to content

Commit 1a9724d

Browse files
committed
Update example tests
1 parent 95e1818 commit 1a9724d

File tree

3 files changed

+9
-35
lines changed

3 files changed

+9
-35
lines changed

examples/hack_the_planet.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def test_all_your_base_are_belong_to_us(self):
1010
aybabtu = "%s %s" % (ayb, abtu)
1111
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png"
1212
sb_dashboard_logo = "//seleniumbase.io/img/dash_pie_3.png"
13-
yt_chip = "#chips yt-chip-cloud-chip-renderer:nth-of-type"
1413
wiki = "https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"
1514

1615
self.open(wiki)
@@ -100,29 +99,6 @@ def test_all_your_base_are_belong_to_us(self):
10099
self.highlight('a[href*="w/signup"] span', loops=6, scroll=False)
101100
self.highlight('a[href*="w/signup"]', loops=6, scroll=False)
102101

103-
self.open("https://www.youtube.com/")
104-
self.set_text_content("%s(1)" % yt_chip, "ALL")
105-
self.set_text_content("%s(2)" % yt_chip, "YOUR")
106-
self.set_text_content("%s(3)" % yt_chip, "BASE")
107-
self.set_text_content("%s(4)" % yt_chip, "ARE")
108-
self.set_text_content("%s(5)" % yt_chip, "BELONG")
109-
self.set_text_content("%s(6)" % yt_chip, "TO")
110-
self.set_text_content("%s(7)" % yt_chip, "US")
111-
self.set_text_content("%s(8)" % yt_chip, "!")
112-
self.set_text_content("%s(9)" % yt_chip, "!")
113-
self.set_text_content("%s(10)" % yt_chip, "!")
114-
self.click_if_visible("#dismiss-button")
115-
self.click_if_visible('button[aria-label="Close"]')
116-
self.highlight("#scroll-container", loops=5, scroll=False)
117-
self.highlight("%s(1)" % yt_chip, loops=1, scroll=False)
118-
self.highlight("%s(2)" % yt_chip, loops=1, scroll=False)
119-
self.highlight("%s(3)" % yt_chip, loops=3, scroll=False)
120-
self.highlight("%s(4)" % yt_chip, loops=1, scroll=False)
121-
self.highlight("%s(5)" % yt_chip, loops=1, scroll=False)
122-
self.highlight("%s(6)" % yt_chip, loops=1, scroll=False)
123-
self.highlight("%s(7)" % yt_chip, loops=3, scroll=False)
124-
self.highlight("#scroll-container", loops=7, scroll=False)
125-
126102
self.open("https://github.com/features/actions")
127103
self.set_text_content('a[href="/team"]', ayb)
128104
self.set_text_content('a[href="/enterprise"]', abtu)

examples/old_wordle_script.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def test_wordle(self):
101101
self.click(keyboard_base + button)
102102
row = 'game-app::shadow game-row[letters="%s"]::shadow ' % word
103103
tile = row + "game-tile:nth-of-type(%s)"
104-
self.wait_for_element(tile % "5" + '::shadow [data-state*="e"]')
104+
self.wait_for_element(tile % "5" + '::shadow [data-state$="t"]')
105+
self.wait_for_element(
106+
tile % "5" + '::shadow [data-animation="idle"]'
107+
)
105108
letter_status = []
106109
for i in range(1, 6):
107110
letter_eval = self.get_attribute(tile % str(i), "evaluation")

examples/wordle_test.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,14 @@ def modify_word_list(self, word, letter_status):
5050
self.word_list = new_word_list
5151
new_word_list = []
5252

53-
def skip_if_headless_mode(self):
54-
if self.headless:
55-
message = "Skip this test in headless mode!"
56-
print(message)
57-
self.skip(message)
58-
5953
def test_wordle(self):
60-
self.skip_if_headless_mode()
54+
if self.headless:
55+
self.skip("Skip this test in headless mode!")
6156
self.open("https://www.nytimes.com/games/wordle/index.html")
6257
self.click_if_visible('svg[data-testid="icon-close"]', timeout=2)
6358
self.remove_elements("div.place-ad")
6459
self.initialize_word_list()
60+
random.seed()
6561
word = random.choice(self.word_list)
6662
num_attempts = 0
6763
found_word = False
@@ -74,15 +70,14 @@ def test_wordle(self):
7470
button = 'button[data-key="%s"]' % letter
7571
self.click(button)
7672
button = 'button[class*="oneAndAHalf"]'
77-
self.wait_for_ready_state_complete()
7873
self.click(button)
7974
row = (
8075
'div[class*="lbzlf"] div[class*="Row-module"]:nth-of-type(%s) '
8176
% num_attempts
8277
)
8378
tile = row + 'div:nth-child(%s) div[class*="module_tile__3ayIZ"]'
84-
self.wait_for_element(tile % "5" + '[data-state*="e"]')
85-
self.wait_for_ready_state_complete()
79+
self.wait_for_element(tile % "5" + '[data-state$="t"]')
80+
self.wait_for_element(tile % "5" + '[data-animation="idle"]')
8681
letter_status = []
8782
for i in range(1, 6):
8883
letter_eval = self.get_attribute(tile % str(i), "data-state")

0 commit comments

Comments
 (0)