public void testSelectCostumeAndPlay() {
    solo.clickOnText(getActivity().getString(R.string.broadcast_nothing_selected));
    solo.clickOnText(costumeName);
    assertTrue(costumeName + " is not selected in Spinner", solo.searchText(costumeName));

    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.sleep(7000);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(2000);
    Costume costume =
        ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).costume;
    assertEquals(
        "costume not set", costume.getImagePath(), costumeDataList.get(0).getAbsolutePath());
    solo.goBack();
    solo.goBack();
    solo.waitForActivity(ScriptTabActivity.class.getSimpleName());

    solo.clickOnText(costumeName);
    solo.clickOnText(costumeName2);
    assertTrue(costumeName2 + " is not selected in Spinner", solo.searchText(costumeName2));
    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(2000);
    costume = ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).costume;
    assertEquals(
        "costume not set", costume.getImagePath(), costumeDataList.get(1).getAbsolutePath());
  }
Beispiel #2
0
  public void testRestartButtonActivityChain() throws NameNotFoundException, IOException {
    createAndSaveTestProject(testProject);
    solo.clickOnButton(getActivity().getString(R.string.my_projects));
    solo.waitForActivity(MyProjectsActivity.class.getSimpleName());
    solo.waitForFragmentById(R.id.fr_projects_list);
    assertTrue("Cannot click project.", UiTestUtils.clickOnTextInList(solo, testProject));
    solo.waitForActivity(ProjectActivity.class.getSimpleName());

    Activity currentActivity = solo.getCurrentActivity();

    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.goBack();
    solo.sleep(100);
    solo.clickOnButton(getActivity().getString(R.string.restart_current_project));
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.assertCurrentActivity("Program is not in stage activity", StageActivity.class);

    solo.sleep(500);
    solo.goBack();
    solo.sleep(100);
    solo.clickOnButton(getActivity().getString(R.string.back));
    solo.waitForActivity(ProjectActivity.class.getSimpleName());
    assertEquals("Returned to wrong Activity", currentActivity, solo.getCurrentActivity());
  }
  private void longClickAndDrag(
      final float xFrom, final float yFrom, final float xTo, final float yTo, final int steps) {
    Handler handler = new Handler(getActivity().getMainLooper());

    handler.post(
        new Runnable() {

          public void run() {
            MotionEvent downEvent =
                MotionEvent.obtain(
                    SystemClock.uptimeMillis(),
                    SystemClock.uptimeMillis(),
                    MotionEvent.ACTION_DOWN,
                    xFrom,
                    yFrom,
                    0);
            getActivity().dispatchTouchEvent(downEvent);
          }
        });

    solo.sleep(ViewConfiguration.getLongPressTimeout() + 200);

    handler.post(
        new Runnable() {
          public void run() {

            for (int i = 0; i <= steps; i++) {
              float x = xFrom + (((xTo - xFrom) / steps) * i);
              float y = yFrom + (((yTo - yFrom) / steps) * i);
              MotionEvent moveEvent =
                  MotionEvent.obtain(
                      SystemClock.uptimeMillis(),
                      SystemClock.uptimeMillis(),
                      MotionEvent.ACTION_MOVE,
                      x,
                      y,
                      0);
              getActivity().dispatchTouchEvent(moveEvent);
              solo.sleep(20);
            }
          }
        });

    solo.sleep(steps * 20 + 200);
    handler.post(
        new Runnable() {
          public void run() {
            MotionEvent upEvent =
                MotionEvent.obtain(
                    SystemClock.uptimeMillis(),
                    SystemClock.uptimeMillis(),
                    MotionEvent.ACTION_UP,
                    xTo,
                    yTo,
                    0);
            getActivity().dispatchTouchEvent(upEvent);
          }
        });
    solo.sleep(1000);
  }
  public void test02RejectFileTransferRequest() {
    checkThatTheFilesHaveNotBeenTransferred();

    tina.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** Tina is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(1);
    solo.sleep(500);

    openReceiveFileDialog(tina, 1);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "Tina is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    rejectFileTransfer();
    solo.sleep(500);

    checkThatTheMainChatIsInFront();
    checkMainChatMessage("*** You declined to receive kouchat-1600x1600.png from Tina");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFilesHaveNotBeenTransferred();
  }
