Search in sources :

Example 6 with AdminListClasPage

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

the class EditAdminClaTests method navigateToEditCla.

@Test
public void navigateToEditCla() {
    when(mockClaRepository.findOne(cla.getId())).thenReturn(cla);
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    HomePage homePage = HomePage.go(driver);
    AdminListClasPage manage = homePage.manage();
    manage.assertAt();
    AdminEditClaPage edit = manage.row(0).edit();
    edit.assertAt();
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) HomePage(io.pivotal.cla.webdriver.pages.HomePage) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) Test(org.junit.Test)

Example 7 with AdminListClasPage

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

the class EditAdminClaTests method editClaSuccessPrimaryExistingButSameId.

@Test
public void editClaSuccessPrimaryExistingButSameId() {
    cla.setId(new Long(1L));
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    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);
    AdminEditClaPage create = AdminEditClaPage.to(getDriver(), cla.getId());
    AdminListClasPage successPage = create.form().corporate(corporateMd).primary().submit(AdminListClasPage.class);
    successPage.assertAt();
    ArgumentCaptor<ContributorLicenseAgreement> captor = ArgumentCaptor.forClass(ContributorLicenseAgreement.class);
    verify(mockClaRepository).save(captor.capture());
    ContributorLicenseAgreement saved = captor.getValue();
    assertThat(saved.getName()).isEqualTo(cla.getName());
    assertThat(saved.isPrimary()).isTrue();
    assertThat(saved.getIndividualContent().getHtml()).isEqualTo(individualHtml);
    assertThat(saved.getIndividualContent().getMarkdown()).isEqualTo(individualMd);
    assertThat(saved.getCorporateContent().getHtml()).isEqualTo(corporateHtml);
    assertThat(saved.getCorporateContent().getMarkdown()).isEqualTo(corporateMd);
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) AdminEditClaPage(io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage) Test(org.junit.Test)

Example 8 with AdminListClasPage

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

the class AdminCreateClaTests method navigateToCreateCla.

@Test
public void navigateToCreateCla() {
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    HomePage homePage = HomePage.go(driver);
    AdminListClasPage manage = homePage.manage();
    manage.assertAt();
    AdminCreateClaPage create = manage.createCla();
    create.assertAt();
}
Also used : AdminListClasPage(io.pivotal.cla.webdriver.pages.admin.AdminListClasPage) HomePage(io.pivotal.cla.webdriver.pages.HomePage) AdminCreateClaPage(io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage) Test(org.junit.Test)

Example 9 with AdminListClasPage

use of io.pivotal.cla.webdriver.pages.admin.AdminListClasPage 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 10 with AdminListClasPage

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

the class AdminCreateClaTests method createClaSuccessSuperseding.

@Test
public void createClaSuccessSuperseding() {
    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).supersedingCla(cla.getId()).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.getSupersedingCla()).isSameAs(this.cla);
    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)

Aggregations

AdminListClasPage (io.pivotal.cla.webdriver.pages.admin.AdminListClasPage)14 Test (org.junit.Test)14 ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)9 AdminCreateClaPage (io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage)6 AdminEditClaPage (io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage)6 HomePage (io.pivotal.cla.webdriver.pages.HomePage)2 Row (io.pivotal.cla.webdriver.pages.admin.AdminListClasPage.Row)2