Skip to content

Commit

Permalink
Added more tests for federation home and invite fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
quadcopterman committed May 29, 2024
1 parent bc4e9df commit 9ae488c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ public static ViewInteraction inviteButton() {
public static ViewInteraction joinInvitationButton() {
return onView(withId(R.id.join_other_organization_invitation));
}

public static ViewInteraction nextInvitationFragment() {
return onView(withId(R.id.fragment_linked_organizations_invite));
}

public static ViewInteraction nextQrScannerFragment() {
return onView(withId(R.id.fragment_qr_scanner));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ public static ViewInteraction organizationName() {
public static ViewInteraction nextStepButton() {
return onView(withId(R.id.next_step_button));
}

public static ViewInteraction nextHomeFragment() {
return onView(withId(R.id.fragment_linked_organizations_home));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ class LinkedOrganizationsFragmentOrganizerTest {
.check(matches(isDisplayed()))
}

@Test
fun testInviteButton() {
LinkedOrganizationsFragmentPageObject.createLinkButton().perform(ViewActions.click())
LinkedOrganizationsFragmentPageObject.inviteButton().perform(ViewActions.click())
LinkedOrganizationsFragmentPageObject.nextInvitationFragment().check(matches(isDisplayed()))
}

@Test
fun testJoinButton() {
LinkedOrganizationsFragmentPageObject.createLinkButton().perform(ViewActions.click())
LinkedOrganizationsFragmentPageObject.joinInvitationButton().perform(ViewActions.click())
LinkedOrganizationsFragmentPageObject.nextQrScannerFragment().check(matches(isDisplayed()))
}

companion object {
private val KEY_PAIR = Base64DataUtils.generateKeyPair()
private const val LAO_NAME = "LAO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.dedis.popstellar.ui.lao.federation

import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -92,6 +93,8 @@ class LinkedOrganizationsJoinFragmentTest {
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
LinkedOrganizationsInviteFragmentPageObject.nextStepButton()
.check(matches(withText(R.string.finish)))
LinkedOrganizationsInviteFragmentPageObject.nextStepButton().perform(ViewActions.click())
LinkedOrganizationsInviteFragmentPageObject.nextHomeFragment().check(matches(isDisplayed()))
}

companion object {
Expand Down

0 comments on commit 9ae488c

Please sign in to comment.