Beispiel #5
0
  public void testRestartButtonScriptPosition() {
    ArrayList<Integer> scriptPositionsStart = new ArrayList<Integer>();
    ArrayList<Integer> scriptPositionsRestart = new ArrayList<Integer>();
    scriptPositionsStart.clear();
    scriptPositionsRestart.clear();

    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);

    ProjectManager projectManager = ProjectManager.getInstance();
    Project projectStart = projectManager.getCurrentProject();

    String projectNameStart = projectStart.getName();

    // scriptPositions at start
    List<Sprite> spriteList = projectStart.getSpriteList();
    for (int i = 0; i < spriteList.size(); i++) {
      Sprite sprite = spriteList.get(i);
      int size = sprite.getNumberOfScripts();
      for (int j = 0; j < size; j++) {
        scriptPositionsRestart.add(sprite.getScript(j).getExecutingBrickIndex());
      }
    }
    spriteList.clear();

    solo.clickOnScreen(Values.SCREEN_WIDTH / 2, Values.SCREEN_HEIGHT / 2);
    solo.sleep(200);
    solo.goBack();
    solo.sleep(100);
    solo.clickOnButton(getActivity().getString(R.string.restart_current_project));
    solo.sleep(300);

    // scriptPositions in between
    Project projectRestart = ProjectManager.getInstance().getCurrentProject();
    String projectNameRestart = projectRestart.getName();

    assertEquals("Wrong project after restart", projectNameStart, projectNameRestart);

    spriteList = projectRestart.getSpriteList();
    for (int i = 0; i < spriteList.size(); i++) {
      Sprite sprite = spriteList.get(i);
      int size = sprite.getNumberOfScripts();
      for (int j = 0; j < size; j++) {
        scriptPositionsRestart.add(sprite.getScript(j).getExecutingBrickIndex());
      }
    }

    for (int i = 0; i < scriptPositionsStart.size(); i++) {
      assertEquals(
          "Script is not at starting position!",
          scriptPositionsStart.get(i).intValue(),
          scriptPositionsRestart.get(i).intValue());
    }
  }
Beispiel #6
0
  public void testRestartProjectWithSound() {
    String projectName = UiTestUtils.PROJECTNAME1;
    // creating sprites for project:
    Sprite firstSprite = new Sprite("sprite1");
    Script startScript = new StartScript(firstSprite);

    PlaySoundBrick playSoundBrick = new PlaySoundBrick(firstSprite);

    startScript.addBrick(playSoundBrick);

    firstSprite.addScript(startScript);

    ArrayList<Sprite> spriteList = new ArrayList<Sprite>();
    spriteList.add(firstSprite);
    Project project = UiTestUtils.createProject(projectName, spriteList, getActivity());

    File soundFile =
        UiTestUtils.saveFileToProject(
            projectName,
            "soundfile.mp3",
            at.tugraz.ist.catroid.uitest.R.raw.longsound,
            getInstrumentation().getContext(),
            UiTestUtils.FileTypes.SOUND);

    SoundInfo soundInfo = new SoundInfo();
    soundInfo.setSoundFileName(soundFile.getName());
    soundInfo.setTitle(soundFile.getName());
    playSoundBrick.setSoundInfo(soundInfo);

    firstSprite.getSoundList().add(soundInfo);

    storageHandler.saveProject(project);

    MediaPlayer mediaPlayer = SoundManager.getInstance().getMediaPlayer();
    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    assertTrue("Sound not playing.", mediaPlayer.isPlaying());
    int positionBeforeRestart = mediaPlayer.getCurrentPosition();
    solo.goBack();
    solo.sleep(500);
    assertFalse("Sound playing but should be paused.", mediaPlayer.isPlaying());
    solo.clickOnButton(getActivity().getString(R.string.restart_current_project));
    solo.sleep(300);
    @SuppressWarnings("unchecked")
    ArrayList<MediaPlayer> mediaPlayerArrayList =
        (ArrayList<MediaPlayer>)
            UiTestUtils.getPrivateField("mediaPlayers", SoundManager.getInstance());
    int positionAfterRestart = mediaPlayerArrayList.get(0).getCurrentPosition();
    assertTrue("Sound not playing after stage restart.", mediaPlayerArrayList.get(0).isPlaying());
    assertTrue("Sound did not play from start!", positionBeforeRestart > positionAfterRestart);
  }
  public void test01ShouldShowMissingFileDialogIfNoFileTransferRequestAvailable() {
    openReceiveFileDialog();

    solo.sleep(500);
    checkDialogMessage("Unable to find the specified file transfer request");
    checkThatTheDialogIsInFront();

    solo.clickOnText("OK"); // Close dialog

    solo.sleep(500);
    checkThatTheMainChatIsInFront();
    checkThatNoFileTransferNotificationsAreActive();
  }
