From cbd917702278389594ebe7d188d2c6950990d09c Mon Sep 17 00:00:00 2001 From: UO277876 <79647031+UO277876@users.noreply.github.com> Date: Sat, 23 Apr 2022 00:27:39 +0200 Subject: [PATCH 01/80] v1 test webapp --- webapp/e2e/steps/register-form.steps.ts | 21 +++++++++++---------- webapp/src/components/Login/Register.tsx | 3 ++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/webapp/e2e/steps/register-form.steps.ts b/webapp/e2e/steps/register-form.steps.ts index 0766965..240074e 100644 --- a/webapp/e2e/steps/register-form.steps.ts +++ b/webapp/e2e/steps/register-form.steps.ts @@ -1,6 +1,5 @@ import { defineFeature, loadFeature } from 'jest-cucumber'; -import puppeteer from "puppeteer"; - +import puppeteer from "puppeteer"; const feature = loadFeature('./features/register-form.feature'); let page: puppeteer.Page; @@ -23,25 +22,27 @@ defineFeature(feature, test => { test('The user is not registered in the site', ({given,when,then}) => { - let email:string; + // En el login tenemos user + pass let username:string; + let password:string; given('An unregistered user', () => { - email = "newuser@test.com" - username = "newuser" + username = "client1" + password = "pass1" }); when('I fill the data in the form and press submit', async () => { - await expect(page).toMatch('Hi, ASW students') - await expect(page).toFillForm('form[name="register"]', { + await expect(page).toMatch('Registro') + await expect(page).toFillForm('form[name="registro"]', { username: username, - email: email, + password: password, + confirmpassword: password }) - await expect(page).toClick('button', { text: 'Accept' }) + await expect(page).toClick('button', { text: 'Registrarse' }) }); then('A confirmation message should be shown in the screen', async () => { - await expect(page).toMatch('You have been registered in the system!') + await expect(page).toMatch('Usuario añadido') }); }) diff --git a/webapp/src/components/Login/Register.tsx b/webapp/src/components/Login/Register.tsx index 5eb1308..b0f1ce5 100644 --- a/webapp/src/components/Login/Register.tsx +++ b/webapp/src/components/Login/Register.tsx @@ -53,6 +53,7 @@ const Register = () => { const item = {"username":userName,"password":password}; // Almacenamos el usuario en sesión sessionStorage.setItem('user',JSON.stringify(item)); + alert("Usuario añadido"); window.location.href='http://localhost:3000/'; } else{ @@ -70,7 +71,7 @@ const Register = () => { } return ( <>