Skip to content

Commit

Permalink
fix: update e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-code committed Oct 17, 2024
1 parent 251630a commit 70836e9
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 172 deletions.
8 changes: 4 additions & 4 deletions client/src/features/admin/AddSessionEnvironmentButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ function AddSessionEnvironmentModal({
addSessionEnvironment({
container_image: data.container_image,
name: data.name,
default_url: data.default_url.trim() ? data.default_url : undefined,
description: data.description.trim() ? data.description : undefined,
default_url: data.default_url?.trim() ? data.default_url : undefined,
description: data.description?.trim() ? data.description : undefined,
port: data.port ?? undefined,
working_directory: data.working_directory.trim()
working_directory: data.working_directory?.trim()
? data.working_directory
: undefined,
mount_directory: data.mount_directory.trim()
mount_directory: data.mount_directory?.trim()
? data.mount_directory
: undefined,
uid: data.uid ?? undefined,
Expand Down
8 changes: 4 additions & 4 deletions client/src/features/admin/UpdateSessionEnvironmentButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ function UpdateSessionEnvironmentModal({
environmentId: environment.id,
container_image: data.container_image,
name: data.name,
default_url: data.default_url.trim() ? data.default_url : "",
description: data.description.trim() ? data.description : "",
default_url: data.default_url?.trim() ? data.default_url : "",
description: data.description?.trim() ? data.description : "",
port: data.port ?? undefined,
working_directory: data.working_directory.trim()
working_directory: data.working_directory?.trim()
? data.working_directory
: undefined,
mount_directory: data.mount_directory.trim()
mount_directory: data.mount_directory?.trim()
? data.mount_directory
: undefined,
uid: data.uid ?? undefined,
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/dashboardV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("View v2 landing page", () => {
beforeEach(() => {
fixtures.config().versions().userTest().namespaces();
fixtures
.getSessions({ fixture: "sessions/sessionsV2.json" })
.getSessionsV2({ fixture: "sessions/sessionsV2.json" })
.projects()
.landingUserProjects()
.listManyGroupV2()
Expand Down
Empty file.
31 changes: 16 additions & 15 deletions tests/cypress/e2e/projectV2Session.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("launch sessions with data connectors", () => {
.sessionLaunchers({
fixture: "projectV2/session-launchers.json",
})
.sessionServersEmpty()
.sessionServersEmptyV2()
.sessionImage()
.newLauncher()
.environments();
Expand All @@ -56,7 +56,7 @@ describe("launch sessions with data connectors", () => {

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

Expand Down Expand Up @@ -87,7 +87,7 @@ describe("launch sessions with data connectors", () => {
// start session
cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
req.reply({ body: sessions[0] });
Expand All @@ -114,7 +114,7 @@ describe("launch sessions with data connectors", () => {

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

Expand Down Expand Up @@ -145,7 +145,7 @@ describe("launch sessions with data connectors", () => {
// start session
cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
const storage = csConfig[0];
Expand Down Expand Up @@ -220,7 +220,7 @@ describe("launch sessions with data connectors", () => {

cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
const storage = csConfig[0];
Expand Down Expand Up @@ -304,7 +304,7 @@ describe("launch sessions with data connectors", () => {

cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
const storage = csConfig[0];
Expand Down Expand Up @@ -351,20 +351,21 @@ describe("launch sessions with data connectors", () => {
it("launch session with saved credentials", () => {
fixtures
.testCloudStorage()
.sessionServersEmptyV2()
.listProjectDataConnectors()
.getDataConnector()
.dataConnectorSecrets();

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

// start session
cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
const storage = csConfig[0];
Expand Down Expand Up @@ -396,13 +397,13 @@ describe("launch sessions with data connectors", () => {

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(1);
const storage = csConfig[0];
Expand Down Expand Up @@ -463,14 +464,14 @@ describe("launch sessions with data connectors", () => {

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

// start session
cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(3);
const s3Storage = csConfig[0];
Expand Down Expand Up @@ -558,14 +559,14 @@ describe("launch sessions with data connectors", () => {

cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessionServers");
cy.wait("@sessionServersEmptyV2");
cy.wait("@sessionLaunchers");
cy.wait("@listProjectDataConnectors");

// start session
cy.fixture("sessions/sessionsV2.json").then((sessions) => {
// eslint-disable-next-line max-nested-callbacks
cy.intercept("POST", "/ui-server/api/notebooks/v2/servers", (req) => {
cy.intercept("POST", "/ui-server/api/data/sessions", (req) => {
const csConfig = req.body.cloudstorage;
expect(csConfig.length).equal(3);
const s3Storage = csConfig[0];
Expand Down
9 changes: 4 additions & 5 deletions tests/cypress/e2e/projectV2setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ describe("Set up project components", () => {
});

it("set up sessions", () => {
cy.intercept("/ui-server/api/notebooks/servers*", {
body: { servers: {} },
}).as("getSessions");
cy.intercept("/ui-server/api/data/sessions*", {
body: [],
}).as("getSessionsV2");
fixtures
.readProjectV2({ fixture: "projectV2/read-projectV2-empty.json" })
.listProjectDataConnectors()
Expand All @@ -191,7 +191,7 @@ describe("Set up project components", () => {
.environments();
cy.visit("/v2/projects/user1-uuid/test-2-v2-project");
cy.wait("@readProjectV2");
cy.wait("@getSessions");
cy.wait("@getSessionsV2");
cy.wait("@sessionLaunchers");
// ADD SESSION CUSTOM IMAGE
cy.getDataCy("add-session-launcher").click();
Expand All @@ -212,7 +212,6 @@ describe("Set up project components", () => {
cy.wait("@newLauncher");
cy.wait("@session-launchers-custom");
cy.getDataCy("close-cancel-button").click();

// check session values
cy.getDataCy("session-launcher-item").within(() => {
cy.getDataCy("session-name").should("contain.text", "Session-custom");
Expand Down
161 changes: 20 additions & 141 deletions tests/cypress/fixtures/sessions/sessionsV2.json
Original file line number Diff line number Diff line change
@@ -1,143 +1,22 @@
{
"servers": {
"renku-2-86688c93091df68dffdc594bfd022ce3": {
"annotations": {
"renku.io/branch": "",
"renku.io/commit-sha": "",
"renku.io/default_image_used": "False",
"renku.io/git-host": "gitlab.dev.renku.ch",
"renku.io/gitlabProjectId": "",
"renku.io/hibernatedSecondsThreshold": "259200",
"renku.io/hibernation": "",
"renku.io/hibernationBranch": "",
"renku.io/hibernationCommitSha": "",
"renku.io/hibernationDate": "",
"renku.io/hibernationDirty": "",
"renku.io/hibernationSynchronized": "",
"renku.io/idleSecondsThreshold": "86400",
"renku.io/lastActivityDate": "2024-04-19T09:45:45+00:00",
"renku.io/launcherId": "01HVTVWBGE2P5HSNKRYC2MG8B7",
"renku.io/namespace": "",
"renku.io/projectId": "THEPROJECTULID26CHARACTERS",
"renku.io/projectName": "",
"renku.io/renkuVersion": "2.0",
"renku.io/repository": "",
"renku.io/resourceClassId": "3",
"renku.io/servername": "renku-2-86688c93091df68dffdc594bfd022ce3",
"renku.io/username": "e2e@renku.ch"
},
"cloudstorage": [],
"image": "renku/renkulab-py:3.10-0.15.0",
"name": "renku-2-86688c93091df68dffdc594bfd022ce3",
"resources": {
"requests": {
"cpu": 0.1,
"memory": "1G",
"storage": "1G"
},
"usage": {}
},
"started": "2024-04-19T09:44:38+00:00",
"state": {
"pod_name": "renku-2-86688c93091df68dffdc594bfd022ce3-0"
},
"status": {
"details": [
{
"status": "ready",
"step": "Initialization"
},
{
"status": "ready",
"step": "Downloading server image"
},
{
"status": "ready",
"step": "Authentication and proxying services"
},
{
"status": "ready",
"step": "Starting session"
}
],
"readyNumContainers": 4,
"state": "running",
"totalNumContainers": 4,
"warnings": [
{
"critical": false,
"message": "Server is idle and will be hibernated in 81093.401526 seconds."
}
]
},
"url": "https://renku-ci-ui-3095.dev.renku.ch/sessions/renku-2-86688c93091df68dffdc594bfd022ce3"
[
{
"image": "renku/renkulab-py:3.10-0.15.0",
"name": "renku-2-86688c93091df68dffdc594bfd022ce3",
"resources": {
"cpu": 0.1,
"memory": "1G",
"storage": "1G"
},
"e2e-40renk-local-2dtest-2dproject-84756d7d": {
"annotations": {
"renku.io/branch": "master",
"renku.io/commit-sha": "172a784d465a7bd45bacc165df2b64a591ac6b18",
"renku.io/default_image_used": "False",
"renku.io/git-host": "dev.renku.ch",
"renku.io/gitlabProjectId": "39646",
"renku.io/namespace": "e2e",
"renku.io/projectName": "local-test-project",
"renku.io/repository": "https://dev.renku.ch/gitlab/e2e/local-test-project",
"renku.io/username": "e2e@renku.ch"
},
"image": "registry.dev.renku.ch/e2e/local-test-project:172a784",
"name": "e2e-40renk-local-2dtest-2dproject-84756d7d",
"resources": {
"requests": {
"cpu": "0.5",
"memory": "1G",
"storage": "1G"
},
"usage": {
"cpu": 0.007691289,
"memory": "0.09G",
"storage": "0.00G"
}
},
"started": "2022-02-28T14:15:59+00:00",
"state": {
"pod_name": "e2e-40renk-local-2dtest-2dproject-84756d7d-0"
},
"status": {
"details": [
{
"status": "ready",
"step": "Initialization"
},
{
"status": "ready",
"step": "Downloading server image"
},
{
"status": "ready",
"step": "Cloning and configuring the repository"
},
{
"status": "ready",
"step": "Git credentials services"
},
{
"status": "ready",
"step": "Authentication and proxying services"
},
{
"status": "ready",
"step": "Auxiliary session services"
},
{
"status": "ready",
"step": "Starting session"
}
],
"readyNumContainers": 7,
"state": "running",
"totalNumContainers": 7
},
"url": "https://dev.renku.ch/sessions/e2e-40renk-local-2dtest-2dproject-84756d7d"
}
"started": "2024-04-19T09:44:38+00:00",
"status": {
"state": "running",
"will_hibernate_at": "",
"ready_containers": 3,
"total_containers": 3
},
"url": "https://dev.renku.ch/sessions/renku-2-86688c93091df68dffdc594bfd022ce3",
"project_id": "THEPROJECTULID26CHARACTERS",
"launcher_id": "01HVTVWBGE2P5HSNKRYC2MG8B7",
"resource_class_id": 3
}
}
]
4 changes: 2 additions & 2 deletions tests/cypress/support/renkulab-fixtures/projectV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export function ProjectV2<T extends FixturesConstructor>(Parent: T) {
};
cy.intercept(
"GET",
`/ui-server/api/data/projects/${namespace}/${projectSlug}`,
`/ui-server/api/data/namespaces/${namespace}/projects/${projectSlug}`,
response
).as(name);
return this;
Expand All @@ -245,7 +245,7 @@ export function ProjectV2<T extends FixturesConstructor>(Parent: T) {
const response = { fixture };
cy.intercept(
"GET",
`/ui-server/api/data/projects/${namespace}/${projectSlug}`,
`/ui-server/api/data/namespaces/${namespace}/projects/${projectSlug}`,
response
).as(name);
return this;
Expand Down
Loading

0 comments on commit 70836e9

Please sign in to comment.