mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update user authentication feature test
This commit is contained in:
parent
9890898191
commit
7e20531f39
@ -4,14 +4,14 @@ Feature: User authentication
|
|||||||
In order to be able to posts and do other contributions as myself
|
In order to be able to posts and do other contributions as myself
|
||||||
Furthermore I want to be able to stay logged in and logout again
|
Furthermore I want to be able to stay logged in and logout again
|
||||||
|
|
||||||
# Background:
|
# TODO for these pre-conditions utilize seeding or API check, if user exists in test system
|
||||||
# Given the following "users" are in the database:
|
# Background:
|
||||||
# | email | password | name |
|
# Given the following "users" are in the database:
|
||||||
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg |
|
# | email | password | name |
|
||||||
|
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg |
|
||||||
|
|
||||||
Scenario: Log in successfully
|
Scenario: Log in successfully
|
||||||
Given the browser navigates to page "/login"
|
Given the browser navigates to page "/login"
|
||||||
When the user submits the credentials "bibi@bloxberg.de" "Aa12345_"
|
When the user submits the credentials "bibi@bloxberg.de" "Aa12345_"
|
||||||
Then the user is logged in with username "Bibi Bloxberg"
|
Then the user is logged in with username "Bibi Bloxberg"
|
||||||
|
|
||||||
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
import users from '../fixtures/users'
|
|
||||||
import LoginPage from './models/LoginPage'
|
|
||||||
|
|
||||||
describe('Gradido', () => {
|
|
||||||
let userData;
|
|
||||||
|
|
||||||
before(() => {
|
|
||||||
cy.fixture('users').then((usersFixture) => {
|
|
||||||
userData = usersFixture;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('login test (happy path)', () => {
|
|
||||||
const loginPage = new LoginPage();
|
|
||||||
loginPage.goto();
|
|
||||||
loginPage.enterEmail(userData.user.email);
|
|
||||||
loginPage.enterPassword(userData.user.password);
|
|
||||||
loginPage.submitLogin();
|
|
||||||
cy.url().should('be.equal', `${Cypress.config('baseUrl')}/overview`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
export class LoginPage {
|
export class LoginPage {
|
||||||
// selectors
|
// selectors
|
||||||
emailInputSelector = '[id=Email-input-field]';
|
emailInput = '#Email-input-field';
|
||||||
passwordInputSelector = '[id=Passwort-input-field]';
|
passwordInput = '#Passwort-input-field';
|
||||||
submitBtnSelector = '[type=submit]';
|
submitBtn = '[type=submit]';
|
||||||
emailHintSelector = '[id=vee_Email]';
|
emailHint = '#vee_Email';
|
||||||
passwordHintSelector = '[id=vee_Passwort]';
|
passwordHint = '#vee_Passwort';
|
||||||
|
|
||||||
goto() {
|
goto() {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
@ -14,17 +14,17 @@ export class LoginPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enterEmail(email: string) {
|
enterEmail(email: string) {
|
||||||
cy.get(this.emailInputSelector).clear().type(email);
|
cy.get(this.emailInput).clear().type(email);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
enterPassword(password: string) {
|
enterPassword(password: string) {
|
||||||
cy.get(this.passwordInputSelector).clear().type(password);
|
cy.get(this.passwordInput).clear().type(password);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
submitLogin() {
|
submitLogin() {
|
||||||
cy.get(this.submitBtnSelector).click();
|
cy.get(this.submitBtn).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
export class OverviewPage {
|
export class OverviewPage {
|
||||||
navbarNameSelector = '[data-test="navbar-item-username"]';
|
navbarName = '[data-test="navbar-item-username"]';
|
||||||
|
|
||||||
goto() {
|
goto() {
|
||||||
cy.visit('/overview');
|
cy.visit('/overview');
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { Then } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
import { OverviewPage } from "../../e2e/models/OverviewPage";
|
||||||
|
|
||||||
|
Then("the user is logged in with username {string}", (username: string) => {
|
||||||
|
const overviewPage = new OverviewPage();
|
||||||
|
cy.url().should('include', '/overview')
|
||||||
|
cy.get(overviewPage.navbarName).should('contain', username);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
import { When } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
import { LoginPage } from "../models/LoginPage";
|
import { LoginPage } from "../../e2e/models/LoginPage";
|
||||||
|
|
||||||
When("the user submits the credentials {string} {string}", (email: string, password: string) => {
|
When("the user submits the credentials {string} {string}", (email: string, password: string) => {
|
||||||
const loginPage = new LoginPage;
|
const loginPage = new LoginPage;
|
||||||
Loading…
x
Reference in New Issue
Block a user