Search in sources :

Example 6 with AdminCreateClaPage

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

the class AdminCreateClaTests method createClaRequiredFieldsIndividualRequired.

@Test
public void createClaRequiredFieldsIndividualRequired() throws Exception {
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    create = create.form().name("Name").corporate("Corporate").submit(AdminCreateClaPage.class);
    ClaForm form = create.form();
    form.assertName().hasNoErrors().hasValue("Name");
    form.assertCorporateContent().hasNoErrors();
    form.assertIndividualContent().hasRequiredError();
}
Also used : ClaForm(io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 7 with AdminCreateClaPage

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

the class AdminCreateClaTests method createClaInvalidPrimary.

@Test
public void createClaInvalidPrimary() throws Exception {
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    create = create.form().name(cla.getName()).individual("Individual").corporate("Corporate").primary().submit(AdminCreateClaPage.class);
    ClaForm form = create.form();
    form.assertPrimary().hasError("A primary CLA with this name already exists");
}
Also used : ClaForm(io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 8 with AdminCreateClaPage

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

the class AdminCreateClaTests method createClaSuccess.

@Test
public void createClaSuccess() {
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    String individualMd = cla.getIndividualContent().getMarkdown();
    String individualHtml = cla.getIndividualContent().getHtml();
    String corporateMd = cla.getCorporateContent().getMarkdown();
    String corporateHtml = cla.getCorporateContent().getHtml();
    String accessToken = WithAdminUserFactory.create().getAccessToken();
    when(mockGitHub.markdownToHtml(accessToken, individualMd)).thenReturn(individualHtml);
    when(mockGitHub.markdownToHtml(accessToken, corporateMd)).thenReturn(corporateHtml);
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    AdminListClasPage successPage = create.form().name("Eclipse").individual(individualMd).corporate(corporateMd).submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement cla = captor.getValue();
    assertThat(cla.getName()).isEqualTo("Eclipse");
    assertThat(cla.isPrimary()).isFalse();
    assertThat(cla.getDescription()).isNull();
    assertThat(cla.getSupersedingCla()).isNull();
    assertThat(cla.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(cla.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(cla.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(cla.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 9 with AdminCreateClaPage

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

the class AdminCreateClaTests method createClaRequiredFieldsAll.

@Test
public void createClaRequiredFieldsAll() throws Exception {
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    create = create.form().submit(AdminCreateClaPage.class);
    ClaForm form = create.form();
    form.assertName().hasRequiredError();
    form.assertIndividualContent().hasRequiredError();
    form.assertCorporateContent().hasRequiredError();
}
Also used : ClaForm(io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 10 with AdminCreateClaPage

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

the class AdminCreateClaTests method createClaRequiredFieldsCorporateRequired.

@Test
public void createClaRequiredFieldsCorporateRequired() throws Exception {
    AdminCreateClaPage create = AdminCreateClaPage.to(getDriver());
    create = create.form().name("Name").individual("Individual").submit(AdminCreateClaPage.class);
    ClaForm form = create.form();
    form.assertName().hasNoErrors();
    form.assertIndividualContent().hasNoErrors();
    form.assertCorporateContent().hasRequiredError();
}
Also used : ClaForm(io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Aggregations

AdminCreateClaPage (io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage)11 Test (org.junit.Test)11 AdminListClasPage (io.pivotal.cla.webdriver.pages.admin.AdminListClasPage)6 ClaForm (io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm)5 ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)4 HomePage (io.pivotal.cla.webdriver.pages.HomePage)1