Skip to content

Commit

Permalink
Addressing code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Velang RN authored and Velang RN committed Aug 31, 2022
1 parent 3a2c66d commit d32f51c
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/>
<v-list-subheader class="nav-subtitle">Locations</v-list-subheader>
<v-list-group
v-for="location in locationsMenu"
v-for="(location,index) in locationsMenu"
:key="location.label"
collapse-icon="mdi-chevron-up"
expand-icon="mdi-chevron-down"
Expand All @@ -26,6 +26,7 @@
:title="location.label"
:prepend-icon="location.icon"
:value="location.value"
:data-cy="`Location- ${index}`"
>
<v-tooltip activator="parent">{{ location.label }}</v-tooltip>
</v-list-item>
Expand Down
7 changes: 1 addition & 6 deletions testing/src/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@ export default defineConfig({
video: false,
chromeWebSecurity: false,
defaultCommandTimeout: 10000,
numTestsKeptInMemory: 0,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
// baseUrl: "https://dev-aest-sims.apps.silver.devops.gov.bc.ca/",
}
numTestsKeptInMemory: 0
});
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import LoginInstitutionObject from "../../page-objects/Institution-objects/LoginInstitutionObject";

export default class InstitutionCustomCommand {
loginWithCredentials(uname: string, pass: string) {
loginWithCredentials(username: string, password: string) {
const loginInstitutionObject = new LoginInstitutionObject();

loginInstitutionObject.loginWithBCEID().should("be.visible").click();
loginInstitutionObject.loginInWithBCEIDtext().should("be.visible");

loginInstitutionObject
.bceidInputText()
.type(uname)
.should("have.value", uname);
.type(username)
.should("have.value", username);
loginInstitutionObject
.passwordInputText()
.type(pass)
.should("have.value", pass);
.type(password)
.should("have.value", password);
loginInstitutionObject.continueButton().click();
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import DashboardInstitutionObject from "../../page-objects/Institution-objects/DashboardInstitutionObject";
import InstitutionCustomCommand from "../../custom-command/institution/InstitutionCustomCommand";
import LoginInstitutionObject from "../../page-objects/Institution-objects/LoginInstitutionObject";
import InstitutionHelperActions from "./common-helper-functions.cy";

const dashboardObject = new DashboardInstitutionObject();
const iCC = new InstitutionCustomCommand();
const institutionCustomCommand = new InstitutionCustomCommand();
const loginObject = new LoginInstitutionObject();
const helperActions = new InstitutionHelperActions();

const LOGIN_URL = Cypress.env("TEST").BASE_URL + "/institution/login";
const UNAME = Cypress.env("TEST").UNAME_1;
const PASS = Cypress.env("TEST").PASS_1;
const LOGIN_URL = helperActions.getLoginUrlForTestEnv();
const USERNAME = helperActions.getUserNameSingleLocation();
const PASSWORD = helperActions.getUserPasswordSingleLocation();

describe("Login Page", () => {
beforeEach(() => {
cy.visit(LOGIN_URL);
});

it("Verify invalid uname/password field validation error", () => {
iCC.loginWithCredentials("invalid", "invalid");
it("Verify invalid username/password field validation error", () => {
// Please note that this is not a functionality that our team owns. If there is any issue with the test case, it should not be a blocker.
institutionCustomCommand.loginWithCredentials("invalid", "invalid");
loginObject
.errorMessage()
.should("have.text", "The user ID or password you entered is incorrect");
});

it("Verify login and logout successfully logout", () => {
iCC.loginWithCredentials(UNAME, PASS);
it("Verify login successfully", () => {
institutionCustomCommand.loginWithCredentials(USERNAME, PASSWORD);
loginObject.welcomeMessageDashboard().should("be.visible");
});

it("Verify logout successfully", () => {
institutionCustomCommand.loginWithCredentials(USERNAME, PASSWORD);
dashboardObject.iconButton().click();
dashboardObject.logOutButton().click();
loginObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import DashboardInstitutionObject from "../../page-objects/Institution-objects/DashboardInstitutionObject";
import InstitutionCustomCommand from "../../custom-command/institution/InstitutionCustomCommand";
import ManageInstitutionObject from "../../page-objects/Institution-objects/ManageInstitutionObject";
import InstitutionHelperActions from "./common-helper-functions.cy";

const dashboardObject = new DashboardInstitutionObject();
const iCC = new InstitutionCustomCommand();
const institutionCustomCommand = new InstitutionCustomCommand();
const manageInstituionObject = new ManageInstitutionObject();
const institutionHelperActions = new InstitutionHelperActions()

const LOGIN_URL = Cypress.env("TEST").BASE_URL + "/institution/login";
const UNAME = Cypress.env("TEST").UNAME_1;
const PASS = Cypress.env("TEST").PASS_1;
const URL = institutionHelperActions.getLoginUrlForTestEnv();
const USERNAME = institutionHelperActions.getUserNameSingleLocation();
const PASSWORD = institutionHelperActions.getUserPasswordSingleLocation();

describe("Dashboard Page", () => {
beforeEach(() => {
cy.visit(LOGIN_URL);
iCC.loginWithCredentials(UNAME, PASS);
cy.visit(URL);
institutionCustomCommand.loginWithCredentials(USERNAME, PASSWORD);
});

it("Verify that user is redirected to dashboard page", () => {
Expand All @@ -36,7 +38,7 @@ describe("Dashboard Page", () => {
it("Verify that all buttons are clickable in dashboard and redirect to appropriate pages.", () => {
dashboardObject.dashboardButton().click();
dashboardObject.notificationButton().click();
//needs validation with the notifications
//Needs validation with the notifications.
dashboardObject.homeButton().click();
dashboardObject.locationButton().click();
dashboardObject.manageInstitutionButton().click();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export default class InstitutionHelperActions {

getBaseUrlForTestEnv() {
return Cypress.env("TEST").BASE_URL;
}

getLoginUrlForTestEnv(){
return this.getBaseUrlForTestEnv() + "/institution/login"
}

getApiUrlForTest(){
return this.getBaseUrlForTestEnv() + "/api/institutions"
}

getUserNameSingleLocation() {
return Cypress.env("TEST").USERNAME_SINGLE_LOCATION;
}

getUserPasswordSingleLocation() {
return Cypress.env("TEST").USER_PASSWORD_SINGLE_LOCATION;
}

getUserDetailsSingleLocation(){
return Cypress.env("USER_DETAILS").USER_SINGLE_LOCATION;
}

getInstitutionDetailsSingleLocation(){
return Cypress.env("INSTITUTION_DETAILS_SINGLE_LOCATION");
}

getToken(){
return Cypress.env("TEST").TOKEN
}
}
Loading

0 comments on commit d32f51c

Please sign in to comment.