Skip to content

Commit

Permalink
Login Screen testCase
Browse files Browse the repository at this point in the history
  • Loading branch information
abertnamanya committed Jul 19, 2023
1 parent c4141c3 commit 1c579ea
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions react-ui/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ module.exports = defineConfig({
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: "https://localhost"
},
});
24 changes: 24 additions & 0 deletions react-ui/cypress/e2e/login.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import HomePage from "../pages/HomePage";
import LoginPage from "../pages/LoginPage";

const login = new LoginPage();

describe('Failing or Succeeding to Login', function () {

before(() => {
login.visit();
// login.acceptSelfAssignedCert();
});

it('User should enter username', function () {
login.enterUsername("admin");
login.getUsernameElement().should('contain.value', 'admin')
});

it('User should enter password', function () {
login.enterPassword("adminADMIN!");
login.getPasswordElement().should('contain.value', 'adminADMIN!');
});


});
16 changes: 16 additions & 0 deletions react-ui/cypress/pages/HomePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import LoginPage from "./LoginPage";

class HomePage {
constructor() {
}

visit() {
cy.visit('/');
}

goToSign() {
return new LoginPage();
}
}

export default HomePage;
49 changes: 49 additions & 0 deletions react-ui/cypress/pages/LoginPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class LoginPage {
constructor() {
}

visit() {
cy.visit('/login');
}

getUsernameElement() {
return cy.get(`.inputText .cds--text-input--md`);
}

getPasswordElement() {
return cy.get(`input#password`);
}

enterUsername(value) {
const field = this.getUsernameElement();
field.clear();
field.type(value);
return this;
}

enterPassword(value) {
const field = this.getPasswordElement();
field.clear();
field.type(value);
return this;
}

checkInvalidPassword() {

}

signIn() {
const button = cy.get(`[type='submit']`);
button.click();
}

acceptSelfAssignedCert() {
const detailsOption = cy.get(`#details-button`);
detailsOption.click();
const link = cy.get(`#proceed-link`);
link.click();

}
}

export default LoginPage;

0 comments on commit 1c579ea

Please sign in to comment.