@@ -16,15 +16,31 @@ def __init__(self, page):
16
16
async def click_openstax_logo (self ):
17
17
await self .page .get_by_test_id ("navbar" ).get_by_role ("img" ).click ()
18
18
19
- # Subjects homepage
19
+ @pytest .mark .asyncio
20
+ async def main_menu_and_openstax_logo_is_visible (self ):
21
+ return await self .page .locator ("div.menus.desktop > nav.nav" ).is_visible ()
22
+
23
+ @pytest .mark .asyncio
24
+ async def osweb_homepage_content_is_visible (self ):
25
+ return await self .page .locator ("main > section:nth-child(5)" ).is_visible ()
20
26
21
27
@property
22
- def subjects_page_menu (self ):
23
- return self .page .get_by_role ("button" , name = "Subjects" )
28
+ def osweb_homepage_sections (self ):
29
+ return self .page .locator ("main" )
30
+
31
+ @pytest .mark .asyncio
32
+ async def osweb_homepage_content_sections (self ):
33
+ return await self .page .locator (f"main > section:nth-child(5)" ).is_visible ()
34
+
35
+ # Subjects homepage
36
+
37
+ @pytest .mark .asyncio
38
+ async def subjects_page_menu (self ):
39
+ return await self .page .get_by_role ("button" , name = "Subjects" ).is_visible ()
24
40
25
41
@pytest .mark .asyncio
26
42
async def click_subjects_page_menu (self ):
27
- await self .subjects_page_menu .hover ()
43
+ await self .page . get_by_role ( "button" , name = "Subjects" ) .hover ()
28
44
29
45
@property
30
46
def subjects_homepage_link (self ):
@@ -118,6 +134,22 @@ async def click_instructor_resources_tab(self):
118
134
async def click_student_resources_tab (self ):
119
135
await self .page .locator ("id=Student resources-tab" ).click ()
120
136
137
+ @pytest .mark .asyncio
138
+ async def click_subjects_science_link (self ):
139
+ await self .subjects_science_link .click ()
140
+
141
+ @property
142
+ def subjects_list (self ):
143
+ return self .page .locator ("#ddId-Subjects > a" )
144
+
145
+ @pytest .mark .asyncio
146
+ async def subjects_intro (self ):
147
+ return await self .page .locator ("section.subject-intro" ).is_visible ()
148
+
149
+ @pytest .mark .asyncio
150
+ async def subjects_title (self ):
151
+ return (await self .page .locator ("section.subject-intro > div > h1" ).inner_text ()).lower ()
152
+
121
153
# Highlights and Notes
122
154
123
155
@property
@@ -212,9 +244,9 @@ async def close_giving_tuesday_popup(self):
212
244
213
245
# Philanthropic support
214
246
215
- @property
216
- def philanthropic_support_section (self ):
217
- return self .page .locator ("section.philanthropic-support" )
247
+ @pytest . mark . asyncio
248
+ async def philanthropic_support_section (self ):
249
+ return await self .page .locator ("section.philanthropic-support" ). is_visible ( )
218
250
219
251
@property
220
252
def our_impact_link (self ):
@@ -224,37 +256,40 @@ def our_impact_link(self):
224
256
async def click_our_impact_link (self ):
225
257
await self .our_impact_link .click ()
226
258
227
- @property
228
- def give_today_link_is_visible (self ):
229
- return self .page .locator ("#footer" ).get_by_role ("link" , name = "Give today" )
259
+ @pytest . mark . asyncio
260
+ async def give_today_link_is_visible (self ):
261
+ return await self .page .locator ("#footer" ).get_by_role ("link" , name = "Give today" ). is_visible ( )
230
262
231
263
@pytest .mark .asyncio
232
264
async def click_give_today_link (self ):
233
- await self .give_today_link_is_visible .click ()
265
+ await self .page . locator ( "#footer" ). get_by_role ( "link" , name = "Give today" ) .click ()
234
266
235
267
# Subjects page footer section
236
268
237
- @property
238
- def footer_section (self ):
239
- return self .page .locator ("id=footer" )
269
+ @pytest . mark . asyncio
270
+ async def footer_section (self ):
271
+ return await self .page .locator ("id=footer" ). is_visible ( )
240
272
241
- @property
242
- def footer_section_help_is_visible (self ):
243
- return self .page .locator ("div.column.col1" )
273
+ @pytest . mark . asyncio
274
+ async def footer_section_help_is_visible (self ):
275
+ return await self .page .locator ("div.column.col1" ). is_visible ( )
244
276
245
- @property
246
- def footer_section_openstax_is_visible (self ):
247
- return self .page .locator ("div.column.col2" )
277
+ @pytest . mark . asyncio
278
+ async def footer_section_openstax_is_visible (self ):
279
+ return await self .page .locator ("div.column.col2" ). is_visible ( )
248
280
249
- @property
250
- def footer_section_policies_is_visible (self ):
251
- return self .page .locator ("div.column.col3" )
281
+ @pytest .mark .asyncio
282
+ async def footer_section_policies_is_visible (self ):
283
+ return await self .page .locator ("div.column.col3" ).is_visible ()
284
+
285
+ @pytest .mark .asyncio
286
+ async def footer_section_bottom_is_visible (self ):
287
+ return await self .page .locator ("div.bottom" ).is_visible ()
252
288
253
289
@property
254
- def footer_section_bottom_is_visible (self ):
290
+ def footer_section_bottom (self ):
255
291
return self .page .locator ("div.bottom" )
256
292
257
- @property
258
293
@pytest .mark .asyncio
259
294
async def footer_section_license_link (self ):
260
295
return await self .page .locator ("div.copyrights" ).get_by_role ("link" ).get_attribute ("href" )
0 commit comments