Skip to content

feat: Add Screenshot Test for ProfileCardScreen#426

Open
whitescent wants to merge 5 commits intoDroidKaigi:mainfrom
whitescent:issue-157
Open

feat: Add Screenshot Test for ProfileCardScreen#426
whitescent wants to merge 5 commits intoDroidKaigi:mainfrom
whitescent:issue-157

Conversation

@whitescent
Copy link
Contributor

@whitescent whitescent commented Aug 28, 2025

Issue

Overview (Required)

  • Add Screenshot Test for ProfileCardScreen

@whitescent whitescent force-pushed the issue-157 branch 2 times, most recently from b9221bd to 4b9ef3c Compare August 28, 2025 02:52
@github-actions
Copy link

github-actions bot commented Aug 28, 2025

Snapshot diff report

File name Image
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card exi
sts - when clicking
the edit button - it
should return to th
e profile edit scree
n_compare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card doe
s not exist - when c
hanging card themes
- it should change t
o the selected theme
_compare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card doe
s not exist - when e
ntering an invalid l
ink - it should show
an error message_co
mpare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card doe
s not exist - when f
illing out all text
fields - it should s
how the entered info
rmation correctly_co
mpare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card exi
sts - it should show
the profile card sc
reen_compare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile is saved
without an image -
it should show the s
aved content_compare
.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card exi
sts - when flipping
the card - it should
show the back of th
e card_compare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card doe
s not exist - it sho
uld show profile edi
t screen_compare.png
io.github.droidkaigi
.confsched.profile.P
rofileScreenTest - P
rofileScreen - when
the profile card doe
s not exist - when t
he profile is empty
and the create card
button is clicked -
it should show error
messages_compare.pn
g
TimetableScreenPrevi
ew_Grid_compare.png

@whitescent
Copy link
Contributor Author

whitescent commented Aug 29, 2025

Hi @kitakkun 👋, Can you help me see why this test case is always failing?

describe("click create card button when profile is empty") {
    doIt {
        clickCreateButton()
    }
    itShould("show error message") {
        captureScreenWithChecks {
            checkNameError()
        }
    }
}

it seems like the supportText of OutlinedTextField is never displayed in this test case 👀

@whitescent whitescent force-pushed the issue-157 branch 7 times, most recently from bd0e563 to 337d991 Compare September 2, 2025 06:21
@whitescent whitescent marked this pull request as ready for review September 2, 2025 07:03
@whitescent whitescent requested a review from a team as a code owner September 2, 2025 07:03
@whitescent whitescent requested review from kitakkun and removed request for a team September 2, 2025 07:03
@whitescent whitescent force-pushed the issue-157 branch 2 times, most recently from cf5dc36 to fcceca8 Compare September 5, 2025 01:36
Copy link
Contributor

@kitakkun kitakkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so much time to review this PR! 🙏🏻

I’ve left a few comments—would you mind taking a look when you have a chance?

@whitescent whitescent force-pushed the issue-157 branch 2 times, most recently from 7cd39e0 to edd70c5 Compare September 9, 2025 06:32
Comment on lines 66 to 99
describe("click create card button when profile is empty") {
doIt {
clickCreateButton()
}
itShould("show error text") {
captureScreenWithChecks {
checkNameError()
checkOccupationError()
checkLinkEmptyError()
checkImageEmptyError()
}
}
}
describe("check invalid link") {
doIt {
inputLink("あいうえお")
clickCreateButton()
}
itShould("show error text") {
captureScreenWithChecks {
checkLinkInvalidError()
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if these screenshot results are as intended?
You might need to scroll down to include the part with the error message.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message does need to be reflected in the screenshot test, I will fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe("when entering an invalid link") {
    doIt {
        inputLink("あいうえお")
        scrollToNodeTagInEditScreen(ProfileCardEditCreateCardButtonTestTag)
        clickCreateButton()
        scrollToNodeTagInEditScreen(ProfileCardEditLinkFormLabelTestTag)
    }
    itShould("show an error message") {
        captureScreenWithChecks {
            checkLinkInvalidError()
        }
    }
}

context(composeUiTest: ComposeUiTest)
fun scrollToNodeTagInEditScreen(tag: String) {
    composeUiTest
        .onNodeWithTag(ProfileCardEditScreenColumnTestTag)
        .performScrollToNode(hasTestTag(tag))
    waitUntilIdle()
}
image

Even though I used the performScroll... API, it seems like the screenshot position isn't at the top of the form label, judging from the screen test screenshots? So it looks a bit strange... I wonder if I missed something? 👀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be hidden under the TopAppBar. I recall a similar workaround being applied in the AboutScreen screenshot test as well.

// FIXME Without this, you won't be able to scroll to the exact middle of the credits section.
composeUiTest.onRoot().performTouchInput {
swipeDown(startY = centerY, endY = centerY + 100)
}

Copy link
Contributor

@kitakkun kitakkun Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% perfect maybe, but we’re still seeing the error message we want, so I think this is fine as it is. 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh! I see, I did indeed forget that TopAppBar exists, thanks for the reminder! 👀

@whitescent whitescent force-pushed the issue-157 branch 7 times, most recently from 89cd053 to 9dbed91 Compare September 10, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Screenshot Test for ProfileCardScreen

2 participants