use of io.pivotal.cla.webdriver.pages.SignIclaPage in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method fieldsRepopulatedOnError.
@Test
public void fieldsRepopulatedOnError() {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
SignIclaPage signPage = SignIclaPage.go(getDriver(), cla.getName());
SignClaForm signForm = defaultClaForm();
signPage = signPage.form(signForm).sign(SignIclaPage.class);
signPage.assertAt();
Form form = signPage.form();
form.assertName().hasValue(signForm.getName());
form.assertEmail().hasValue(signForm.getEmail());
form.assertMailingAddress().hasValue(signForm.getMailingAddress());
form.assertCountry().hasValue(signForm.getCountry());
form.assertTelephone().hasValue(signForm.getTelephone());
signPage = SignIclaPage.go(getDriver(), cla.getName());
signPage = signPage.form().confirm().sign(SignIclaPage.class);
signPage.form().assertConfirm().assertSelected();
}
use of io.pivotal.cla.webdriver.pages.SignIclaPage in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method signNameRequired.
@Test
public void signNameRequired() {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
SignIclaPage signPage = SignIclaPage.go(getDriver(), cla.getName());
SignClaForm claForm = defaultClaForm();
claForm.setName("");
signPage = signPage.form(claForm).confirm().sign(SignIclaPage.class);
signPage.assertAt();
Form form = signPage.form();
form.assertName().hasRequiredError();
form.assertEmail().hasNoErrors();
form.assertMailingAddress().hasNoErrors();
form.assertCountry().hasNoErrors();
form.assertTelephone().hasNoErrors();
form.assertConfirm().hasNoErrors();
}
use of io.pivotal.cla.webdriver.pages.SignIclaPage in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method signWithRepositoryIdWithPullRequestId.
@Test
@SuppressWarnings("unchecked")
public void signWithRepositoryIdWithPullRequestId() throws Exception {
String repositoryId = "rwinch/176_test";
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
when(mockIndividualSignatureRepository.findSignaturesFor(any(), eq(WithSigningUserFactory.create()), eq(cla.getName()))).thenReturn(Collections.<IndividualSignature>emptyList(), Arrays.asList(individualSignature));
when(mockTokenRepo.findOne(repositoryId)).thenReturn(new AccessToken(repositoryId, "access-token-123"));
when(mockGitHub.getShaForPullRequest(any(PullRequestStatus.class))).thenReturn("abc123");
int pullRequestId = 2;
SignIclaPage signPage = SignIclaPage.go(getDriver(), cla.getName(), repositoryId, pullRequestId);
signPage = signPage.form().name("Rob Winch").email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").confirm().sign(SignIclaPage.class);
signPage.assertAt();
signPage.assertPullRequestLink(repositoryId, pullRequestId);
ArgumentCaptor<PullRequestStatus> updatePullRequestCaptor = ArgumentCaptor.forClass(PullRequestStatus.class);
verify(mockGitHub).save(updatePullRequestCaptor.capture());
PullRequestStatus updatePr = updatePullRequestCaptor.getValue();
String commitStatusUrl = "http://localhost/sign/" + cla.getName() + "?repositoryId=" + repositoryId + "&pullRequestId=" + pullRequestId;
assertThat(updatePr.getUrl()).isEqualTo(commitStatusUrl);
assertThat(updatePr.getGitHubUsername()).isEqualTo(WithSigningUserFactory.create().getGitHubLogin());
assertThat(updatePr.getPullRequestId()).isEqualTo(pullRequestId);
assertThat(updatePr.getRepoId()).isEqualTo(repositoryId);
}
use of io.pivotal.cla.webdriver.pages.SignIclaPage in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method signSupersedingCla.
@Test
public void signSupersedingCla() {
ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
springCla.setSupersedingCla(cla);
when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
SignIclaPage signPage = SignIclaPage.go(getDriver(), springCla.getName());
signPage = signPage.form().sign(SignIclaPage.class);
signPage.assertClaLink(springCla.getName());
assertThat(signPage.getIndividualCla()).isEqualTo(cla.getIndividualContent().getHtml());
}
use of io.pivotal.cla.webdriver.pages.SignIclaPage in project pivotal-cla by pivotalsoftware.
the class IclaControllerTests method signFormSupersedingCla.
@Test
public void signFormSupersedingCla() {
ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
springCla.setSupersedingCla(cla);
when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
SignIclaPage signPage = SignIclaPage.go(getDriver(), springCla.getName());
signPage.assertClaLink(springCla.getName());
assertThat(signPage.getIndividualCla()).isEqualTo(cla.getIndividualContent().getHtml());
assertThat(signPage.isSigned()).isFalse();
}
Aggregations