-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ui/ingest): ingest tab should show with manage ingestion privilege #10483
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c4212ac
fix(ui/ingest): ingest tab should show with only manage ingestion pri…
anshbansal 25d1a89
default secrets tab
anshbansal e528b80
run formatter
anshbansal b66bacb
feat: Added test to handle ingestion and secret privilages (#10960)
Kunal-kankriya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -75,7 +75,7 @@ export function HeaderLinks(props: Props) { | |
const showAnalytics = (isAnalyticsEnabled && me && me?.platformPrivileges?.viewAnalytics) || false; | ||
const showSettings = true; | ||
const showIngestion = | ||
isIngestionEnabled && me && me.platformPrivileges?.manageIngestion && me.platformPrivileges?.manageSecrets; | ||
isIngestionEnabled && me && (me.platformPrivileges?.manageIngestion || me.platformPrivileges?.manageSecrets); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice work - thank you! |
||
|
||
useToggleEducationStepIdsAllowList(!!showIngestion, HOME_PAGE_INGESTION_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
199 changes: 199 additions & 0 deletions
199
smoke-test/tests/cypress/cypress/e2e/mutations/manage_ingestion_secret_privilege.js
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,199 @@ | ||
const test_id = Math.floor(Math.random() * 100000); | ||
const platform_policy_name = `Platform test policy ${test_id}`; | ||
const number = Math.floor(Math.random() * 100000); | ||
const name = `Example Name ${number}`; | ||
const email = `example${number}@example.com`; | ||
|
||
const tryToSignUp = () => { | ||
cy.enterTextInTestId("email", email); | ||
cy.enterTextInTestId("name", name); | ||
cy.enterTextInTestId("password", "Example password"); | ||
cy.enterTextInTestId("confirmPassword", "Example password"); | ||
cy.mouseover("#title").click(); | ||
cy.waitTextVisible("Other").click(); | ||
cy.clickOptionWithId("[type=submit]"); | ||
return { name, email }; | ||
}; | ||
|
||
const signIn = () => { | ||
cy.visit("/login"); | ||
cy.enterTextInTestId("username", email); | ||
cy.enterTextInTestId("password", "Example password"); | ||
cy.clickOptionWithId("[type=submit]"); | ||
}; | ||
|
||
const updateAndSave = (Id, groupName, text) => { | ||
cy.clickOptionWithTestId(Id).type(groupName); | ||
cy.get(".rc-virtual-list").contains(text).click({ force: true }); | ||
cy.focused().blur(); | ||
}; | ||
|
||
const clickFocusAndType = (Id, text) => { | ||
cy.clickOptionWithTestId(Id).focused().clear().type(text); | ||
}; | ||
|
||
const clickOnButton = (saveButton) => { | ||
cy.clickOptionWithId(`#${saveButton}`); | ||
}; | ||
|
||
const createPolicy = (description, policyName) => { | ||
clickFocusAndType("policy-description", description); | ||
clickOnButton("nextButton"); | ||
updateAndSave("privileges", "Ingestion", "Manage Metadata Ingestion"); | ||
cy.wait(1000); | ||
clickOnButton("nextButton"); | ||
updateAndSave("users", "All", "All Users"); | ||
clickOnButton("saveButton"); | ||
cy.waitTextVisible("Successfully saved policy."); | ||
cy.ensureTextNotPresent("Successfully saved policy."); | ||
cy.reload(); | ||
searchAndToggleMetadataPolicyStatus(policyName); | ||
cy.get(".ant-table-row-level-0").contains(policyName); | ||
}; | ||
|
||
const searchAndToggleMetadataPolicyStatus = (metadataPolicyName) => { | ||
cy.get('[data-testid="search-input"]').should("be.visible"); | ||
cy.get('[data-testid="search-input"]').last().type(metadataPolicyName); | ||
}; | ||
|
||
const editPolicy = (policyName, type, select) => { | ||
searchAndToggleMetadataPolicyStatus(policyName); | ||
cy.contains("tr", policyName).as("metadataPolicyRow"); | ||
cy.contains("EDIT").click(); | ||
clickOnButton("nextButton"); | ||
cy.clickOptionWithId(".ant-tag-close-icon"); | ||
updateAndSave("privileges", type, select); | ||
clickOnButton("nextButton"); | ||
cy.clickOptionWithId(".ant-tag-close-icon"); | ||
updateAndSave("users", name, name); | ||
clickOnButton("saveButton"); | ||
cy.waitTextVisible("Successfully saved policy."); | ||
}; | ||
|
||
const deactivateExistingAllUserPolicies = () => { | ||
cy.get(".ant-pagination li") | ||
.its("length") | ||
.then((len) => { | ||
const pageCount = len - 2; | ||
for (let page = 1; page <= pageCount; page++) { | ||
cy.get("tbody tr td").should("be.visible"); | ||
cy.get("tbody tr").each(($row) => { | ||
cy.wrap($row) | ||
.find("td") | ||
.eq(3) | ||
.invoke("text") | ||
.then((role) => { | ||
if (role === "All Users") { | ||
cy.wrap($row) | ||
.find("td") | ||
.eq(5) | ||
.find("div button") | ||
.eq(1) | ||
.invoke("text") | ||
.then((buttonText) => { | ||
if (buttonText === "DEACTIVATE") { | ||
cy.wrap($row) | ||
.find("td") | ||
.eq(5) | ||
.find("div button") | ||
.eq(1) | ||
.click(); | ||
cy.waitTextVisible("Successfully deactivated policy."); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
if (page < pageCount) { | ||
cy.contains("li", `${page + 1}`).click(); | ||
cy.ensureTextNotPresent("No Policies"); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
describe("Manage Ingestion and Secret Privileges", () => { | ||
let registeredEmail = ""; | ||
it("create Metadata Ingestion platform policy and assign privileges to all users", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/permissions/policies"); | ||
cy.waitTextVisible("Manage Permissions"); | ||
cy.get(".ant-select-selection-item").should("be.visible").click(); | ||
cy.get(".ant-select-item-option-content").contains("All").click(); | ||
cy.get('[data-icon="delete"]').should("be.visible"); | ||
deactivateExistingAllUserPolicies(); | ||
cy.reload(); | ||
cy.clickOptionWithText("Create new policy"); | ||
clickFocusAndType("policy-name", platform_policy_name); | ||
cy.clickOptionWithId('[data-testid="policy-type"] [title="Metadata"]'); | ||
cy.clickOptionWithTestId("platform"); | ||
createPolicy( | ||
`Platform policy description ${test_id}`, | ||
platform_policy_name, | ||
); | ||
cy.logout(); | ||
}); | ||
|
||
it("Create user and verify ingestion tab not present", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/identities/users"); | ||
cy.waitTextVisible("Invite Users"); | ||
cy.clickOptionWithText("Invite Users"); | ||
cy.waitTextVisible(/signup\?invite_token=\w{32}/).then(($elem) => { | ||
const inviteLink = $elem.text(); | ||
cy.log(inviteLink); | ||
cy.visit("/settings/identities/users"); | ||
cy.logout(); | ||
cy.visit(inviteLink); | ||
const { name, email } = tryToSignUp(); | ||
registeredEmail = email; | ||
cy.waitTextVisible("Welcome to DataHub"); | ||
cy.hideOnboardingTour(); | ||
cy.waitTextVisible(name); | ||
}); | ||
}); | ||
|
||
it("Edit Metadata Ingestion platform policy and assign privileges to the user", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/permissions/policies"); | ||
cy.waitTextVisible("Manage Permissions"); | ||
editPolicy(platform_policy_name, "Ingestion", "Manage Metadata Ingestion"); | ||
}); | ||
|
||
it("Verify new user can see ingestion and access Manage Ingestion tab", () => { | ||
cy.clearCookies(); | ||
cy.clearLocalStorage(); | ||
signIn(); | ||
cy.waitTextVisible("Welcome to DataHub"); | ||
cy.hideOnboardingTour(); | ||
cy.waitTextVisible(name); | ||
cy.clickOptionWithText("Ingestion"); | ||
cy.wait(1000); | ||
cy.get("body").click(); | ||
cy.waitTextVisible("Manage Data Sources"); | ||
cy.waitTextVisible("Sources"); | ||
cy.get(".ant-tabs-nav-list").contains("Source").should("be.visible"); | ||
cy.get(".ant-tabs-tab").should("have.length", 1); | ||
}); | ||
|
||
it("Verify new user can see ingestion and access Manage Secret tab", () => { | ||
cy.clearCookies(); | ||
cy.clearLocalStorage(); | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/permissions/policies"); | ||
cy.waitTextVisible("Manage Permissions"); | ||
editPolicy(platform_policy_name, "Secret", "Manage Secrets"); | ||
cy.logout(); | ||
signIn(); | ||
cy.waitTextVisible("Welcome to DataHub"); | ||
cy.hideOnboardingTour(); | ||
cy.waitTextVisible(name); | ||
cy.clickOptionWithText("Ingestion"); | ||
cy.wait(1000); | ||
cy.clickOptionWithId("body"); | ||
cy.waitTextVisible("Manage Data Sources"); | ||
cy.waitTextVisible("Secrets"); | ||
cy.get(".ant-tabs-nav-list").contains("Secrets").should("be.visible"); | ||
cy.get(".ant-tabs-tab").should("have.length", 1); | ||
}); | ||
}); |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!!