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
|
||||
Furthermore I want to be able to stay logged in and logout again
|
||||
|
||||
# Background:
|
||||
# Given the following "users" are in the database:
|
||||
# | email | password | name |
|
||||
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg |
|
||||
# TODO for these pre-conditions utilize seeding or API check, if user exists in test system
|
||||
# Background:
|
||||
# Given the following "users" are in the database:
|
||||
# | email | password | name |
|
||||
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg |
|
||||
|
||||
Scenario: Log in successfully
|
||||
Given the browser navigates to page "/login"
|
||||
When the user submits the credentials "bibi@bloxberg.de" "Aa12345_"
|
||||
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 {
|
||||
// selectors
|
||||
emailInputSelector = '[id=Email-input-field]';
|
||||
passwordInputSelector = '[id=Passwort-input-field]';
|
||||
submitBtnSelector = '[type=submit]';
|
||||
emailHintSelector = '[id=vee_Email]';
|
||||
passwordHintSelector = '[id=vee_Passwort]';
|
||||
emailInput = '#Email-input-field';
|
||||
passwordInput = '#Passwort-input-field';
|
||||
submitBtn = '[type=submit]';
|
||||
emailHint = '#vee_Email';
|
||||
passwordHint = '#vee_Passwort';
|
||||
|
||||
goto() {
|
||||
cy.visit('/');
|
||||
@ -14,17 +14,17 @@ export class LoginPage {
|
||||
}
|
||||
|
||||
enterEmail(email: string) {
|
||||
cy.get(this.emailInputSelector).clear().type(email);
|
||||
cy.get(this.emailInput).clear().type(email);
|
||||
return this;
|
||||
}
|
||||
|
||||
enterPassword(password: string) {
|
||||
cy.get(this.passwordInputSelector).clear().type(password);
|
||||
cy.get(this.passwordInput).clear().type(password);
|
||||
return this;
|
||||
}
|
||||
|
||||
submitLogin() {
|
||||
cy.get(this.submitBtnSelector).click();
|
||||
cy.get(this.submitBtn).click();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export class OverviewPage {
|
||||
navbarNameSelector = '[data-test="navbar-item-username"]';
|
||||
navbarName = '[data-test="navbar-item-username"]';
|
||||
|
||||
goto() {
|
||||
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 { LoginPage } from "../models/LoginPage";
|
||||
import { LoginPage } from "../../e2e/models/LoginPage";
|
||||
|
||||
When("the user submits the credentials {string} {string}", (email: string, password: string) => {
|
||||
const loginPage = new LoginPage;
|
||||
Loading…
x
Reference in New Issue
Block a user