+
+
@@ -140,8 +149,11 @@ function GroupsV2Routes() {
}
+ element={
+
+ }
/>
+
} />
-
-
+
}
/>
diff --git a/client/src/features/usersV2/api/users.api.ts b/client/src/features/usersV2/api/users.api.ts
index e4f4eb1338..eccb2d915d 100644
--- a/client/src/features/usersV2/api/users.api.ts
+++ b/client/src/features/usersV2/api/users.api.ts
@@ -44,11 +44,14 @@ const withFixedEndpoints = usersGeneratedApi.injectEndpoints({
},
}),
transformResponse: (result: GetUserApiResponse | null | undefined) => {
- if (result == null) {
+ if (result == null || "error" in result) {
return { isLoggedIn: false };
}
return { ...result, isLoggedIn: true };
},
+ transformErrorResponse: () => {
+ return { isLoggedIn: false };
+ },
}),
getUsers: build.query({
query: ({ userParams }) => ({
diff --git a/client/src/utils/helpers/EnhancedState.ts b/client/src/utils/helpers/EnhancedState.ts
index bc1a692280..a11a6ef715 100644
--- a/client/src/utils/helpers/EnhancedState.ts
+++ b/client/src/utils/helpers/EnhancedState.ts
@@ -49,7 +49,6 @@ import projectGitLabApi from "../../features/project/projectGitLab.api";
import { projectKgApi } from "../../features/project/projectKg.api";
import { projectsApi } from "../../features/projects/projects.api";
import { projectV2Api } from "../../features/projectsV2/api/projectV2.enhanced-api";
-import { projectV2NewSlice } from "../../features/projectsV2/new/projectV2New.slice";
import { recentUserActivityApi } from "../../features/recentUserActivity/RecentUserActivityApi";
import repositoriesApi from "../../features/repositories/repositories.api";
import { searchV2EmptyApi as searchV2Api } from "../../features/searchV2/api/searchV2-empty.api";
@@ -85,7 +84,6 @@ export const createStore = (
[startSessionSlice.name]: startSessionSlice.reducer,
[startSessionOptionsSlice.name]: startSessionOptionsSlice.reducer,
[startSessionOptionsV2Slice.name]: startSessionOptionsV2Slice.reducer,
- [projectV2NewSlice.name]: projectV2NewSlice.reducer,
[workflowsSlice.name]: workflowsSlice.reducer,
// APIs
[adminKeycloakApi.reducerPath]: adminKeycloakApi.reducer,
diff --git a/tests/cypress/e2e/groupV2.spec.ts b/tests/cypress/e2e/groupV2.spec.ts
index b7bd8cf9e5..2d2ce81fb8 100644
--- a/tests/cypress/e2e/groupV2.spec.ts
+++ b/tests/cypress/e2e/groupV2.spec.ts
@@ -23,20 +23,42 @@ describe("Add new v2 group", () => {
const slug = "new-group";
beforeEach(() => {
- fixtures.config().versions().userTest().namespaces();
- fixtures.projects().landingUserProjects();
+ fixtures.config().versions().userTest();
fixtures
.createGroupV2()
+ .listNamespaceV2()
.readGroupV2({ groupSlug: slug })
.readGroupV2Namespace({ groupSlug: slug });
cy.visit("/v2/groups/new");
});
it("create a new group", () => {
- cy.contains("New Group").should("be.visible");
+ cy.contains("Create a new group").should("be.visible");
+ cy.getDataCy("group-name-input").clear().type(newGroupName);
+ cy.getDataCy("group-slug-input").should("have.value", slug);
+ cy.getDataCy("group-create-button").click();
+
+ cy.wait("@createGroupV2");
+ cy.wait("@readGroupV2");
+ cy.wait("@readGroupV2Namespace");
+ cy.url().should("contain", `v2/groups/${slug}`);
+ cy.contains("test 2 group-v2").should("be.visible");
+ });
+
+ it("cannot create a new group with invalid slug", () => {
+ cy.contains("Create a new group").should("be.visible");
cy.getDataCy("group-name-input").clear().type(newGroupName);
cy.getDataCy("group-slug-input").should("have.value", slug);
- cy.contains("Create").click();
+
+ cy.getDataCy("group-slug-toggle").click();
+ cy.getDataCy("group-slug-input").clear().type(newGroupName);
+ cy.getDataCy("group-create-button").click();
+ cy.contains(
+ "You can customize the slug only with lowercase letters, numbers, and hyphens."
+ ).should("be.visible");
+
+ cy.getDataCy("group-slug-input").clear().type(slug);
+ cy.getDataCy("group-create-button").click();
cy.wait("@createGroupV2");
cy.wait("@readGroupV2");
cy.wait("@readGroupV2Namespace");
diff --git a/tests/cypress/e2e/navV2.spec.ts b/tests/cypress/e2e/navV2.spec.ts
index e5e126603b..60da4560b6 100644
--- a/tests/cypress/e2e/navV2.spec.ts
+++ b/tests/cypress/e2e/navV2.spec.ts
@@ -20,14 +20,7 @@ import fixtures from "../support/renkulab-fixtures";
describe("View v2 landing page", () => {
beforeEach(() => {
- fixtures.config().versions().userTest().namespaces();
- fixtures
- .getSessions({ fixture: "sessions/sessionsV2.json" })
- .projects()
- .landingUserProjects()
- .listManyGroupV2()
- .listManyProjectV2()
- .readProjectV2ById();
+ fixtures.config().versions().userTest();
cy.visit("/v2");
});
@@ -40,12 +33,15 @@ describe("View v2 landing page", () => {
it("create new group", () => {
cy.get("#plus-dropdown").click();
cy.getDataCy("navbar-group-new").click();
- cy.contains("New Group").should("be.visible");
+ cy.getDataCy("new-group-modal").should("be.visible");
+ cy.contains("Create a new group").should("be.visible");
});
it("create new project", () => {
+ fixtures.listNamespaceV2();
cy.get("#plus-dropdown").click();
cy.getDataCy("navbar-project-new").click();
- cy.contains("New Project").should("be.visible");
+ cy.getDataCy("new-project-modal").should("be.visible");
+ cy.contains("Create a new project").should("be.visible");
});
});
diff --git a/tests/cypress/e2e/projectV2.spec.ts b/tests/cypress/e2e/projectV2.spec.ts
index 0597d85dd9..57fd195fbd 100644
--- a/tests/cypress/e2e/projectV2.spec.ts
+++ b/tests/cypress/e2e/projectV2.spec.ts
@@ -25,81 +25,51 @@ describe("Add new v2 project", () => {
beforeEach(() => {
fixtures.config().versions().userTest().namespaces();
fixtures.projects().landingUserProjects();
- fixtures.createProjectV2().listNamespaceV2().readProjectV2();
+ fixtures
+ .createProjectV2({
+ slug,
+ namespace: "user1-uuid",
+ })
+ .listNamespaceV2()
+ .readProjectV2();
cy.visit("/v2/projects/new");
});
it("create a new project", () => {
- cy.contains("New Project").should("be.visible");
+ cy.contains("Create a new project").should("be.visible");
cy.getDataCy("project-name-input").clear().type(newProjectTitle);
cy.getDataCy("project-slug-input").should("have.value", slug);
cy.wait("@listNamespaceV2");
cy.findReactSelectOptions("project-namespace-input", "namespace-select")
.first()
- .click(); // click on first option
- cy.contains("Set visibility").click();
- cy.contains("Add repositories").click();
- cy.getDataCy("project-add-repository").click();
- cy.getDataCy("project-repository-input-0")
- .clear()
- .type("https://domain.name/repo1.git");
- cy.contains("button", "Review").click();
+ .click();
+ cy.contains("Visibility").click();
cy.contains("button", "Create").click();
cy.wait("@createProjectV2");
cy.location("pathname").should("eq", `/v2/projects/user1-uuid/${slug}`);
});
- it("keeps namespace set after going back", () => {
- cy.contains("New Project").should("be.visible");
- cy.getDataCy("project-name-input").clear().type(newProjectTitle);
- cy.getDataCy("project-slug-input").should("have.value", slug);
- cy.wait("@listNamespaceV2");
- cy.findReactSelectOptions("project-namespace-input", "namespace-select")
- .first()
- .click();
- cy.contains("user1-uuid").should("exist");
- cy.contains("Set visibility").click();
- cy.get("button").contains("Back").click();
- cy.contains("user1-uuid").should("exist");
- });
-
it("prevents invalid input", () => {
- cy.contains("button", "Set visibility").click();
- cy.contains("Please provide a name").should("be.visible");
+ cy.contains("Name").should("be.visible");
+ cy.contains("Owner").should("be.visible");
+ cy.contains("Visibility").should("be.visible");
+ cy.contains("Description").should("be.visible");
+
+ cy.getDataCy("project-slug-toggle").click();
cy.getDataCy("project-name-input").clear().type(newProjectTitle);
cy.getDataCy("project-slug-input").clear().type(newProjectTitle);
- cy.contains("button", "Set visibility").click();
+ cy.getDataCy("project-create-button").click();
cy.contains(
- "Please provide a slug consisting of lowercase letters, numbers, and hyphens."
+ "You can customize the slug only with lowercase letters, numbers, and hyphens."
).should("be.visible");
+
cy.getDataCy("project-slug-input").clear().type(slug);
cy.wait("@listNamespaceV2");
cy.findReactSelectOptions("project-namespace-input", "namespace-select")
.first()
.click();
- cy.contains("Set visibility").click();
-
- cy.contains("Define access").should("be.visible");
cy.getDataCy("project-visibility-public").click();
- cy.contains("button", "Add repositories").click();
-
- cy.contains("button", "Review").click();
- cy.contains("button", "Back").click();
- cy.getDataCy("project-add-repository").click();
- cy.contains("button", "Review").click();
- cy.contains("Please provide a valid URL or remove the repository").should(
- "be.visible"
- );
- cy.getDataCy("project-repository-input-0")
- .clear()
- .type("https://domain.name/repo1.git");
-
- cy.contains("button", "Review").click();
- cy.contains(newProjectTitle).should("be.visible");
- cy.contains(slug).should("be.visible");
- cy.contains("public").should("be.visible");
- cy.contains("https://domain.name/repo1.git").should("be.visible");
cy.contains("button", "Create").click();
cy.wait("@createProjectV2");
diff --git a/tests/cypress/fixtures/projectV2/create-projectV2.json b/tests/cypress/fixtures/projectV2/create-projectV2.json
index 6941d4c03f..dcfa6d0c4a 100644
--- a/tests/cypress/fixtures/projectV2/create-projectV2.json
+++ b/tests/cypress/fixtures/projectV2/create-projectV2.json
@@ -1,6 +1,7 @@
{
"id": "THEPROJECTULID26CHARACTERS",
"name": "Renku R Project",
+ "namespace": "owner-kc-id",
"slug": "r-project",
"created_by": {
"id": "owner-KC-id"
diff --git a/tests/cypress/support/renkulab-fixtures/projectV2.ts b/tests/cypress/support/renkulab-fixtures/projectV2.ts
index 7599a78321..10391fb93f 100644
--- a/tests/cypress/support/renkulab-fixtures/projectV2.ts
+++ b/tests/cypress/support/renkulab-fixtures/projectV2.ts
@@ -85,8 +85,15 @@ export function ProjectV2(Parent: T) {
fixture = "projectV2/create-projectV2.json",
name = "createProjectV2",
} = args ?? {};
- const response = { fixture, statusCode: 201 };
- cy.intercept("POST", "/ui-server/api/data/projects", response).as(name);
+ cy.fixture(fixture).then((values) => {
+ cy.intercept("POST", "/ui-server/api/data/projects", {
+ body: {
+ values,
+ ...args,
+ },
+ statusCode: 201,
+ }).as(name);
+ });
return this;
}
diff --git a/tests/cypress/support/renkulab-fixtures/user.ts b/tests/cypress/support/renkulab-fixtures/user.ts
index 9fb0cb8cb3..81f2d59c73 100644
--- a/tests/cypress/support/renkulab-fixtures/user.ts
+++ b/tests/cypress/support/renkulab-fixtures/user.ts
@@ -63,15 +63,26 @@ export function User(Parent: T) {
}
) as DeepRequired;
- const response = {
+ const responseGitLab = {
body: {},
statusCode: 401,
...(delay != null ? { delay } : {}),
};
+ cy.intercept("GET", "/ui-server/api/user", responseGitLab).as(user.name);
- cy.intercept("GET", "/ui-server/api/user", response).as(user.name);
-
- cy.intercept("GET", "/api/data/user", response).as(dataServiceUser.name);
+ const responseDataService = {
+ body: {
+ error: {
+ code: 1401,
+ message: "You have to be authenticated to perform this operation.",
+ },
+ },
+ statusCode: 401,
+ ...(delay != null ? { delay } : {}),
+ };
+ cy.intercept("GET", "/api/data/user", responseDataService).as(
+ dataServiceUser.name
+ );
return this;
}