Search in sources :

Example 26 with Radiator

use of com.paulhammant.buildradiator.radiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorStoreUnitTest method radiatorCanBeCreatedWithGoodIpAddresses.

@Test
public void radiatorCanBeCreatedWithGoodIpAddresses() {
    Radiator rad = new RadiatorStore().createRadiator(new TestRandomGenerator("QWERTY", "sseeccrreett"), "A").withIpAccessRestrictedToThese("123.123.123.122", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
    assertThat(rad.code, equalTo("QWERTY"));
    assertThat(rad.codeAndSecretOnly().code, equalTo("QWERTY"));
    assertThat(rad.codeAndSecretOnly().secret, equalTo("sseeccrreett"));
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator) Test(org.junit.Test)

Example 27 with Radiator

use of com.paulhammant.buildradiator.radiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorWebDriverTest method columnsShouldBeProportionalEvenWithDurationsOfZero.

@Test
public void columnsShouldBeProportionalEvenWithDurationsOfZero() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A", "B"), build("1", "passed", 30000, step("A", 8000, "passed"), step("B", 30000, "passed")), build("2", "running", 30000, step("A", 12000, "running"), step("B", 0, "")));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build");
    FWD.body().within(secs(3)).getText().shouldContain("Main");
    StringBuilder percentages = new StringBuilder();
    FWD.tds().each((fluentWebElement, i) -> rhs(fluentWebElement.getAttribute("style").toString().split("width:"), percentages));
    assertThat(percentages.toString(), equalTo("8%;23%;69%;8%;23%;69%;"));
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 28 with Radiator

use of com.paulhammant.buildradiator.radiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorWebDriverTest method columnsShouldBeProportional.

@Test
public void columnsShouldBeProportional() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A", "B"), build("1", "passed", 30000, step("A", 8000, "passed"), step("B", 32000, "passed")), build("2", "passed", 30000, step("A", 12000, "passed"), step("B", 28000, "passed")));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build");
    StringBuilder percentages = new StringBuilder();
    FWD.body().within(secs(3)).getText().shouldContain("Main");
    FWD.tds().each((fluentWebElement, i) -> rhs(fluentWebElement.getAttribute("style").toString().split("width:"), percentages));
    assertThat(percentages.toString(), equalTo("8%;23%;69%;8%;23%;69%;"));
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 29 with Radiator

use of com.paulhammant.buildradiator.radiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorWebDriverTest method trailingSlashOnPageTitleIsIgnored.

@Test
public void trailingSlashOnPageTitleIsIgnored() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A"));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build/");
    FWD.td().getText().within(secs(3)).shouldBe("Main Project Trunk Build\nchange URL to customize the title ↑ or step codes ↓ Edit the title and step descriptions");
    FWD.trs().getText().within(secs(2)).shouldContain("Main Project Trunk");
    // unchanged
    FWD.url().shouldMatch(endsWith("Trunk_Build/"));
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 30 with Radiator

use of com.paulhammant.buildradiator.radiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorStore method createRadiator.

Radiator createRadiator(RandomGenerator codeGenerator, String... steps) {
    String radiatorCode = codeGenerator.generateRadiatorCode();
    String secret = codeGenerator.generateSecret();
    Radiator radiator = new Radiator(radiatorCode, secret, steps);
    this.actualRadiators.put(radiatorCode, radiator);
    return radiator;
}
Also used : ByteString(com.google.protobuf.ByteString) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Aggregations

Radiator (com.paulhammant.buildradiator.radiator.model.Radiator)30 Test (org.junit.Test)21 HasNewRadiator.captureCreatedRadiator (com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator)14 CreatedRadiator (com.paulhammant.buildradiator.radiator.model.CreatedRadiator)14 Step (com.paulhammant.buildradiator.radiator.model.Step)3 ByteString (com.google.protobuf.ByteString)2 Build (com.paulhammant.buildradiator.radiator.model.Build)2 RadiatorDoesntExist (com.paulhammant.buildradiator.radiator.model.RadiatorDoesntExist)2 UnknownStep (com.paulhammant.buildradiator.radiator.model.UnknownStep)1 FluentWebElement (org.seleniumhq.selenium.fluent.FluentWebElement)1