Skip to content

Commit fbb6ebe

Browse files
niranjankagriclaude
andcommitted
Move the card description locator into the notes page object
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7f3e7d1 commit fbb6ebe

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎framework/pages/notes_page.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def card(self, title: str) -> Locator:
5151
has=self.page.get_by_test_id("note-card-title").get_by_text(title, exact=True)
5252
)
5353

54+
def card_description(self, title: str) -> Locator:
55+
"""The description shown on the card of the note with this title."""
56+
return self.card(title).get_by_test_id("note-card-description")
57+
5458
def add_note(self, note: NoteData, completed: bool = False) -> None:
5559
"""Creates a note through the form and waits until its card is shown."""
5660
self.add_button.click()

‎tests/e2e/test_api_and_ui.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def test_note_created_through_the_api_is_shown_in_the_app(logged_in_client, note
3030
notes_page.open()
3131

3232
# Assert
33-
card = notes_page.card(note.title)
34-
expect(card.get_by_test_id("note-card-description")).to_have_text(note.description)
33+
expect(notes_page.card_description(note.title)).to_have_text(note.description)
3534

3635

3736
def test_category_filter_shows_only_that_category(logged_in_client, notes_page):

‎tests/ui/test_notes.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def test_note_added_through_the_form_is_listed(notes_page):
1818
notes_page.add_note(note)
1919

2020
# Assert
21-
card = notes_page.card(note.title)
22-
expect(card.get_by_test_id("note-card-description")).to_have_text(note.description)
21+
expect(notes_page.card_description(note.title)).to_have_text(note.description)
2322
expect(notes_page.progress).to_have_text("You have 0/1 notes completed in the all categories")
2423

2524

0 commit comments

Comments
 (0)