-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-0.60.0' into allowSecurityContext
- Loading branch information
Showing
15 changed files
with
274 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,7 @@ jobs: | |
useSession, | ||
checkWorkflows, | ||
rstudioSession, | ||
dashboardV2, | ||
] | ||
|
||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { getRandomString, validateLogin } from "../support/commands/general"; | ||
import { generatorProjectName } from "../support/commands/projects"; | ||
import { | ||
createProjectIfMissingAPIV2, | ||
deleteProjectFromAPIV2, getProjectByNamespaceAPIV2, | ||
getUserNamespaceAPIV2, ProjectIdentifierV2 | ||
} from "../support/utils/projectsV2.utils"; | ||
const projectTestConfig = { | ||
projectAlreadyExists: false, | ||
projectName: generatorProjectName("dashboardV2"), | ||
}; | ||
|
||
const prefixProjectTitle = "My Renku Project"; | ||
const sessionId = ["dashboardV2", getRandomString()]; | ||
|
||
describe("Dashboard v2 - Authenticated user", () => { | ||
const projectIdentifier: ProjectIdentifierV2 = { | ||
slug: projectTestConfig.projectName, | ||
id: null, | ||
namespace: null, | ||
}; | ||
|
||
after(() => { | ||
if (!projectTestConfig.projectAlreadyExists && projectIdentifier.id != null){ | ||
deleteProjectFromAPIV2(projectIdentifier); | ||
getProjectByNamespaceAPIV2(projectIdentifier).then((response) => { | ||
expect(response.status).to.equal(404); | ||
}); | ||
} | ||
|
||
}); | ||
|
||
beforeEach(() => { | ||
// Restore the session | ||
cy.session( | ||
sessionId, | ||
() => { | ||
cy.robustLogin(); | ||
}, | ||
validateLogin | ||
); | ||
getUserNamespaceAPIV2().then((namespace) => { | ||
if (namespace) { | ||
projectIdentifier.namespace = namespace; | ||
createProjectIfMissingAPIV2({ | ||
visibility: "private", | ||
name: `${prefixProjectTitle} ${projectIdentifier.slug}`, | ||
namespace, | ||
slug: projectIdentifier.slug, | ||
}).then((project) => projectIdentifier.id=project.id) | ||
} else { | ||
cy.log('No user namespace found, project cannot be created.'); | ||
} | ||
}); | ||
}); | ||
|
||
it("Can see own project on the dashboard", () => { | ||
cy.visit("v2"); | ||
cy.getDataCy("dashboard-project-list").find("a").should("have.length.at.least", 1); | ||
cy.getDataCy("dashboard-project-list").find("a").should("contain.text", `${prefixProjectTitle} ${projectIdentifier.slug}`); | ||
cy.getDataCy("dashboard-project-list").find("a").should("contain.text", projectIdentifier.slug); | ||
}); | ||
|
||
it("Can find project in the search results", () => { | ||
cy.visit("v2"); | ||
cy.getDataCy("view-my-projects-btn").click(); | ||
cy.getDataCy("search-card").should("have.length.at.least", 1); | ||
cy.getDataCy("search-card").should("contain.text", `${prefixProjectTitle} ${projectIdentifier.slug}`); | ||
}); | ||
}); | ||
|
||
describe("Dashboard v2 - Non-Authenticated user", () => { | ||
it("Cannot see projects and groups on Dashboard when logged out", () => { | ||
cy.visit("v2"); | ||
cy.getDataCy("projects-container").contains("No 2.0 projects."); | ||
cy.getDataCy("view-other-projects-btn").should("be.visible"); | ||
cy.getDataCy("groups-container").contains("No 2.0 groups."); | ||
cy.getDataCy("view-other-groups-btn").should("be.visible"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export type ProjectIdentifierV2 = { | ||
slug: string; | ||
namespace?: string; | ||
id?: string; | ||
}; | ||
|
||
export interface NewProjectV2Props extends ProjectIdentifierV2 { | ||
visibility?: "public" | "private"; | ||
name: string; | ||
} | ||
|
||
/** Get the namespace of the logged in user from the API. */ | ||
export function getUserNamespaceAPIV2(): Cypress.Chainable<string | null> { | ||
return cy.request({ failOnStatusCode: false, method: "GET", url: `api/data/namespaces?minimum_role=owner` }) | ||
.then((response) => { | ||
if (response.status === 200) { | ||
const userNamespace = response.body?.filter((namespace) => namespace.namespace_kind === "user"); | ||
return userNamespace && userNamespace.length > 0 ? userNamespace[0].slug : null; | ||
} | ||
return null; | ||
}); | ||
} | ||
|
||
/** Get a project by using only the API. */ | ||
export function getProjectByNamespaceAPIV2(newProjectProps: ProjectIdentifierV2): Cypress.Chainable<any | null> { | ||
return cy.request({ failOnStatusCode: false, method: "GET", url: `api/data/projects/${newProjectProps.namespace}/${newProjectProps.slug}` }); | ||
} | ||
|
||
/** Create a project (if the project is missing) by using only the API. */ | ||
export function createProjectIfMissingAPIV2(newProjectProps: NewProjectV2Props) { | ||
return getProjectByNamespaceAPIV2(newProjectProps) | ||
.then((response) => { | ||
if (response.status != 200) { | ||
return cy.request({ | ||
method: "POST", | ||
url: "api/data/projects", | ||
body: newProjectProps, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
} else { | ||
return response.body; | ||
} | ||
}); | ||
} | ||
|
||
/** Delete a project by using only the API. */ | ||
export function deleteProjectFromAPIV2(projectIdentifier: ProjectIdentifierV2) { | ||
return cy.request({ | ||
failOnStatusCode: false, | ||
method: "DELETE", | ||
url: `api/data/projects/${projectIdentifier.id}`, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,7 @@ unmounting | |
unpause | ||
unpushed | ||
unschedulable | ||
unsetting | ||
untracked | ||
untracked | ||
updatable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.