diff --git a/app/views/team/_team.html.erb b/app/views/team/_team.html.erb
index 616bafdc88..4fb5d89df1 100644
--- a/app/views/team/_team.html.erb
+++ b/app/views/team/_team.html.erb
@@ -41,11 +41,11 @@
<% end %>
<% end %>
-
+ |
<% if policy(:team).destroy? %>
<%= link_to team_path(member), data: { confirm: "Are you sure?" }, method: :delete do %>
- <%= image_tag 'delete_image_button.svg', class:"table__button" %>
+ <%= image_tag 'delete_image_button.svg', class:"table__button", "data-cy": "delete-team-member-button" %>
<% end %>
<% end %>
diff --git a/cypress/constants/selectors/team.js b/cypress/constants/selectors/team.js
index 3b104814c9..8aaa4ada88 100644
--- a/cypress/constants/selectors/team.js
+++ b/cypress/constants/selectors/team.js
@@ -14,5 +14,5 @@ export const teamTabSelector = {
newMemberEmail: dataCy("new-member-email"),
adminRadioButton: dataCy("admin-radio-button"),
employeeRadioButton: dataCy("employee-radio-button"),
- sendInviteButton: dataCy("send-invite-button")
+ sendInviteButton: dataCy("send-invite-button"),
};
diff --git a/cypress/integration/signup.spec.js b/cypress/integration/signup.spec.js
deleted file mode 100644
index 0faeb4c3a7..0000000000
--- a/cypress/integration/signup.spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import { signUpPath } from "../constants/routes/paths";
-import { signInPath } from "../constants/routes/paths";
-import { authSelectors } from "../constants/selectors/auth";
-
-describe("Sign_up", () => {
- beforeEach(function () {
- cy.visit(signUpPath);
- });
-
- it("should give error on clicking signup with blank values", function () {
- cy.get(authSelectors.signUpButton).click();
-
- //should contain error message for empty fields.
- cy.contains(" First and last name can't be blank ");
- cy.contains(" Email can't be blank ");
- cy.contains(" Password can't be blank ");
- });
-
- it("should contain signUp with Google Link", function () {
- cy.get(authSelectors.signUpwithGoogleButton).should("be.visible");
- });
-
- // it("should contain signUp with Apple Link", function () {
- // cy.get(authSelectors.signUpwithAppleButton).should("be.visible");
- // });
-
- it("should contain signIn Link", function () {
- cy.get(authSelectors.signInLink).should("be.visible");
- cy.get(authSelectors.signInLink).click();
- cy.url().should("include", signInPath);
- });
-});
diff --git a/cypress/integration/team/teamPageForAdmin.spec.js b/cypress/integration/team/teamPageForAdmin.spec.js
index ddf0ddf74d..0d9138e827 100644
--- a/cypress/integration/team/teamPageForAdmin.spec.js
+++ b/cypress/integration/team/teamPageForAdmin.spec.js
@@ -1,5 +1,6 @@
-import { teamPath, signInPath } from "../../constants/routes/paths";
-import { navbarSelectors } from "../../constants/selectors/navbar";
+import { teamPath, signInPath, mailPath } from "../../constants/routes/paths";
+import { teamTabSelector } from "../../constants/selectors/team";
+import { addNewUser } from "../../support/utils/team";
describe("Team page for Admin", () => {
beforeEach(function () {
@@ -11,8 +12,25 @@ describe("Team page for Admin", () => {
cy.visit(teamPath);
});
- it("should be able to add new user", function () {});
- it("should display all column names", function () {});
- it("should be able to update user details", function () {});
- it("should be able to delete user", function () {});
+ it("should be able to add new Admin user", function () {
+ addNewUser("admin");
+ cy.reload();
+ // deleteTestUser(); -- to be fixed
+ });
+ it("should be able to add new Emp user", function () {
+ addNewUser();
+ // deleteTestUser(); -- to be fixed
+ });
+ it("should display all column names", function () {
+ cy.get(teamTabSelector.teamTableHeader).contains("PHOTO");
+ cy.get(teamTabSelector.teamTableHeader).contains("NAME");
+ cy.get(teamTabSelector.teamTableHeader).contains("EMAIL ID");
+ cy.get(teamTabSelector.teamTableHeader).contains("ROLE");
+ });
+ it("should be able to update user details", function () {
+ cy.get(teamTabSelector.teamTableRow)
+ .find(teamTabSelector.editTeamMemberButton)
+ .first()
+ .click();
+ });
});
diff --git a/cypress/integration/team/teamPageForEmployee.spec.js b/cypress/integration/team/teamPageForEmployee.spec.js
index b5dfac20f6..cf574080bd 100644
--- a/cypress/integration/team/teamPageForEmployee.spec.js
+++ b/cypress/integration/team/teamPageForEmployee.spec.js
@@ -1,5 +1,6 @@
import { teamPath, signInPath } from "../../constants/routes/paths";
-import { navbarSelectors } from "../../constants/selectors/navbar";
+import { teamTabSelector } from "../../constants/selectors/team";
+import { addNewUser } from "../../support/utils/team";
describe("Team page for Employee", () => {
beforeEach(function () {
@@ -11,7 +12,19 @@ describe("Team page for Employee", () => {
cy.visit(teamPath);
});
- it("should be able to add new user", function () {});
- it("should display all column names", function () {});
- it("should be able to update user details", function () {});
+ it("should be not be able to add new user", function () {
+ cy.get(teamTabSelector.addNewUserButton).should("not.exist");
+ });
+ it("should display all column names", function () {
+ cy.get(teamTabSelector.teamTableHeader).contains("PHOTO");
+ cy.get(teamTabSelector.teamTableHeader).contains("NAME");
+ cy.get(teamTabSelector.teamTableHeader).contains("EMAIL ID");
+ cy.get(teamTabSelector.teamTableHeader).contains("ROLE");
+ });
+ it("should not see edit button", function () {
+ cy.get(teamTabSelector.editTeamMemberButton).should("not.exist");
+ });
+ it("should not see delete button", function () {
+ cy.get(teamTabSelector.deleteTeamMemberButton).should("not.exist");
+ });
});
diff --git a/cypress/integration/team/teamPageForOwner.spec.js b/cypress/integration/team/teamPageForOwner.spec.js
index c4ed079778..76b06bcf68 100644
--- a/cypress/integration/team/teamPageForOwner.spec.js
+++ b/cypress/integration/team/teamPageForOwner.spec.js
@@ -12,16 +12,14 @@ describe("Team page for Owner", () => {
cy.visit(teamPath);
});
- it.only("should be able to add new Admin user", function () {
+ it("should be able to add new Admin user", function () {
addNewUser("admin");
cy.reload();
+ // deleteTestUser(); -- to be fixed
});
it("should be able to add new Emp user", function () {
addNewUser();
-
- //delete user
- cy.get(teamTabSelector.searchTeamMemberPlaceholder).clear().type("dummy");
- cy.get(teamTabSelector.deleteTeamMemberButton).first().click();
+ // deleteTestUser(); -- to be fixed
});
it("should display all column names", function () {
cy.get(teamTabSelector.teamTableHeader).contains("PHOTO");
@@ -35,10 +33,4 @@ describe("Team page for Owner", () => {
.first()
.click();
});
- it("should be able to delete user", function () {
- //Add a team member and delete.
- cy.get(teamTabSelector.teamTableRow).find(
- teamTabSelector.deleteTeamMemberButton
- );
- });
});
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 03b3e43223..3b3f2397fd 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -27,23 +27,3 @@ Cypress.Commands.add("loginAsEmployee", function () {
cy.get(authSelectors.signInButton).click();
cy.location("pathname").should("eq", "/time-tracking");
});
-
-//add new admin user from Team tab
-Cypress.Commands.add("addNewAdminUser", function () {
- cy.get(teamTabSelector.addNewUserButton).click();
- cy.get(teamTabSelector.newMemberFirstName).type("Dummy Admin FirstName");
- cy.get(teamTabSelector.newMemberLastname).type("Dummy Admin LastName");
- cy.get(teamTabSelector.newMemberEmail).type("test@email.com");
- cy.get(teamTabSelector.adminRadioButton).check();
- cy.get(teamTabSelector.sendInviteButton).click();
-});
-
-//add new employee user from Team tab
-Cypress.Commands.add("addNewEmpUser", function () {
- cy.get(teamTabSelector.addNewUserButton).click();
- cy.get(teamTabSelector.newMemberFirstName).type("Dummy Emp FirstName");
- cy.get(teamTabSelector.newMemberLastname).type("Dummy Emp LastName");
- cy.get(teamTabSelector.newMemberEmail).type("test@email.com");
- cy.get(teamTabSelector.employeeRadioButton).check();
- cy.get(teamTabSelector.sendInviteButton).click();
-});
diff --git a/cypress/support/utils/datacy.js b/cypress/support/utils/datacy.js
index adc7b15c8d..1c0fc41de9 100644
--- a/cypress/support/utils/datacy.js
+++ b/cypress/support/utils/datacy.js
@@ -1,3 +1,3 @@
export const dataCy = (value, suffix = "") => {
- return `[data-cy='${value}']${suffix}`;
+ return `[data-cy='${value}']${suffix}`;
};
diff --git a/cypress/support/utils/team.js b/cypress/support/utils/team.js
index 97f076391a..46d0f0ec0b 100644
--- a/cypress/support/utils/team.js
+++ b/cypress/support/utils/team.js
@@ -1,6 +1,6 @@
import { teamTabSelector } from "../../constants/selectors/team";
-export const addNewUser = role => {
+export const addNewUser = (role) => {
cy.get(teamTabSelector.addNewUserButton).click();
cy.get(teamTabSelector.newMemberFirstName).type("Dummy Emp FirstName");
cy.get(teamTabSelector.newMemberLastname).type("Dummy Emp LastName");
|