Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Input text markup removal test (JENKINS-41162)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfennelly committed Feb 2, 2017
1 parent 27c3186 commit 3be4b48
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/js/page_objects/blueocean/bluePipelineActivity.js
Expand Up @@ -17,6 +17,8 @@ module.exports = {
activityTable: '.activity-table',
activityTableEntries: 'table.activity-table tbody tr',
runButton: 'a.run-button',
inputStepContainer: '.inputStep',
inputStepSubmit: '.inputStepSubmit',
toastOpenButton: {
selector: '//div[@class="toast"]/a[@class="action" and text()="Open"]',
locateStrategy: 'xpath',
Expand Down
57 changes: 57 additions & 0 deletions src/test/js/params-inputs/encoded-input-text.js
@@ -0,0 +1,57 @@
/** @module encoded-input-text
* @memberof params-inputs
* @description
*
* Tests: covering encoding of message, name, description text on input controls used on Job params and input step.
*
* See https://issues.jenkins-ci.org/browse/JENKINS-41162
*
*/
const jobName = 'parameterPipeline-html-in-descriptions';

module.exports = {
'Step 01: create job': function (browser) {
const pipelinesCreate = browser.page.pipelineCreate().navigate();
pipelinesCreate.createPipeline(jobName, 'parameterPipeline-html-in-descriptions.groovy');
},
'Step 02: start job run': function (browser) {
// we need to create a browser page outside the async loop
// const pipelinesCreate = browser.page.pipelineCreate().navigate();
const pipelinePage = browser.page.jobUtils().forJob(jobName);
pipelinePage.buildStarted(function () {
// Reload the job page and check that there was a build done.
pipelinePage
.waitForElementVisible('div#pipeline-box')
.forRun(1)
.waitForElementVisible('@executer');
});
},
'Step 03: check the run input form for html tags (JENKINS-41162)': function (browser) {
const blueActivityPage = browser.page.bluePipelineActivity().forJob(jobName);

blueActivityPage.waitForElementVisible('@activityTableEntries');

// Click the first in the list and wait for the
// "Proceed" button to appear.
blueActivityPage.click('@activityTableEntries');
blueActivityPage.waitForElementVisible('@inputStepSubmit');

// Check that the text was stripped of markup.
// See parameterPipeline-html-in-descriptions.groovy and how the labels
// and descriptions were defined with embedded <b> tags.
// See https://issues.jenkins-ci.org/browse/JENKINS-41162
blueActivityPage.assert.containsText('@inputStepContainer', 'Some inputs');
blueActivityPage.assert.containsText('@inputStepContainer', 'My text.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My choice.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My flag.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My password.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My text description.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My choice description.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My flag description.');
blueActivityPage.assert.containsText('@inputStepContainer', 'My password description.');

// Press submit on the form, allowing the build to finish out.
blueActivityPage.click('@inputStepSubmit');
blueActivityPage.waitForJobRunEnded(jobName);
}
};
@@ -1,5 +1,5 @@
/** @module parametrisedPipeline
* @memberof log-karaoke
/** @module multibranch-pipeline
* @memberof params-inputs
* @description
*
* Tests: covering basic parameters in runButton
Expand Down
@@ -0,0 +1,31 @@
node {

//
// Commented out for now because pipeline doesn't accept Job parameters
// on the first run of the Job, which seems a bit messed up. The actual
// components for processing the inputs are the same in both cases, so
// testing the inputs should be fine for now anyway.
//
// properties([
// parameters([
// booleanParam(
// defaultValue: false,
// description: 'My <b>flag</b>',
// name: 'My <b>flag</b>'
// ),
// choice(
// choices: 'master\ndevelopment\nfeatureXYZ\nhotfix69\nrevolution\nrefactor\nuglify',
// description: 'My <b>choice</b>',
// name: 'My <b>choice</b>'
// ),
// ])
// ])
//

input message: 'Some <b>inputs</b>', parameters: [
[name: 'My <b>text</b>.', description: 'My text <b>description</b>.', $class: 'StringParameterDefinition'],
[name: 'My <b>choice</b>.', description: 'My choice <b>description</b>.', choices: 'Choice 1\nChoice 2\nChoice 3', $class: 'ChoiceParameterDefinition'],
[name: 'My <b>flag</b>.', description: 'My flag <b>description</b>.', $class: 'BooleanParameterDefinition'],
[name: 'My <b>password</b>.', description: 'My password <b>description</b>.', $class: 'PasswordParameterDefinition']
]
}

0 comments on commit 3be4b48

Please sign in to comment.