コード例 #1
0
test('view profile', function (assert) {
  profilePage.visit({ username: 'feministkilljoy' });

  andThen(function () {
    assert.equal(profilePage.name, 'Sara Ahmed');

    assert.equal(profilePage.accounts().count, 2, 'expected two accounts');

    assert.equal(profilePage.accounts(0).name, 'Sara Ahmed');
    assert.equal(profilePage.accounts(0).repositoryCount, 3);

    assert.equal(profilePage.accounts(1).name, 'Feminist Killjoys');
    assert.equal(profilePage.accounts(1).repositoryCount, 30);

    assert.equal(profilePage.administerableHooks().count, 2, 'expected two administerable hooks');

    assert.equal(profilePage.administerableHooks(0).name, 'feministkilljoy/living-a-feminist-life');
    assert.ok(profilePage.administerableHooks(0).isActive, 'expected active hook to appear active');

    assert.equal(profilePage.administerableHooks(1).name, 'feministkilljoy/willful-subjects');
    assert.notOk(profilePage.administerableHooks(1).isActive, 'expected inactive hook to appear inactive');

    assert.equal(profilePage.unadministerableHooks().count, 1, 'expected one unadministerable hook');
  });
});
コード例 #2
0
test('view repositories', function (assert) {
  withFeature('github-apps');
  profilePage.visit();

  andThen(() => {
    percySnapshot(assert);
    assert.equal(document.title, 'User Name of exceeding length - Profile - Travis CI');

    assert.equal(profilePage.name, 'User Name of exceeding length');
    assert.equal(profilePage.login, '@user-login');

    assert.ok(profilePage.avatar.src.startsWith('http://example.com/jorty'), 'expected avatar URL to have the same beginning');
    assert.ok(profilePage.avatar.checkmark.isVisible, 'expected avatar to have a checkmark for active subscription');

    assert.ok(profilePage.subscriptionStatus.isHidden, 'expected no subscription status banner');

    assert.equal(profilePage.accounts.length, 12, 'expected all accounts to be listed');

    assert.equal(profilePage.accounts[0].name, 'User Name of exceeding length');
    assert.ok(profilePage.accounts[0].avatar.checkmark.isVisible, 'expected a subscription checkmark for user account');

    assert.equal(profilePage.accounts[1].name, 'Org Name');
    assert.ok(profilePage.accounts[1].avatar.checkmark.isHidden, 'expected no subscription checkmark for org account');

    assert.ok(profilePage.accounts[11].avatar.checkmark.isVisible, 'expected a subscription checkmark for the last org account');

    assert.notOk(profilePage.githubAppsInvitation.isVisible, 'expected GitHub Apps invitation not to be visible');

    assert.ok(profilePage.deprecatedBadge.isVisible, 'expected deprecated badge to be visible');
    assert.equal(profilePage.administerableRepositories.length, 2, 'expected two classic repositories, with inactive repositories hidden');

    assert.equal(profilePage.administerableRepositories[0].name, 'other-repository-name');
    assert.ok(profilePage.administerableRepositories[0].isDisabled, 'expected disabled repository to be disabled in UI');
    assert.equal(profilePage.administerableRepositories[1].name, 'repository-name');
    assert.ok(profilePage.administerableRepositories[1].isActive, 'expected active repository to appear active');

    assert.equal(profilePage.githubAppsRepositories.length, 3, 'expected three GitHub Apps-managed repositories');

    assert.equal(profilePage.notLockedGithubAppsRepositories.length, 2, 'expected two not-locked GitHub Apps-managed repositories');

    profilePage.notLockedGithubAppsRepositories[0].as(repository => {
      assert.equal(repository.name, 'github-apps-private-repository');
      assert.ok(repository.isPrivate);
      assert.ok(repository.settings.isDisabled);
    });

    profilePage.notLockedGithubAppsRepositories[1].as(repository => {
      assert.equal(repository.name, 'github-apps-public-repository');
      assert.ok(repository.isPublic);
      assert.notOk(repository.settings.isDisabled);
    });

    assert.equal(profilePage.lockedGithubAppsRepositories.length, 1, 'expected one locked GitHub Apps-managed repository');
    assert.equal(profilePage.lockedGithubAppsRepositories[0].name, 'github-apps-locked-repository');
  });
});
コード例 #3
0
test('displays an error banner when subscription status cannot be determined', function (assert) {
  server.get('/subscriptions', function (schema) {
    return new Response(500, {}, {});
  });

  profilePage.visit();

  andThen(() => {
    assert.equal(profilePage.subscriptionStatus.text, 'There was an error determining your subscription status.');
  });
});
コード例 #4
0
test('view profiles when GitHub Apps is not present', function (assert) {
  profilePage.visitOrganization({ name: 'org0' });

  andThen(() => {
    assert.notOk(profilePage.githubAppsInvitation.isVisible, 'expected GitHub Apps invitation to not be visible');
    assert.notOk(profilePage.deprecatedBadge.isVisible, 'expected deprecated badge to not be visible');
  });

  profilePage.visit();

  andThen(() => {
    assert.equal(profilePage.administerableRepositories.length, 3, 'expected inactive repositories to also show');

    assert.equal(profilePage.administerableRepositories[0].name, 'other-repository-name');
    assert.ok(profilePage.administerableRepositories[0].isDisabled, 'expected disabled repository to be disabled in UI');
    assert.equal(profilePage.administerableRepositories[2].name, 'yet-another-repository-name');
    assert.notOk(profilePage.administerableRepositories[2].isActive, 'expected inactive repository to appear inactive');
  });
});
コード例 #5
0
test('logs an exception when there is more than one active subscription', function (assert) {
  assert.expect(1);

  server.create('subscription', {
    owner: this.user,
    status: 'subscribed'
  });

  let mockSentry = Service.extend({
    logException(error) {
      assert.equal(error.message, 'Account user-login has more than one active subscription!');
    },
  });

  const instance = this.application.__deprecatedInstance__;
  const registry = instance.register ? instance : instance.registry;
  registry.register('service:raven', mockSentry);

  profilePage.visit();
});
コード例 #6
0
ファイル: sync-test.js プロジェクト: Robdel12/travis-web
test('trigger sync', function (assert) {
  let done = assert.async();

  profilePage.visit();

  andThen(() => {
    assert.equal(profilePage.syncButton.lastSynced, 'Last synced 2 years ago');
    assert.equal(profilePage.syncButton.text, 'Sync account');
  });

  let syncCalled = false;

  server.post(`/user/${this.user.id}/sync`, () => {
    this.user.is_syncing = true;
    this.user.save();
    syncCalled = true;
  });

  profilePage.syncButton.click();

  andThen(() => {
    assert.equal(profilePage.syncButton.text, 'Syncing from GitHub');
    assert.ok(syncCalled, 'expected sync endpoint to have been posted to');

    this.user.is_syncing = false;
    this.user.synced_at = new Date();
    this.user.save();
  });

  andThen(() => {
    setTimeout(() => {
      assert.equal(profilePage.syncButton.text, 'Sync account');
      assert.equal(profilePage.syncButton.lastSynced, 'Last synced less than a minute ago');

      done();
    }, config.intervals.syncingPolling);
  });
});