Search in sources :

Example 1 with Folder

use of org.jenkinsci.test.acceptance.po.Folder in project acceptance-test-harness by jenkinsci.

the class JobDslPluginTest method should_lookup_at_seed_job.

/**
 * Verifies that relative job names are interpreted relative to the folder in which
 * the seed job is located.
 */
@Test
@WithPlugins("cloudbees-folder")
public void should_lookup_at_seed_job() {
    Folder folder = runSeedJobInFolder("New_Job", JobDslLookupStrategy.SEED_JOB);
    FreeStyleJob newJob = getJob("New_Job");
    assertThat(newJob, pageObjectDoesNotExist());
    newJob = folder.getJobs().get(FreeStyleJob.class, "New_Job");
    assertThat(newJob, pageObjectExists());
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 2 with Folder

use of org.jenkinsci.test.acceptance.po.Folder in project acceptance-test-harness by jenkinsci.

the class JobDslPluginTest method runSeedJobInFolder.

/**
 * Creates and executes a seed job in a folder. The seed job generates a new job
 * with the specified lookup strategy.
 * @param jobName The name the job to generate.
 * @param strategy The context to use for relative job names.
 * @return The folder in which the seed job is located.
 */
private Folder runSeedJobInFolder(String jobName, JobDslLookupStrategy strategy) {
    final Folder folder = jenkins.jobs.create(Folder.class, "Folder");
    FreeStyleJob seedJob = folder.getJobs().create(FreeStyleJob.class, "Seed");
    JobDslBuildStep jobDsl = seedJob.addBuildStep(JobDslBuildStep.class);
    jobDsl.setScript("job('" + jobName + "')");
    jobDsl.setLookupStrategy(strategy);
    seedJob.save();
    seedJob.scheduleBuild().shouldSucceed();
    return folder;
}
Also used : JobDslBuildStep(org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder)

Example 3 with Folder

use of org.jenkinsci.test.acceptance.po.Folder in project acceptance-test-harness by jenkinsci.

the class ExtraColumnsPluginTest method should_show_console_link_in_folder.

/**
 * Sets up a job within a folder. Starts a succeeding build. Adds the last console column to a new view
 * and verifies that clicking the link to the last console opens the console log.
 */
@Test
@WithPlugins("cloudbees-folder")
public void should_show_console_link_in_folder() {
    Folder folder = jenkins.jobs.create(Folder.class, createRandomName());
    folder.save();
    folder.open();
    FreeStyleJob job = folder.getJobs().create();
    job.startBuild().waitUntilFinished().shouldSucceed();
    ListView.createWithColumn(folder, LastConsoleColumn.class);
    List<WebElement> links = all(by.link("Last/current build console output"));
    assertThat(links, iterableWithSize(1));
    links.get(0).click();
    assertThat(driver, hasContent("Console Output"));
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) WebElement(org.openqa.selenium.WebElement) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 4 with Folder

use of org.jenkinsci.test.acceptance.po.Folder in project acceptance-test-harness by jenkinsci.

the class JobDslPluginTest method should_lookup_at_jenkins_root.

/**
 * Verifies that relative job names are interpreted relative to the Jenkins root.
 * Even if the seed job is located in a folder, a new generated job is relative
 * to the Jenkins root.
 */
@Test
@WithPlugins("cloudbees-folder")
public void should_lookup_at_jenkins_root() {
    Folder folder = runSeedJobInFolder("New_Job", JobDslLookupStrategy.JENKINS_ROOT);
    FreeStyleJob newJob = getJob("New_Job");
    assertThat(newJob, pageObjectExists());
    newJob = folder.getJobs().get(FreeStyleJob.class, "New_Job");
    assertThat(newJob, pageObjectDoesNotExist());
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 5 with Folder

use of org.jenkinsci.test.acceptance.po.Folder in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_show_warnings_in_folder.

/**
 * Sets up a nested view that contains a dashboard view with a warnings-per-project portlet.
 * Creates a folder in this view and a freestyle job in this folder.
 * Finally checks if the warnings-per-project portlet and warnings column show the
 * correct number of warnings and provide a direct link to the actual warning results.
 */
@Test
@Issue("JENKINS-39947")
@WithPlugins({ "dashboard-view", "nested-view", "cloudbees-folder", "analysis-core@1.87" })
public void should_show_warnings_in_folder() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    NestedView nested = jenkins.getViews().create(NestedView.class);
    DashboardView dashboard = nested.getViews().create(DashboardView.class);
    dashboard.configure(() -> {
        dashboard.matchAllJobs();
        dashboard.checkRecurseIntoFolders();
    });
    Folder folder = dashboard.jobs.create(Folder.class);
    folder.save();
    folder.open();
    FreeStyleJob job = createFreeStyleJob(folder);
    runAndVerifyJobResults(job);
    P projectAction = createProjectAction(job);
    dashboard.configure(() -> {
        dashboard.addBottomPortlet(projectAction.getTablePortlet());
    });
    verifyPortlet(projectAction);
    addListViewColumn(projectAction.getViewColumn(), folder);
    verifyColumn(projectAction);
}
Also used : NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

Folder (org.jenkinsci.test.acceptance.po.Folder)6 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)5 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)5 Test (org.junit.Test)5 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)4 DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)2 NestedView (org.jenkinsci.test.acceptance.plugins.nested_view.NestedView)2 Issue (org.jvnet.hudson.test.Issue)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)1 AnalysisPlugin (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin)1 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)1 GitBranchSource (org.jenkinsci.test.acceptance.plugins.workflow_multibranch.GitBranchSource)1 WorkflowMultiBranchJob (org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob)1 WebElement (org.openqa.selenium.WebElement)1