Search in sources :

Example 11 with SignIclaPage

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();
}
Also used : SignClaForm(io.pivotal.cla.mvc.SignClaForm) Form(io.pivotal.cla.webdriver.pages.SignIclaPage.Form) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) SignClaForm(io.pivotal.cla.mvc.SignClaForm) Test(org.junit.Test)

Example 12 with SignIclaPage

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();
}
Also used : SignClaForm(io.pivotal.cla.mvc.SignClaForm) Form(io.pivotal.cla.webdriver.pages.SignIclaPage.Form) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) SignClaForm(io.pivotal.cla.mvc.SignClaForm) Test(org.junit.Test)

Example 13 with SignIclaPage

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);
}
Also used : AccessToken(io.pivotal.cla.data.AccessToken) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) PullRequestStatus(io.pivotal.cla.service.github.PullRequestStatus) Test(org.junit.Test)

Example 14 with SignIclaPage

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());
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) Test(org.junit.Test)

Example 15 with SignIclaPage

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();
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignIclaPage(io.pivotal.cla.webdriver.pages.SignIclaPage) Test(org.junit.Test)

Aggregations

SignIclaPage (io.pivotal.cla.webdriver.pages.SignIclaPage)17 Test (org.junit.Test)17 SignClaForm (io.pivotal.cla.mvc.SignClaForm)8 Form (io.pivotal.cla.webdriver.pages.SignIclaPage.Form)4 SignClaPage (io.pivotal.cla.webdriver.pages.SignClaPage)3 ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)2 WithSigningUser (io.pivotal.cla.security.WithSigningUser)2 AccessToken (io.pivotal.cla.data.AccessToken)1 PullRequestStatus (io.pivotal.cla.service.github.PullRequestStatus)1 AdminLinkClaPage (io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage)1 GitHubLoginPage (io.pivotal.cla.webdriver.pages.github.GitHubLoginPage)1 GitHubPullRequestPage (io.pivotal.cla.webdriver.pages.github.GitHubPullRequestPage)1