Skip to content

Commit

Permalink
Merge branch 'release-0.49.0' into auto-update/renku-core-2.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rokroskar authored Feb 23, 2024
2 parents c035df2 + be30381 commit a9d1bd0
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 56 deletions.
2 changes: 1 addition & 1 deletion acceptance-tests/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ publishTo := Some(Resolver.file("Unused transient repository", file("target/unus
val circeVersion = "0.14.6"

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.5.0"
libraryDependencies += "com.github.pureconfig" %% "pureconfig" % "0.17.5" % Test
libraryDependencies += "com.github.pureconfig" %% "pureconfig" % "0.17.6" % Test
libraryDependencies += "eu.timepit" %% "refined" % "0.11.1" % Test
libraryDependencies += "io.circe" %% "circe-core" % circeVersion % Test
libraryDependencies += "io.circe" %% "circe-literal" % circeVersion % Test
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.8
sbt.version=1.9.9
1 change: 1 addition & 0 deletions cypress-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const TIMEOUTS = {
standard: 20_000,
long: 60_000,
vlong: 180_000,
vvlong: 300_000,
};
1 change: 1 addition & 0 deletions cypress-tests/cypress/e2e/rstudioSession.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe("Basic rstudio functionality", () => {
{ defaultCommandTimeout: TIMEOUTS.long },
() => {
// Waits for the image to build and launches a session
// Note: rstudio image may take a while to build
cy.startSession(projectIdentifier);

// Opens the session in an iframe
Expand Down
67 changes: 36 additions & 31 deletions cypress-tests/cypress/e2e/useSession.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ const projectTestConfig = {
shouldCreateProject: true,
projectName: generatorProjectName("useSession"),
};
const workflowNameSalt = uuidv4().substring(0, 4);
const workflow = {
name: `dummyworkflow-${workflowNameSalt}`,
output: `o${workflowNameSalt}.txt`, // ? Keep the name short or it won't show up entirely in the file browser
};

// ? Modify the config -- useful for debugging
// projectTestConfig.shouldCreateProject = false;
Expand Down Expand Up @@ -66,6 +61,13 @@ describe("Basic public project functionality", () => {
it("Start a new session on the project and interact with the terminal.", () => {
cy.stopAllSessionsForProject(projectIdentifier);

// Define workflow object
const workflowNameSalt = uuidv4().substring(0, 4);
const workflow = {
name: `dummyworkflow-${workflowNameSalt}`,
output: `o${workflowNameSalt}.txt`, // ? Keep the name short or it won't show up entirely in the file browser
};

// Start a session with options
let serversInvoked = false;
cy.intercept("/ui-server/api/notebooks/servers*", (req) => {
Expand All @@ -83,9 +85,7 @@ describe("Basic public project functionality", () => {
cy.get(".renku-container")
.contains("A session gives you an environment")
.should("exist");
cy.get(".renku-container .badge.bg-success", { timeout: TIMEOUTS.vlong })
.contains("available")
.should("exist");
cy.waitForImageToBuild();
cy.get(".renku-container button.btn-secondary", { timeout: TIMEOUTS.long })
.contains("Start Session")
.should("exist")
Expand Down Expand Up @@ -142,7 +142,9 @@ describe("Basic public project functionality", () => {
.contains("Saving Session", { timeout: TIMEOUTS.long })
.should("be.visible");
cy.get(".modal")
.contains("Your session has been saved successfully", { timeout: TIMEOUTS.long })
.contains("Your session has been saved successfully", {
timeout: TIMEOUTS.long,
})
.should("be.visible");
cy.get(".modal .btn-close").should("be.visible").click();

Expand Down Expand Up @@ -191,13 +193,14 @@ describe("Basic public project functionality", () => {
.first()
.click();
cy.get(".alert-info").contains("As an anonymous user").should("be.visible");
cy.waitForImageToBuild();

// Quickstart a session and check it spins up
cy.getDataCy("go-back-button").click();
cy.quickstartSession();

// Stop the session -- mind that anonymous users cannot pause sessions
cy.deleteSession(true);
cy.deleteSession({ fromSessionPage: true });
});

it("Start a new session on a project without permissions.", () => {
Expand All @@ -213,6 +216,7 @@ describe("Basic public project functionality", () => {
cy.get(".alert-info")
.contains("You have limited permissions for this project")
.should("be.visible");
cy.waitForImageToBuild();

// Quickstart a session and check it spins up
cy.getDataCy("go-back-button").click();
Expand Down Expand Up @@ -248,7 +252,7 @@ describe("Basic public project functionality", () => {
if (storages.find(({ storage }) => storage.name === "data_s3")) {
return;
}

cy.getDataCy("cloud-storage-section")
.find("button")
.contains("Add Cloud Storage")
Expand All @@ -257,7 +261,7 @@ describe("Basic public project functionality", () => {
cy.getDataCy("cloud-storage-edit-header")
.contains("Add Cloud Storage")
.should("be.visible");

cy.getDataCy("cloud-storage-edit-schema")
.contains("s3")
.should("be.visible")
Expand All @@ -269,7 +273,7 @@ describe("Basic public project functionality", () => {
cy.getDataCy("cloud-storage-edit-next-button")
.should("be.visible")
.click();

cy.getDataCy("cloud-storage-edit-options").should("be.visible");
cy.get("#sourcePath").should("have.value", "").type("giab");
cy.get("#endpoint")
Expand All @@ -278,43 +282,43 @@ describe("Basic public project functionality", () => {
cy.getDataCy("cloud-storage-edit-next-button")
.should("be.visible")
.click();

cy.getDataCy("cloud-storage-edit-mount").should("be.visible");
cy.get("#name").should("have.value", "").type("data_s3");
cy.get("#mountPoint")
.should("have.value", "external_storage/data_s3")
.type("{selectAll}data_s3");
cy.get("#readOnly").should("not.be.checked").check();

cy.getDataCy("cloud-storage-edit-update-button")
.should("be.visible")
.contains("Add")
.click();

cy.getDataCy("cloud-storage-edit-body").contains(
"storage data_s3 has been succesfully added"
);
cy.getDataCy("cloud-storage-edit-close-button")
.should("be.visible")
.click();
});

cy.getDataCy("more-menu").should("be.visible").click();
cy.getProjectPageLink(projectIdentifier, "sessions/new")
.should("be.visible")
.first()
.click();

// Wait for the image to be ready and start a session
cy.get(".renku-container")
.contains("A session gives you an environment")
.should("exist");
cy.get(".renku-container .badge.bg-success", { timeout: TIMEOUTS.vlong })
.contains("available")
.should("exist");
cy.waitForImageToBuild();
cy.getDataCy("cloud-storage-item").contains("data_s3").should("exist");
cy.get("#cloud-storage-data_s3-active").should("be.checked");
cy.get(".renku-container button.btn-secondary", { timeout: TIMEOUTS.long })
cy.get(".renku-container button.btn-secondary", {
timeout: TIMEOUTS.long,
})
.contains("Start Session")
.should("exist")
.click();
Expand All @@ -325,10 +329,10 @@ describe("Basic public project functionality", () => {
cy.get(".progress-box .progress-title")
.contains("Starting Session")
.should("exist");
cy.get(".progress-box .progress-title", { timeout: TIMEOUTS.vlong }).should(
"not.exist"
);
cy.get(".progress-box .progress-title", {
timeout: TIMEOUTS.vlong,
}).should("not.exist");

// Verify that the S3 data is mounted
cy.getIframe("iframe#session-iframe").within(() => {
cy.get(".jp-DirListing-content", { timeout: TIMEOUTS.long }).should(
Expand All @@ -338,21 +342,22 @@ describe("Basic public project functionality", () => {
.contains("data_s3")
.should("be.visible")
.dblclick();

cy.get(".jp-DirListing-item")
.contains("README.s3_structure")
.should("be.visible")
.dblclick();

cy.get(".jp-FileEditor", { timeout: TIMEOUTS.long }).should("be.visible");

cy.get(".jp-FileEditor", { timeout: TIMEOUTS.long }).should(
"be.visible"
);
cy.get(".jp-FileEditor")
.contains("The GIAB s3 bucket and URLs")
.should("be.visible");
});

cy.pauseSession();
cy.deleteSession();
});
});

});
59 changes: 36 additions & 23 deletions cypress-tests/cypress/support/commands/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import type { ProjectIdentifier } from "./projects";
function startSession(identifier: ProjectIdentifier) {
const id = fullProjectIdentifier(identifier);
cy.visit(`/projects/${id.namespace}/${id.name}/sessions/new`);
cy.get(".renku-container button.btn-secondary", { timeout: TIMEOUTS.vlong })
cy.waitForImageToBuild();
cy.get(".renku-container button.btn-secondary", { timeout: TIMEOUTS.long })
.contains("Start Session")
.should("be.visible")
.should("be.enabled")
Expand All @@ -19,13 +20,13 @@ function startSession(identifier: ProjectIdentifier) {
}).should("not.exist");
}

function waitForImageToBuild(identifier: ProjectIdentifier) {
const id = fullProjectIdentifier(identifier);
cy.visit(`/projects/${id.namespace}/${id.name}/sessions/new`);
cy.get(".renku-container button.btn-secondary", { timeout: TIMEOUTS.vlong })
.contains("Start Session")
function waitForImageToBuild() {
cy.get(".renku-container .badge.bg-success", { timeout: TIMEOUTS.vvlong })
.contains("available")
.should("be.visible")
.should("be.enabled");
.parent()
.contains("Docker image")
.should("be.visible");
}

function stopAllSessionsForProject(
Expand Down Expand Up @@ -53,7 +54,7 @@ function stopAllSessionsForProject(
.should("be.visible")
.click();
cy.getDataCy("session-container")
.find(`[data-cy=delete-session-button]`)
.find("[data-cy=delete-session-button]")
.first()
.should("be.visible")
.click();
Expand All @@ -63,28 +64,40 @@ function stopAllSessionsForProject(
cy.contains("No currently running sessions.", { timeout: TIMEOUTS.vlong });
}

function deleteSession(fromSessionPage = false) {
if (!fromSessionPage)
cy.getDataCy("more-menu").first().should("be.visible").click();
cy.getDataCy("delete-session-button").first().should("be.visible").click();
function deleteSession(args?: { fromSessionPage?: boolean }) {
const fromSessionPage = args?.fromSessionPage ?? false;

if (fromSessionPage) {
cy.getDataCy("delete-session-button").first().should("be.visible").click();
} else {
cy.wait(TIMEOUTS.minimal); // eslint-disable-line cypress/no-unnecessary-waiting
cy.getDataCy("session-container")
.find("[data-cy=more-menu]")
.first()
.should("be.visible")
.click();
cy.getDataCy("session-container")
.find("[data-cy=delete-session-button]")
.first()
.should("be.visible")
.click();
}

cy.getDataCy("delete-session-modal-button").should("be.visible").click();
cy.getDataCy("stopping-btn").should("be.visible");
cy.get(".renku-container", { timeout: TIMEOUTS.vlong })
.contains("No currently running sessions")
.should("be.visible");
}

function pauseSession(fromSessionPage = true) {
if (!fromSessionPage)
cy.getDataCy("more-menu").first().should("be.visible").click();
cy.getDataCy("pause-session-button").should("be.visible").click();
function pauseSession() {
cy.getDataCy("pause-session-button").first().should("be.visible").click();
cy.getDataCy("pause-session-modal-button").should("be.visible").click();
cy.get(`[data-cy="session-container"]`, { timeout: TIMEOUTS.long })
.should("be.visible")
.contains("Paused");
}


function quickstartSession() {
cy.get(".start-session-button").should("not.be.disabled").click();
cy.get(".progress-box .progress-title").should("exist");
Expand Down Expand Up @@ -118,12 +131,12 @@ declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
startSession(identifier: ProjectIdentifier);
waitForImageToBuild(identifier: ProjectIdentifier);
deleteSession(fromSessionPage?: boolean);
pauseSession(fromSessionPage?: boolean);
quickstartSession();
stopAllSessionsForProject(identifier: ProjectIdentifier, loadPage?: boolean);
startSession: typeof startSession;
waitForImageToBuild: typeof waitForImageToBuild;
deleteSession: typeof deleteSession;
pauseSession: typeof pauseSession;
quickstartSession: typeof quickstartSession;
stopAllSessionsForProject: typeof stopAllSessionsForProject;
}
}
}

0 comments on commit a9d1bd0

Please sign in to comment.