Beispiel #8
0
 public void testAxesOnOff() throws NameNotFoundException, IOException {
   createAndSaveTestProject(testProject);
   solo.clickOnButton(getActivity().getString(R.string.my_projects));
   solo.waitForActivity(MyProjectsActivity.class.getSimpleName());
   solo.waitForFragmentById(R.id.fr_projects_list);
   assertTrue("Cannot click project.", UiTestUtils.clickOnTextInList(solo, testProject));
   solo.waitForActivity(ProjectActivity.class.getSimpleName());
   UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
   solo.waitForActivity(StageActivity.class.getSimpleName());
   solo.goBack();
   solo.clickOnButton(getActivity().getString(R.string.stagemenu_axes_on));
   solo.clickOnButton(getActivity().getString(R.string.resume_current_project));
   solo.sleep(100);
   byte[] redPixel = {(byte) 255, 0, 0, (byte) 255};
   byte[] stagePixel =
       StageActivity.stageListener.getPixels(
           Values.SCREEN_WIDTH / 2, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(redPixel, stagePixel);
   stagePixel = StageActivity.stageListener.getPixels(Values.SCREEN_WIDTH / 2, 0, 1, 1);
   UiTestUtils.compareByteArrays(redPixel, stagePixel);
   stagePixel =
       StageActivity.stageListener.getPixels(
           Values.SCREEN_WIDTH - 1, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(redPixel, stagePixel);
   stagePixel = StageActivity.stageListener.getPixels(0, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(redPixel, stagePixel);
   stagePixel =
       StageActivity.stageListener.getPixels(Values.SCREEN_WIDTH / 2, Values.SCREEN_HEIGHT, 1, 1);
   UiTestUtils.compareByteArrays(redPixel, stagePixel);
   solo.goBack();
   solo.clickOnButton(getActivity().getString(R.string.stagemenu_axes_off));
   solo.clickOnButton(getActivity().getString(R.string.resume_current_project));
   solo.sleep(100);
   byte[] whitePixel = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
   stagePixel =
       StageActivity.stageListener.getPixels(
           Values.SCREEN_WIDTH / 2, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(whitePixel, stagePixel);
   stagePixel = StageActivity.stageListener.getPixels(Values.SCREEN_WIDTH / 2, 0, 1, 1);
   UiTestUtils.compareByteArrays(whitePixel, stagePixel);
   stagePixel =
       StageActivity.stageListener.getPixels(
           Values.SCREEN_WIDTH - 1, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(whitePixel, stagePixel);
   stagePixel = StageActivity.stageListener.getPixels(0, Values.SCREEN_HEIGHT / 2, 1, 1);
   UiTestUtils.compareByteArrays(whitePixel, stagePixel);
   stagePixel =
       StageActivity.stageListener.getPixels(Values.SCREEN_WIDTH / 2, Values.SCREEN_HEIGHT, 1, 1);
   UiTestUtils.compareByteArrays(whitePixel, stagePixel);
 }
 public void selectCostume(String newCostume, String oldName, String costumeImagePath) {
   solo.clickOnText(oldName);
   solo.clickOnText(newCostume);
   UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
   solo.sleep(5000);
   solo.waitForActivity(StageActivity.class.getSimpleName());
   solo.sleep(2000);
   String costumePath = ProjectManager.getInstance().getCurrentSprite().costume.getImagePath();
   assertEquals(
       "Wrong image shown in stage --> Problem with Adapter update in Script",
       costumeImagePath,
       costumePath);
   solo.goBack();
   solo.goBack();
 }
 public void selectLook(String newLook, String oldName, String lookImagePath) {
   solo.clickOnText(oldName);
   solo.clickOnText(newLook);
   UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
   solo.sleep(5000);
   solo.waitForActivity(StageActivity.class.getSimpleName());
   solo.sleep(2000);
   String lookPath = ProjectManager.getInstance().getCurrentSprite().look.getImagePath();
   assertEquals(
       "Wrong image shown in stage --> Problem with Adapter update in Script",
       lookImagePath,
       lookPath);
   solo.goBack();
   solo.goBack();
 }
  public void test08ConcurrentFileTransfers() throws IOException {
    checkThatTheFilesHaveNotBeenTransferred();

    albert.changeNickName("Albino");
    tina.changeNickName("TinaBurger");
    xen.changeNickName("XenXei");
    solo.sleep(500);

    albert.sendFile(me, image.getFile());
    solo.sleep(500);
    checkActiveFileTransferNotifications(7);

    xen.sendFile(me, image.getFile());
    solo.sleep(500);
    checkActiveFileTransferNotifications(7, 8);

    tina.sendFile(me, image.getFile());
    solo.sleep(500);
    checkActiveFileTransferNotifications(7, 8, 9);

    checkMainChatMessage("*** Albino is trying to send the file kouchat-1600x1600.png");
    checkMainChatMessage("*** TinaBurger is trying to send the file kouchat-1600x1600.png");
    checkMainChatMessage("*** XenXei is trying to send the file kouchat-1600x1600.png");

    openReceiveFileDialog(albert, 7);
    acceptFileTransfer();
    solo.sleep(100);

    openReceiveFileDialog(xen, 8);
    acceptFileTransfer();
    solo.sleep(100);

    openReceiveFileDialog(tina, 9);
    acceptFileTransfer();
    solo.sleep(1000);

    checkThatTheMainChatIsInFront();
    checkThatNoFileTransferNotificationsAreActive();

    // Depending on screen size, some of the messages might have scrolled by, currently making them
    // invisible.
    checkPastMainChatMessage("*** Receiving kouchat-1600x1600.png from Albino");
    checkPastMainChatMessage(
        "*** Successfully received kouchat-1600x1600.png from Albino, and saved as kouchat-1600x1600.png");

    checkPastMainChatMessage("*** Receiving kouchat-1600x1600.png from XenXei");
    checkPastMainChatMessage(
        "*** Successfully received kouchat-1600x1600.png from XenXei, and saved as kouchat-1600x1600_1.png");

    checkMainChatMessage("*** Receiving kouchat-1600x1600.png from TinaBurger");
    checkMainChatMessage(
        "*** Successfully received kouchat-1600x1600.png from TinaBurger, and saved as kouchat-1600x1600_2.png");

    checkThatTheFileWasReceivedSuccessfully(requestedFile);
    checkThatTheFileWasReceivedSuccessfully(requestedFile1);
    checkThatTheFileWasReceivedSuccessfully(requestedFile2);
    solo.sleep(500);
  }
  public void testAdapterUpdateInScriptActivity() {
    String costume1ImagePath = costumeDataList.get(0).getAbsolutePath();
    String costume2ImagePath = costumeDataList.get(1).getAbsolutePath();
    solo.clickOnText(getActivity().getString(R.string.broadcast_nothing_selected));
    solo.clickOnText(costumeName);

    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    String costumePath =
        ProjectManager.getInstance()
            .getCurrentSprite()
            .getCostumeDataList()
            .get(0)
            .getAbsolutePath();
    assertEquals(
        "Wrong image shown in stage --> Problem with Adapter update in Script",
        costume1ImagePath,
        costumePath);
    solo.goBack();
    solo.sleep(500);
    solo.goBack();
    for (int i = 0; i < 5; i++) {
      selectCostume(costumeName2, costumeName, costume2ImagePath);
      selectCostume(costumeName, costumeName2, costume1ImagePath);
    }
  }
 @MediumTest
 public void testShouldShowLightweightTag() throws Exception {
   startActivitySync(tagViewerIntentFor(gitdir, "lightweight-tag-of-2nd-commit"));
   solo.sleep(500);
   poseForScreenshot();
   assertTrue(solo.searchText("0d2489a0"));
 }
  public void test04CancelFileTransferRequestBeforeOpeningActivity() {
    checkThatTheFilesHaveNotBeenTransferred();

    xen.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** Xen is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(3);
    solo.sleep(500);

    xen.cancelFileSending(me, image.getFile());

    solo.sleep(1000);
    checkMainChatMessage("*** Xen aborted sending of kouchat-1600x1600.png");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFilesHaveNotBeenTransferred();
  }
  public void testSimple() {
    solo.waitForActivity(PreStageActivity.class.getSimpleName());

    Intent intent = new Intent(getActivity(), StageActivity.class);
    getActivity().startActivity(intent);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(500);
    assertEquals("wrong execution index. ", 0, testScript.getExecutingBrickIndex());
    assertEquals("isFinished is wrong. ", false, testScript.isFinished());
    solo.sleep(2300);
    assertEquals("wrong execution index. ", 1, testScript.getExecutingBrickIndex());
    assertEquals("isFinished is wrong. ", false, testScript.isFinished());
    solo.sleep(2000);
    assertEquals("wrong execution index. ", 1, testScript.getExecutingBrickIndex());
    assertEquals("isFinished is wrong. ", true, testScript.isFinished());
  }
 @MediumTest
 public void testShouldShowAnnotatedTag() throws Exception {
   startActivitySync(tagViewerIntentFor(gitdir, "annotated-tag-of-2nd-commit"));
   solo.sleep(500);
   poseForScreenshot();
   assertTrue(solo.searchText("I even like the 2nd commit, I am tagging it"));
   assertTrue(solo.searchText("Adding my happy folder with it's tags"));
 }
  public void test05CancelFileTransferRequestBeforeRejecting() {
    checkThatTheFilesHaveNotBeenTransferred();

    xen.changeNickName("XenMaster");
    solo.sleep(500);

    xen.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** XenMaster is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(4);
    solo.sleep(500);

    openReceiveFileDialog(xen, 4);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "XenMaster is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    xen.cancelFileSending(me, image.getFile());
    solo.sleep(500);

    rejectFileTransfer();
    solo.sleep(500);

    checkThatTheMainChatIsInFront();
    checkMainChatMessage("*** XenMaster aborted sending of kouchat-1600x1600.png");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFilesHaveNotBeenTransferred();
  }
Beispiel #18
0
  public void test02_SetTest() {
    Activity testActivity = mSolo.getCurrentActivity();
    mSolo.assertCurrentActivity("Not SspDebugModeActivity Class", SspDebugModeActivity.class);

    mSolo.sleep(EmOperate.TIME_LONG);
    if (!mSolo.isCheckBoxChecked(0)) {
      mSolo.clickOnCheckBox(0);
      mSolo.sleep(EmOperate.TIME_LONG);
      mSolo.clickOnButton(0);

      mSolo.sleep(EmOperate.TIME_SUPER_LONG);

      BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
      // BluetoothAdapterEx adapterEx = BluetoothAdapterEx.getDefaultAdapterEx();
      // adapterEx.setSSPDebugMode(false);
      mSolo.sleep(EmOperate.TIME_SUPER_LONG);
      mSolo.sleep(EmOperate.TIME_SUPER_LONG);
      mSolo.sleep(EmOperate.TIME_SUPER_LONG);
      if (BluetoothAdapter.STATE_OFF != adapter.getState()) {
        adapter.disable();
        int jumpCount = 0;
        while ((BluetoothAdapter.STATE_OFF != adapter.getState()) && (jumpCount++ < 15)) {
          EmOperate.waitSomeTime(EmOperate.TIME_SUPER_LONG);
        }
      }
    } else {

      mSolo.sleep(EmOperate.TIME_SUPER_LONG);
      mSolo.clickOnCheckBox(0);
      mSolo.sleep(EmOperate.TIME_LONG);

      mSolo.goBack();
    }
  }
  public void test06CancelFileTransferRequestBeforeAccepting() {
    checkThatTheFilesHaveNotBeenTransferred();

    tina.changeNickName("SuperTina");
    solo.sleep(500);

    tina.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** SuperTina is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(5);
    solo.sleep(500);

    openReceiveFileDialog(tina, 5);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "SuperTina is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    tina.cancelFileSending(me, image.getFile());
    solo.sleep(500);

    acceptFileTransfer();
    solo.sleep(500);

    checkThatTheMainChatIsInFront();
    checkMainChatMessage("*** SuperTina aborted sending of kouchat-1600x1600.png");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFilesHaveNotBeenTransferred();
  }
  /**
   * The first walkthrough. Documented on the wiki. Starts on the login, ends up navigating to a
   * lesson after logging in.
   */
  @Test
  public void testWalkthroughLoginToDashboardToCoursesToCourseToLesson() {
    // Login first
    EditText user = solo.getEditText(0);
    EditText pass = solo.getEditText(1);
    solo.typeText(user, "*****@*****.**");
    solo.typeText(pass, "password");
    solo.clickOnButton(solo.getString(com.huskysoft.eduki.R.string.login));
    // Need to sleep to allow the activity to finish
    solo.sleep(8000);
    solo.assertCurrentActivity("Wrong activity", MainActivity.class);

    // Click on the all courses button
    solo.clickOnActionBarItem(com.huskysoft.eduki.R.id.action_courses);
    solo.sleep(1000);
    solo.assertCurrentActivity("Did not start the Course list Activity", CoursesListActivity.class);

    // Wait for the courses list to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.courseListView));
    solo.sleep(1000);
    List<Course> courseList = ((CoursesListActivity) solo.getCurrentActivity()).getCourseList();
    assertNotSame(courseList.size(), 0);
    solo.clickOnText("INTRODUCTION");
    solo.assertCurrentActivity("Wrong activity", CourseActivity.class);

    // Wait for the course page to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.course_activity));
    solo.sleep(1000);

    // Click a lesson, wait for it to appear
    List<Lesson> lessonList = ((CourseActivity) solo.getCurrentActivity()).getLessonList();
    assertNotSame(lessonList.size(), 0);
    solo.clickOnText(lessonList.get(0).toString());

    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.lessonViewLayoutText));
    solo.sleep(1000);
    String content =
        ((TextView)
                solo.getCurrentActivity()
                    .findViewById(com.huskysoft.eduki.R.id.lessonViewLayoutText))
            .getText()
            .toString();
    assertFalse(content.equals(""));
  }
  public void test07CloseAndReopenDialog() {
    checkThatTheFilesHaveNotBeenTransferred();

    albert.changeNickName("Alban");
    solo.sleep(500);

    albert.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** Alban is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(6);
    solo.sleep(500);

    // First try
    openReceiveFileDialog(albert, 6);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "Alban is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    // Close dialog without accepting or rejecting
    solo.goBack();
    solo.sleep(500);

    checkThatTheMainChatIsInFront();
    checkActiveFileTransferNotifications(6); // The notification should still be there

    // Second try
    openReceiveFileDialog(albert, 6);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "Alban is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    rejectFileTransfer();
    solo.sleep(500);

    checkThatTheMainChatIsInFront();
    checkMainChatMessage("*** You declined to receive kouchat-1600x1600.png from Alban");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFilesHaveNotBeenTransferred();
  }
  public void test09UserLoggingOffShouldCancelFileTransferRequest() {
    checkThatTheFilesHaveNotBeenTransferred();

    tina.changeNickName("TinaTurner");
    solo.sleep(500);

    tina.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** TinaTurner is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(10);
    solo.sleep(500);

    tina.logoff();
    solo.sleep(1000);

    checkMainChatMessage("*** TinaTurner logged off");
    checkThatNoFileTransferNotificationsAreActive();
  }
 public void testAddCourseScreenOriantationChange() {
   ListView listView;
   solo.clickOnView(getActivity().findViewById(R.id.add));
   solo.enterText(0, "Course");
   solo.clickOnEditText(0);
   solo.sendKey(Solo.ENTER);
   solo.waitForText("THE COURSE #2", 1, 5);
   listView = (ListView) solo.getView(android.R.id.list);
   assertEquals("List view should contain 2 items before doing anything", 2, listView.getCount());
   solo.setActivityOrientation(Solo.LANDSCAPE);
   solo.sleep(500);
   listView = (ListView) solo.getView(android.R.id.list);
   solo.sleep(3000);
   assertEquals("List view should't change size after oriantation change", 2, listView.getCount());
   assertEquals(
       "SearchView should not reset.", "Course", solo.getEditText(0).getText().toString());
   solo.goBack();
   solo.goBack();
 }
Beispiel #24
0
  public void afterRestart() {
    solo.setActivityOrientation(Solo.PORTRAIT);
    solo.sleep(SLEEP_AFTER_RESTART);
    waitOnThrobber();
    if (PRECRAWLING.length > 0) {
      refreshCurrentActivity();
      retrieveWidgets();
      processPrecrawling();
    }

    Log.d("nofatclips", "Ready to operate after restarting...");
  }
  public void test03AcceptFileTransferRequest() throws IOException {
    checkThatTheFilesHaveNotBeenTransferred();

    albert.sendFile(me, image.getFile());
    solo.sleep(500);

    checkMainChatMessage("*** Albert is trying to send the file kouchat-1600x1600.png");
    checkActiveFileTransferNotifications(2);
    solo.sleep(500);

    openReceiveFileDialog(albert, 2);
    solo.sleep(500);

    checkThatTheDialogIsInFront();
    checkDialogMessage(
        "Albert is trying to send you the file ‘kouchat-1600x1600.png’ (67.16KB). "
            + "Do you want to accept the file transfer?");
    solo.sleep(500);

    acceptFileTransfer();
    solo.sleep(1000);

    checkThatTheMainChatIsInFront();
    checkMainChatMessage("*** Receiving kouchat-1600x1600.png from Albert");
    checkMainChatMessage(
        "*** Successfully received kouchat-1600x1600.png from Albert, and saved as kouchat-1600x1600.png");
    checkThatNoFileTransferNotificationsAreActive();
    checkThatTheFileWasReceivedSuccessfully(requestedFile);
    solo.sleep(500);
  }
Beispiel #26
0
  public void testBackButtonPressedTwice() throws NameNotFoundException, IOException {
    Project project = createTestProject(testProject);
    ProjectManager.getInstance().setProject(project);

    UiTestUtils.clickOnActionBar(solo, R.id.menu_start);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    solo.goBack();

    solo.goBack();
    solo.waitForActivity(MainMenuActivity.class.getSimpleName());
    solo.assertCurrentActivity("Program is not in stage activity", MainMenuActivity.class);
  }
Beispiel #27
0
 // TODO: With Robotium 4.2, we should use Condition and waitForCondition instead.
 // Future boolean tests should not use this method.
 protected final boolean waitForTest(BooleanTest t, int timeout) {
   long end = SystemClock.uptimeMillis() + timeout;
   while (SystemClock.uptimeMillis() < end) {
     if (t.test()) {
       return true;
     }
     mSolo.sleep(100);
   }
   // log out wait failure for diagnostic purposes only;
   // a failed wait may be normal and does not necessarily
   // warrant a test assertion/failure
   mAsserter.dumpLog("waitForTest timeout after " + timeout + " ms");
   return false;
 }
Beispiel #28
0
  // Generated from trace 753
  public void testTrace00001() {

    // Testing base activity
    retrieveWidgets();
    // Testing current activity: should be a1
    solo.assertCurrentActivity("Testing base activity", "Dashboard");

    // Testing transition
    // Firing event: e757
    fireEvent(0, "", "null", "openMenu");

    // This event leads to fail
    solo.sleep(SLEEP_AFTER_TASK);
  }
  public void testSelectLookAndPlay() {
    assertTrue(lookName + " is not selected in Spinner", solo.isSpinnerTextSelected(lookName));

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    Look look = ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).look;
    assertEquals("look not set", look.getImagePath(), lookDataList.get(0).getAbsolutePath());
    solo.goBack();
    solo.goBack();
    solo.waitForActivity(ScriptActivity.class.getSimpleName());

    solo.clickOnText(lookName);
    solo.clickOnText(lookName2);
    assertTrue(lookName2 + " is not selected in Spinner", solo.searchText(lookName2));

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    look = ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).look;
    assertEquals("look not set", look.getImagePath(), lookDataList.get(1).getAbsolutePath());
  }
  @SuppressLint("DefaultLocale")
  public void testXidioLoginErrorMessagePos() {

    assertTrue(solo.waitForActivity(TestConstants.FIRST_RUN));
    solo.sleep(TestConstants.SLEEP_TIME_1000);
    if (!Build.MODEL.toLowerCase(Locale.US).contains("comcast")) {

      solo.enterText(
          (EditText)
              solo.getCurrentActivity().findViewById(com.xfinity.xidio.R.id.first_run_username),
          TestConstants.WRONG_USERNAME);
      solo.enterText(
          (EditText)
              solo.getCurrentActivity().findViewById(com.xfinity.xidio.R.id.first_run_password),
          TestConstants.PASSWORD);
      solo.sleep(TestConstants.SLEEP_TIME_500);
      solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
      solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
      solo.sendKey(KeyEvent.KEYCODE_DPAD_CENTER);
      solo.sleep(TestConstants.SLEEP_TIME_2000);
      assertFalse(solo.searchText("Error, check username/password and try again"));
      solo.sleep(TestConstants.SLEEP_TIME_1000);
    }
  }