Search in sources :

Example 11 with SignCclaPage

use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests method signFormSupersedingCla.

@Test
public void signFormSupersedingCla() {
    ContributorLicenseAgreement springCla = DataUtils.createSpringCla();
    springCla.setSupersedingCla(cla);
    when(mockClaRepository.findByNameAndPrimaryTrue(springCla.getName())).thenReturn(springCla);
    SignCclaPage signPage = SignCclaPage.go(getDriver(), springCla.getName());
    signPage.assertClaLink(springCla.getName());
    assertThat(signPage.getCorporate()).isEqualTo(cla.getCorporateContent().getHtml());
    assertThat(signPage.isSigned()).isFalse();
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 12 with SignCclaPage

use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests 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);
    SignCclaPage signPage = SignCclaPage.go(getDriver(), springCla.getName());
    signPage = signPage.form().sign(SignCclaPage.class);
    signPage.assertClaLink(springCla.getName());
    assertThat(signPage.getCorporate()).isEqualTo(cla.getCorporateContent().getHtml());
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 13 with SignCclaPage

use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests method fieldsRepopulatedOnError.

@Test
public void fieldsRepopulatedOnError() throws Exception {
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
    SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
    signPage = signPage.form().email("rob@gmail.com").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").companyName("Pivotal").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
    signPage.assertAt();
    Form form = signPage.form();
    form.assertEmail().hasValue("rob@gmail.com");
    form.assertMailingAddress().hasValue("123 Seasame St");
    form.assertCountry().hasValue("USA");
    form.assertTelephone().hasValue("123.456.7890");
    form.assertCompanyName().hasValue("Pivotal");
    form.assertGitHubOrganization().hasValue("pivotal");
    form.assertTitle().hasValue("Director");
    form.assertConfirm().assertSelected();
    signPage = SignCclaPage.go(getDriver(), cla.getName());
    signPage = signPage.form().name("Rob Winch").sign(SignCclaPage.class);
    signPage.form().assertName().hasValue("Rob Winch");
}
Also used : Form(io.pivotal.cla.webdriver.pages.SignCclaPage.Form) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 14 with SignCclaPage

use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests method signEmailRequired.

@Test
public void signEmailRequired() throws Exception {
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockGitHub.getOrganizations(anyString())).thenReturn(Arrays.asList("spring", "pivotal"));
    SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
    Form form = signPage.form();
    signPage = form.name("Rob Winch").mailingAddress("123 Seasame St").country("USA").telephone("123.456.7890").companyName("Pivotal").gitHubOrganization("pivotal").title("Director").confirm().sign(SignCclaPage.class);
    signPage.assertAt();
    form = signPage.form();
    form.assertName().hasNoErrors();
    form.assertEmail().hasRequiredError();
    form.assertCompanyName().hasNoErrors();
    form.assertGitHubOrganization().hasNoErrors();
    form.assertConfirm().hasNoErrors();
}
Also used : Form(io.pivotal.cla.webdriver.pages.SignCclaPage.Form) SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Example 15 with SignCclaPage

use of io.pivotal.cla.webdriver.pages.SignCclaPage in project pivotal-cla by pivotalsoftware.

the class CclaControllerTests method signForm.

@Test
public void signForm() {
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    SignCclaPage signPage = SignCclaPage.go(getDriver(), cla.getName());
    signPage.assertClaLink(cla.getName());
    assertThat(signPage.getCorporate()).isEqualTo(cla.getCorporateContent().getHtml());
}
Also used : SignCclaPage(io.pivotal.cla.webdriver.pages.SignCclaPage) Test(org.junit.Test)

Aggregations

SignCclaPage (io.pivotal.cla.webdriver.pages.SignCclaPage)19 Test (org.junit.Test)19 Form (io.pivotal.cla.webdriver.pages.SignCclaPage.Form)9 WithSigningUser (io.pivotal.cla.security.WithSigningUser)3 Matchers.anyString (org.mockito.Matchers.anyString)3 ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)2 PullRequestStatus (io.pivotal.cla.service.github.PullRequestStatus)2 SignClaPage (io.pivotal.cla.webdriver.pages.SignClaPage)2 AccessToken (io.pivotal.cla.data.AccessToken)1 CorporateSignature (io.pivotal.cla.data.CorporateSignature)1 User (io.pivotal.cla.data.User)1 Date (java.util.Date)1 WithAnonymousUser (org.springframework.security.test.context.support.WithAnonymousUser)1