Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Jun 21, 2023
1 parent 7965854 commit b4cd967
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.odk.collect.android.R;
import org.odk.collect.android.support.pages.AccessControlPage;
import org.odk.collect.android.support.pages.MainMenuPage;
import org.odk.collect.android.support.pages.ProjectSettingsPage;
import org.odk.collect.android.support.pages.SaveOrDiscardFormDialog;
import org.odk.collect.android.support.rules.CollectTestRule;
import org.odk.collect.android.support.rules.TestRuleChain;
import org.odk.collect.android.support.pages.AccessControlPage;
import org.odk.collect.android.support.pages.ProjectSettingsPage;
import org.odk.collect.android.support.pages.MainMenuPage;

//Issue NODK-243
public class FormEntrySettingsTest {
Expand Down Expand Up @@ -59,7 +59,7 @@ public void movingBackwards_shouldBeTurnedOn() {
.swipeToNextQuestion("String widget")
.closeSoftKeyboard()
.swipeToPreviousQuestion("String widget")
.pressBack(new SaveOrDiscardFormDialog<>(new MainMenuPage()))
.pressBack(new SaveOrDiscardFormDialog<>(new MainMenuPage(), false))
.assertText(R.string.do_not_save)
.assertTextDoesNotExist(R.string.keep_changes)
.clickOnString(R.string.do_not_save);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ package org.odk.collect.android.support.pages
import android.os.Build
import org.odk.collect.android.R

class SaveOrDiscardFormDialog<D : Page<D>>(
private val destination: D
class SaveOrDiscardFormDialog<D : Page<D>> @JvmOverloads constructor(
private val destination: D,
private val saveAsDraftEnabled: Boolean = true
) : Page<SaveOrDiscardFormDialog<D>>() {

override fun assertOnPage(): SaveOrDiscardFormDialog<D> {
assertText(R.string.quit_form_title)
if (saveAsDraftEnabled) {
assertText(R.string.quit_form_title)
} else {
assertText(R.string.quit_form_continue_title)
}

return this
}

Expand Down

0 comments on commit b4cd967

Please sign in to comment.