cypress setup
This commit is contained in:
parent
b429cacc29
commit
d143123b07
@ -35,12 +35,17 @@ public class PlanSpec {
|
||||
//By default credentials are read from the '.credentials' file.
|
||||
BambooServer bambooServer = new BambooServer("http://localhost:8085");
|
||||
|
||||
|
||||
Plan buildPlan = new PlanSpec().createDockerBuildPlan();
|
||||
bambooServer.publish(buildPlan);
|
||||
|
||||
PlanPermissions buildPlanPermissions = new PlanSpec().createPlanPermission(buildPlan.getIdentifier());
|
||||
bambooServer.publish(buildPlanPermissions);
|
||||
|
||||
|
||||
Plan testPlan = new PlanSpec().createCypressTestPlan();
|
||||
bambooServer.publish(testPlan);
|
||||
PlanPermissions testPlanPermissions = new PlanSpec().createPlanPermission(testPlan.getIdentifier());
|
||||
bambooServer.publish(testPlanPermissions);
|
||||
}
|
||||
|
||||
private PlanPermissions createPlanPermission(PlanIdentifier planIdentifier) {
|
||||
@ -99,4 +104,38 @@ public class PlanSpec {
|
||||
.volume("/var/run/docker.sock", "/var/run/docker.sock"));
|
||||
}
|
||||
|
||||
|
||||
public Plan createCypressTestPlan() {
|
||||
|
||||
return new Plan(project(), "redaction-ui-tests", new BambooKey("REDCYPRESS"))
|
||||
.description("Cypress UI tests for redaction-ui.")
|
||||
.stages(new Stage("UI Test Stage").jobs(createCypressJob("cypress")))
|
||||
.linkedRepositories("RED / ui").triggers(new BitbucketServerTrigger()).planBranchManagement(
|
||||
new PlanBranchManagement().createForVcsBranch()
|
||||
.delete(new BranchCleanup().whenInactiveInRepositoryAfterDays(30)).notificationForCommitters());
|
||||
}
|
||||
|
||||
|
||||
private Job createCypressJob(String project) {
|
||||
return new Job("Cypress Job: " + project, new BambooKey(project.toUpperCase().replaceAll("-", ""))).tasks(
|
||||
new VcsCheckoutTask().description("Checkout Default Repository")
|
||||
.checkoutItems(new CheckoutItem().defaultRepository()),
|
||||
|
||||
new ScriptTask().description("Build").inlineBody(
|
||||
"#!/bin/bash\n" + "set -e\n" + "imageName=\"nexus.iqser.com:5001/red/ui-" + project + "\"\n"
|
||||
+ "dockerfileLocation=\"build/docker/" + project + "/Dockerfile\"\n"
|
||||
+ "docker build -t ${imageName}:latest -f ${dockerfileLocation} .\n"),
|
||||
new ScriptTask().description("Run Tests").inlineBody(
|
||||
"#!/bin/bash\n" + "set -e\n" + "imageName=\"nexus.iqser.com:5001/red/ui-" + project + "\"\n"
|
||||
+ "docker run -v $PWD:/e2e -w /e2e ${imageName}:latest\n" + "sleep 10")
|
||||
// for some reason disk isn't synced in real-time from docker
|
||||
|
||||
).finalTasks(
|
||||
TestParserTask.createJUnitParserTask().description("Cypress Test Results").defaultResultDirectory())
|
||||
.dockerConfiguration(new DockerConfiguration().image("nexus.iqser.com:5001/infra/release_build:2.9.1")
|
||||
.volume("/var/run/docker.sock", "/var/run/docker.sock"))
|
||||
.artifacts(new Artifact("videos").location("./cypress/videos").copyPattern("**/*.mp4").shared(true),
|
||||
new Artifact("screenshots").location("./cypress/screenshots").copyPattern("**/*.png").shared(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
4
docker/cypress/Dockerfile
Normal file
4
docker/cypress/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM cypress/included:5.6.0
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install
|
||||
COPY . .
|
||||
Loading…
x
Reference in New Issue
Block a user