<commit_before>package net.nemerosa.ontrack.acceptance

import net.nemerosa.ontrack.acceptance.browser.dialogs.ValidationRunDialog
import net.nemerosa.ontrack.acceptance.browser.pages.BuildPage
import net.nemerosa.ontrack.acceptance.support.AcceptanceTestSuite
import net.nemerosa.ontrack.dsl.ValidationRun
import org.junit.Test
import org.openqa.selenium.By

import static net.nemerosa.ontrack.acceptance.steps.BasicSteps.loginAsAdmin
import static net.nemerosa.ontrack.test.TestUtils.uid

@AcceptanceTestSuite
class ACCBrowserValidationRunData extends AcceptanceTestClient {

    @Test
    void 'Validating a build with data from the build page'() {
        // Preparation
        def projectName = uid('P')
        ontrack.project(projectName) {
            branch('B') {
                validationStamp('Coverage').setPercentageDataType(40, 20, true)
                build '1'
            }
        }
        def build1 = ontrack.build(projectName, 'B', '1')

        // GUI scenario
        browser { browser ->
            // Logs in
            loginAsAdmin(browser)
            // Goes to the build page which must contains the link
            BuildPage buildPage = goTo(BuildPage, [id: build1.id])
            // Validation link
            ValidationRunDialog dialog = buildPage.validate()
            // Selects the "Coverage" timestamp
            dialog.validationStamp = 'Coverage'
            // Enters a value
            dialog.validationStampDataForm.findElement(By.name("value")).sendKeys("25")
            // Validates
            dialog.ok()
        }

        // Checks the validation run
        def run = build1.validationRuns[0]
        assert run.status == "WARNING"
        assert run.data != null
        assert run.data.id == "net.nemerosa.ontrack.extension.general.validation.ThresholdPercentageValidationDataType"
        assert run.data.data == 25
    }

}<commit_msg>#176 GUI test - reuse<commit_after>package net.nemerosa.ontrack.acceptance

import net.nemerosa.ontrack.acceptance.browser.dialogs.ValidationRunDialog
import net.nemerosa.ontrack.acceptance.browser.pages.BuildPage
import net.nemerosa.ontrack.acceptance.support.AcceptanceTestSuite
import net.nemerosa.ontrack.dsl.Build
import org.junit.Test
import org.openqa.selenium.By

import static net.nemerosa.ontrack.acceptance.steps.BasicSteps.loginAsAdmin
import static net.nemerosa.ontrack.test.TestUtils.uid

@AcceptanceTestSuite
class ACCBrowserValidationRunData extends AcceptanceTestClient {

    private Build prepareBuild() {
        def projectName = uid('P')
        ontrack.project(projectName) {
            branch('B') {
                validationStamp('Coverage').setPercentageDataType(40, 20, true)
                build '1'
            }
        }
        return ontrack.build(projectName, 'B', '1')
    }

    @Test
    void 'Validating a build with data from the build page'() {
        // Preparation
        def build = prepareBuild()

        // GUI scenario
        browser { browser ->
            // Logs in
            loginAsAdmin(browser)
            // Goes to the build page which must contains the link
            BuildPage buildPage = goTo(BuildPage, [id: build.id])
            // Validation link
            ValidationRunDialog dialog = buildPage.validate()
            // Selects the "Coverage" timestamp
            dialog.validationStamp = 'Coverage'
            // Enters a value
            dialog.validationStampDataForm.findElement(By.name("value")).sendKeys("25")
            // Validates
            dialog.ok()
        }

        // Checks the validation run
        def run = build.validationRuns[0]
        assert run.status == "WARNING"
        assert run.data != null
        assert run.data.id == "net.nemerosa.ontrack.extension.general.validation.ThresholdPercentageValidationDataType"
        assert run.data.data == 25
    }

}
{'fraction_non_alphanumeric': 0.09351588736760527, 'fraction_numerical': 0.007233273056057866, 'mean_word_length': 2.408450704225352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6351534', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1057, 'n_words': 228}