-
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
Cypress test for managing groups #8520
Merged
anshbansal
merged 2 commits into
datahub-project:master
from
kkorchak:origin/CypressTestForManagingGroups
Aug 2, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
116 changes: 116 additions & 0 deletions
116
smoke-test/tests/cypress/cypress/e2e/settings/managing_groups.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,116 @@ | ||
const test_id = Math.floor(Math.random() * 100000); | ||
const username = `Example Name ${test_id}`; | ||
const email = `example${test_id}@example.com` | ||
const password = "Example password" | ||
const group_name = `Test group ${test_id}`; | ||
|
||
describe("create and manage group", () => { | ||
it("add test user", () => { | ||
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.visit("/settings/identities/users"); | ||
cy.logout(); | ||
cy.visit(inviteLink); | ||
cy.enterTextInTestId("email", email); | ||
cy.enterTextInTestId("name", username); | ||
cy.enterTextInTestId("password", password); | ||
cy.enterTextInTestId("confirmPassword", password); | ||
cy.mouseover("#title").click(); | ||
cy.waitTextVisible("Other").click(); | ||
cy.get("[type=submit]").click(); | ||
cy.waitTextVisible("Welcome to DataHub"); | ||
cy.hideOnboardingTour(); | ||
cy.waitTextVisible(username); | ||
}) | ||
}); | ||
|
||
it("create a group", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/identities/groups") | ||
cy.waitTextVisible("Create group"); | ||
cy.clickOptionWithText("Create group"); | ||
cy.waitTextVisible("Create new group"); | ||
cy.get("#name").type(group_name); | ||
cy.get("#description").type("Test group description"); | ||
cy.contains("Advanced").click(); | ||
cy.waitTextVisible("Group Id"); | ||
cy.get("#groupId").type(test_id); | ||
cy.get("#createGroupButton").click(); | ||
cy.waitTextVisible("Created group!"); | ||
cy.waitTextVisible(group_name); | ||
}); | ||
|
||
it("add test user to a group", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/identities/users"); | ||
cy.get(".ant-tabs-tab-btn").contains("Groups").click(); | ||
cy.clickOptionWithText(group_name); | ||
cy.get(".ant-typography").contains(group_name).should("be.visible"); | ||
cy.get(".ant-tabs-tab").contains("Members").click(); | ||
cy.waitTextVisible("No members in this group yet."); | ||
cy.clickOptionWithText("Add Member"); | ||
cy.contains("Search for users...").click({ force: true }); | ||
cy.focused().type(username); | ||
cy.get(".ant-select-item-option").contains(username).click(); | ||
cy.focused().blur(); | ||
cy.contains(username).should("have.length", 1); | ||
cy.get('[role="dialog"] button').contains("Add").click({ force: true }); | ||
cy.waitTextVisible("Group members added!"); | ||
cy.contains(username, {timeout: 10000}).should("be.visible"); | ||
}); | ||
|
||
it("update group info", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/identities/groups"); | ||
cy.clickOptionWithText(group_name); | ||
cy.contains(group_name).find('[aria-label="Edit"]').click(); | ||
cy.focused().clear().type(`Test group EDITED ${test_id}{enter}`); | ||
cy.waitTextVisible("Name Updated"); | ||
cy.contains(`Test group EDITED ${test_id}`).should("be.visible"); | ||
cy.contains("Test group description").find('[aria-label="edit"]').click(); | ||
cy.focused().type(" EDITED{enter}"); | ||
cy.waitTextVisible("Changes saved."); | ||
cy.contains("Test group description EDITED").should("be.visible"); | ||
cy.clickOptionWithText("Add Owners"); | ||
cy.contains("Search for users or groups...").click({ force: true }); | ||
cy.focused().type(Cypress.env('ADMIN_USERNAME')); | ||
cy.get(".ant-select-item-option").contains(Cypress.env('ADMIN_USERNAME'), { matchCase: false }).click(); | ||
cy.focused().blur(); | ||
cy.contains(Cypress.env('ADMIN_USERNAME')).should("have.length", 1); | ||
cy.get('[role="dialog"] button').contains("Done").click(); | ||
cy.waitTextVisible("Owners Added"); | ||
cy.contains(Cypress.env('ADMIN_USERNAME'), { matchCase: false }).should("be.visible"); | ||
cy.clickOptionWithText("Edit Group"); | ||
cy.waitTextVisible("Edit Profile"); | ||
cy.get("#email").type(`${test_id}@testemail.com`); | ||
cy.get("#slack").type(`#${test_id}`); | ||
cy.clickOptionWithText("Save Changes"); | ||
cy.waitTextVisible("Changes saved."); | ||
cy.waitTextVisible(`${test_id}@testemail.com`); | ||
cy.waitTextVisible(`#${test_id}`); | ||
}); | ||
|
||
it("test user verify group participation", () => { | ||
cy.loginWithCredentials(email,password); | ||
cy.visit("/settings/identities/groups"); | ||
cy.hideOnboardingTour(); | ||
cy.clickOptionWithText(`Test group EDITED ${test_id}`); | ||
cy.get(".ant-tabs-tab").contains("Members").click(); | ||
cy.waitTextVisible(username); | ||
}); | ||
|
||
it("remove group", () => { | ||
cy.loginWithCredentials(); | ||
cy.visit("/settings/identities/groups"); | ||
cy.get(`[href="/group/urn:li:corpGroup:${test_id}"]`).next().click(); | ||
cy.clickOptionWithText("Delete"); | ||
cy.clickOptionWithText("Yes"); | ||
cy.waitTextVisible("Deleted Group!"); | ||
cy.ensureTextNotPresent(`Test group EDITED ${test_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
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.
nice!!