Automated testing conversational ChatBots with Playwright

Execute Automation
27 Apr 202109:29

Summary

TLDREn este video, Kartik de azureautomation.com muestra cómo construir y automatizar un bot utilizando herramientas de prueba de automatización como Playwright. Destaca la facilidad de automatizar bots, dado que se reducen a un DOM y pueden ser controlados por herramientas de prueba. Kartik también explica cómo utilizar servicios de terceros para crear bots y luego automatizarlos con Playwright, demostrando el proceso paso a paso y cómo generar código de prueba a partir de la grabación de acciones en el navegador.

Takeaways

  • 🤖 El video muestra cómo construir y automatizar un bot utilizando herramientas de prueba de automatización como Playwright.
  • 🔧 Los bots se pueden construir fácilmente con servicios de terceros y son más accesibles para la automatización debido a su estructura en DOM.
  • 🌐 La automatización de los bots es más eficiente cuando se tienen herramientas de prueba que pueden identificar elementos del DOM.
  • 🛠️ Las aplicaciones modernas, construidas con TDD en mente, incluyen identificadores únicos que facilitan la automatización.
  • 📝 Se puede pedir a los desarrolladores que añadan identificadores únicos a los bots para facilitar su automatización sin código frágil.
  • 📚 El video utiliza Landbot.io para crear un chatbot y muestra cómo personalizar y utilizar plantillas predefinidas.
  • 📲 Se muestra cómo el bot creado puede ser accedido a través de un enlace y probado en un navegador privado.
  • 🔄 El video incluye una demostración de cómo se puede utilizar Playwright para grabar y reproducir acciones en el bot.
  • 📝 Se discute la posibilidad de utilizar otros herramientas de automatización como Selenium, Cypress o Puppeteer para bots basados en DOM.
  • 🛑 El video enfatiza la importancia de la automatización de los bots y cómo cualquier herramienta de automatización puede ser utilizada para ello.
  • 👋 El video concluye agradeciendo a los espectadores y destacando la simplicidad de automatizar bots con herramientas de prueba.

Q & A

  • ¿Quién es el presentador del video y de qué trata su canal en azureautomation.com?

    -El presentador del video es Kartik y su canal en azureautomation.com se dedica a enseñar cómo automatizar tareas utilizando herramientas de automatización de Azure.

  • ¿Qué herramienta de testing automatizado se utiliza para crear y probar bots en el video?

    -Se utiliza la herramienta de testing automatizado Playwright para crear y probar bots en el video.

  • ¿Por qué es más fácil automatizar bots que operan en un navegador?

    -Es más fácil automatizar bots que operan en un navegador porque al final del día, estos bots se reducen a un DOM (Modelo de Objeto de Documento), lo cual es más manejable para las herramientas de automatización que pueden identificar identificadores y manipularlos.

  • ¿Qué son las aplicaciones TDD y cómo facilitan la automatización de pruebas?

    -Las aplicaciones TDD (Desarrollo Dirigido por Pruebas) son aquellas que se construyen teniendo en mente la testabilidad, lo que significa que incluyen identificadores únicos que facilitan la automatización de pruebas.

  • ¿Cómo se pueden incorporar identificadores únicos en un bot para facilitar su automatización?

    -Si el bot es desarrollado por la propia empresa, se puede pedir a los desarrolladores que añadan identificadores únicos que luego se puedan utilizar para automatizar la aplicación de manera más eficiente y sin código de prueba frágil.

  • ¿Qué es landbot.io y cómo se utiliza en el video?

    -Landbot.io es una aplicación para crear bots de chat. En el video, se utiliza para construir un bot de chat desde cero o a partir de una plantilla, y luego se personaliza y se prueba.

  • ¿Qué es una plantilla de chatbot y cómo se puede utilizar para ahorrar tiempo?

    -Una plantilla de chatbot es un conjunto predefinido de mensajes e interacciones que se pueden utilizar para crear rápidamente un bot de chat sin tener que empezar desde cero. En el video, se utiliza una plantilla de generación de leads avanzados para demostrar cómo ahorrar tiempo en el proceso de creación del bot.

  • ¿Cómo se puede previsualizar y compartir un bot creado con landbot.io?

    -Después de crear el bot, se puede previsualizar el mensaje y su apariencia. También se puede compartir el bot mediante un enlace o como un pop-up, y luego se copia y se comparte ese enlace.

  • ¿Qué es Playwright y cómo se utiliza para la automatización de UI en el video?

    -Playwright es una herramienta de automatización de pruebas que permite automatizar la interfaz de usuario de las aplicaciones web. En el video, se utiliza para grabar y reproducir interacciones con el bot creado, lo que permite la automatización de pruebas de UI.

  • ¿Cómo se genera y ejecuta un script de automatización de Playwright en el video?

    -Se utiliza el comando 'npx playwright codegen' seguido de la URL del bot para generar un script de automatización. Luego, se graba una serie de interacciones con el bot utilizando el grabador de Playwright, y se guarda el script generado para ejecutar las pruebas de automatización.

  • ¿Por qué es importante entender que los bots son objetos DOM para la automatización de pruebas?

    -Es importante entender que los bots son objetos DOM porque esto significa que cualquier herramienta de automatización de pruebas que pueda manipular elementos DOM, como Playwright, Puppeteer o Cypress, puede utilizarse para automatizarlos fácilmente.

Outlines

00:00

🤖 Creación y Automatización de Bots con Herramientas de Pruebas

Kartik, de azureautomation.com, presenta un tutorial sobre cómo construir y automatizar un bot utilizando herramientas de prueba automatizadas como Playwright. Explica que los bots, al ser DOM (Modelo de Objeto de Documento), son fáciles de automatizar con herramientas de prueba como Selenium, Cypress o Playwright. Destaca la facilidad de automatizar bots con identificadores únicos, especialmente si son desarrollados internamente y se pueden solicitar a los desarrolladores para facilitar el proceso de automatización. Kartik muestra cómo crear un bot simple utilizando una plataforma como landbot.io y cómo personalizar o utilizar plantillas preexistentes para acelerar el proceso.

05:02

🔧 Automatización de Interfaz de Usuario con Playwright

El segundo párrafo se enfoca en la automatización de la interfaz de usuario de un bot utilizando Playwright, una herramienta de prueba que Kartik ha discutido en detalle en otros contextos. Describe el uso de la función de grabación de Playwright para registrar acciones en el navegador y generar código de prueba automáticamente. Kartik muestra el proceso de grabar una interacción con el bot, desde el inicio hasta la recolección de información de lead, y luego detalla cómo se puede ejecutar esta secuencia grabada utilizando Playwright. Resalta la simplicidad de automatizar elementos DOM y cómo cualquier herramienta de prueba adecuada puede ser utilizada para este fin, independientemente de si se trata de Playwright, Puppeteer o Cypress.

Mindmap

Keywords

💡Azure Automation

Azure Automation es un servicio de la plataforma de nube de Microsoft Azure que permite automatizar tareas en la nube. En el video, se utiliza como el contexto en el que se crea y automatiza un bot, resaltando cómo se puede integrar el servicio con herramientas de automatización de pruebas.

💡Playwright

Playwright es una herramienta de automatización de navegadores que permite escribir scripts de automatización de pruebas en JavaScript, TypeScript, Python, y C#. En el video, se menciona como una herramienta para automatizar bots, destacando su capacidad para interactuar con el DOM y realizar pruebas de interfaz de usuario.

💡Bot

Un bot es un programa de computadora diseñado para interactuar con humanos en el entorno de chat. En el video, se enseña cómo construir un bot de chat utilizando servicios de terceros y cómo automatizarlo con herramientas de prueba.

💡Automatización de pruebas

La automatización de pruebas es el proceso de utilizar programas para ejecutar pruebas de software automáticamente. En el video, se discute cómo la automatización de pruebas puede hacer que los bots se ejecuten más rápido y de manera más eficiente.

💡DOM (Document Object Model)

El DOM es una representación de árbol de objetos de un documento que puede ser manipulado por scripts. En el video, se menciona que los bots, al ser ejecutados en un navegador, se pueden automatizar fácilmente debido a su naturaleza de DOM.

💡Selenium

Selenium es una herramienta de automatización de navegadores web y un marco de pruebas integrado para aplicaciones web. Aunque no se utiliza directamente en el video, se menciona como una alternativa a Playwright para la automatización de bots.

💡Cypress

Cypress es una herramienta de automatización de pruebas de front-end que ofrece una experiencia de desarrollo integrada. Al igual que con Selenium, se menciona en el video como otra opción para la automatización de pruebas de bots.

💡Identificadores únicos

Los identificadores únicos son atributos o nombres descriptivos que se utilizan para identificar elementos en una aplicación o un bot. En el video, se sugiere que agregar estos identificadores facilita la automatización de pruebas, evitando códigos de prueba frágiles.

💡Landbot.io

Landbot.io es una plataforma que permite crear chatbots personalizados. En el video, se utiliza para demostrar cómo construir un bot de chat desde cero o a partir de plantillas predefinidas.

💡Plantillas de chatbots

Las plantillas de chatbots son conjuntos predefinidos de interacciones y flujos de trabajo que se pueden utilizar para crear rápidamente un bot de chat. En el video, se muestra cómo se pueden utilizar para generar un flujo de trabajo complejo de adquisición de clientes.

💡Generación de leads

La generación de leads es el proceso de identificar y calificar a potenciales clientes interesados en un producto o servicio. En el video, se utiliza un bot de generación de leads avanzada como ejemplo para demostrar cómo se puede automatizar el proceso de recolección de información de los clientes.

Highlights

Introduction to building a bot using Azure Automation and third-party services.

Demonstration of how bots can be automated using testing tools like Playwright.

Explanation of the ease of automating bots due to their DOM (Document Object Model) nature.

Mention of popular automation testing tools like Selenium, Cypress, and Playwright.

Discussion on the benefits of TDD (Test-Driven Development) for creating testable applications and bots.

Suggestion to add unique identifiers to bots for easier automation.

Tutorial on building a simple bot using a bot creation application like Landbot.io.

Description of the process to create a chatbot for platforms like Web WhatsApp and Facebook Messenger.

Use of templates in Landbot to quickly generate complex workflows for lead generation.

Previewing and customizing the chatbot draft to ensure it meets specific requirements.

Sharing the created bot via a link or pop-up and testing its functionality.

Automating the UI of the created chatbot using Playwright's automation testing tool.

Explanation of Playwright's capabilities and its usage in various programming languages.

Demonstration of Playwright's test runner and code generation using 'npx playwright cod'.

Recording user interactions with the chatbot and generating test scripts automatically.

Copying and pasting the generated code into a new file for further automation testing.

Execution of the recorded test script to playback the chatbot interaction automatically.

Final thoughts on the ease of automating bots with any DOM-based automation testing tool.

Conclusion and thanks for watching the video on automating bots with Playwright.

Transcripts

play00:00

hi guys my name is kartik and i am from

play00:01

azure automation.com and welcome to

play00:03

another video from azure automation

play00:05

and today we're going to see how we can

play00:07

actually build

play00:08

a bot and automate the bot using an

play00:10

automation testing tool

play00:12

like playwright and it is much much easy

play00:14

to see that how you can build a bot

play00:17

using any third-party services which

play00:18

helps you

play00:19

build the bot and also it's much much

play00:21

easier to automate these bots because

play00:24

as you can see in the demo over here

play00:26

these bots runs

play00:28

much much faster using this automation

play00:30

testing tool

play00:31

because all these bots on the end of day

play00:34

is actually boiled down as a dom

play00:36

or a document object model so if it is

play00:39

running on a browser

play00:40

then it is much much easy to automate

play00:42

them because we have many

play00:44

automation testing tools like selenium

play00:46

or cypress or playwright or any

play00:48

automation testing tool

play00:49

which can identify these part

play00:52

identifiers

play00:53

and then you can automate them it is

play00:55

super easy to do that

play00:56

and again because these applications

play00:58

these days

play00:59

which are being built or considering tdd

play01:02

in mind

play01:03

like testable application in mind these

play01:06

applications or even the bots come

play01:08

with a lot of unique identifier so it is

play01:11

much much easier to automate them

play01:13

at the same time if your bot is being

play01:15

built by your company then it is even

play01:17

more easier for you to go and ask your

play01:19

developer

play01:20

to add a unique identifier so that you

play01:22

can use them

play01:24

to automate your application much easily

play01:26

without any

play01:27

fragile automation testing code so i'm

play01:29

going to show you how to build a simple

play01:31

bot that i have shown you on the demo

play01:33

right now and also i'm going to

play01:34

show you in a couple of minutes like how

play01:36

you can build an automation testing for

play01:38

them

play01:39

and run the automation testing like how

play01:41

we just saw over here

play01:43

all right so let's get started so as you

play01:45

can see over here i actually have

play01:47

a bot creating application like

play01:50

landbot dot io which helps you build a

play01:53

chatbot

play01:54

i mean you can build a chat bot using a

play01:56

web whatsapp

play01:57

a facebook messenger or even an appy

play02:00

chat bot like an application if you

play02:01

wanted to

play02:02

and i'm gonna choose the first one

play02:04

because i don't really want it to do it

play02:06

other way around and then i'm gonna

play02:07

choose the start from scratch

play02:10

over here if you choose that it's gonna

play02:12

help you

play02:13

to show you like what are the message

play02:15

that you really wanted to

play02:16

add so you can select the hi message and

play02:18

then you can drag

play02:19

something like this and then you can put

play02:22

a media message here if you really

play02:24

wanted to

play02:25

or you can send a message saying how are

play02:28

you doing something like that

play02:30

and if you do that it will just show you

play02:33

like once you select hi

play02:35

it will tell you how are you doing and

play02:37

then you can add one more interactions

play02:39

from here

play02:39

then you can say uh saying can you

play02:42

please

play02:43

enter your

play02:48

email something like that and then you

play02:50

can send like a message

play02:51

or the most easiest way to just save the

play02:54

time at least for this video purpose

play02:56

is by creating a altogether

play02:59

a new uh chatbot from the template that

play03:02

we have got so if i

play03:04

go over here you can see there are so

play03:05

many uh templates of chatbots available

play03:08

and i'm going to choose something like

play03:10

an advanced lead generation

play03:12

use this one and then you can see that

play03:15

it is going to show you a very very

play03:17

complex workflow

play03:18

for the lead generation it's all coming

play03:20

automatically

play03:21

by just single click and you can see

play03:23

that you can just customize this if you

play03:25

really wanted to

play03:26

or you can delete this workflow if you

play03:27

really wanted to and things of that

play03:29

nature

play03:30

so i'm just going to choose this guy and

play03:32

i'm just going to preview this draft

play03:34

uh message like how it's going to look

play03:36

like and i'm going to share this

play03:38

bot uh using a link if i wanted to or i

play03:41

can even choose like a pop-up

play03:44

and then i can apply and then i can copy

play03:46

this link so this is the link which i

play03:48

was talking about so if you go

play03:49

uh to any one of the uh

play03:53

browsers so let's say i'm gonna choose a

play03:56

private window over here

play03:58

and i'm gonna switch this if i hit enter

play04:01

you can see that the chat bot that we

play04:04

just created

play04:05

will be available for us over here you

play04:07

can see that

play04:08

and if i hit hi then it's gonna say what

play04:11

is your name

play04:11

so if i put like karthik if i hit

play04:15

uh like that and say nice to meet you

play04:17

karthik so this is one of the message

play04:19

that it gives me so we can test whether

play04:21

the

play04:21

this particular message comes in and

play04:23

then i can add a

play04:26

dummy email and you can see that the

play04:28

email has been added it says a thank you

play04:30

message like a greeting

play04:32

and then it asks me the company name so

play04:34

i can just put the company name over

play04:35

here

play04:36

and if i hit send it's gonna ask me how

play04:39

many employees

play04:40

the company has got the moment just one

play04:43

and asking me

play04:43

what is the average marketing cost i

play04:46

spend

play04:46

i probably spend nothing for ten dollars

play04:50

and then it's asked me a lot of

play04:52

questions over here so i can increase

play04:54

the website or something like that and

play04:56

then you can see that all these details

play04:57

comes in so all these workflows are

play04:59

automatically been created using this

play05:02

uh land bots template which has been

play05:04

available for us

play05:05

and i'm going to automate this

play05:06

particular ui and i'm going to show you

play05:08

how we can do that

play05:10

and again for automating this particular

play05:11

ui i'm going to be doing

play05:13

or using a playwright automation testing

play05:15

tool and i've extensively talked about

play05:17

the playwright

play05:18

in many different language binding like

play05:20

javascript typescript

play05:22

also in java and c-sharp and i also

play05:25

talked about how you can do a lot of

play05:26

network interaction working with cookies

play05:29

data-driven testing and integrating with

play05:31

azure devops github actions

play05:34

and also like how you can run with

play05:36

cucumber pdd support and stuff

play05:38

i have covered everything in this

play05:39

particular course i'm just going to use

play05:40

a snippet of this particular code and i

play05:42

will show you how you can use the

play05:44

playwrights test runner

play05:45

to actually do this for you so i'm

play05:48

actually going to choose one of the

play05:49

projects which i have already shown in

play05:51

my course

play05:52

and i'm going to use the playwright's

play05:56

coding option which is going to be

play05:58

nothing but the playwright

play05:59

test recorder and i'm just going to use

play06:02

npx

play06:05

playwright cod gen of

play06:08

this particular url that we just copied

play06:12

and i'm gonna hit enter so that it is

play06:14

gonna show me a

play06:15

new browser over here and as you can see

play06:18

that

play06:19

it brings me up this particular recorder

play06:21

along with that particular chat

play06:23

bot being loaded for us which is pretty

play06:25

cool and now

play06:26

i can just do a high click you can see

play06:29

that it just shows me the recording

play06:30

option has been going on over there

play06:32

and then i can just enter the name like

play06:35

karthik

play06:36

and that's been recorded as well and i'm

play06:38

gonna say karthik at

play06:41

techgeek.com.in

play06:43

and hit enter so it just brings me up

play06:46

like karthik i can do an assertion if i

play06:48

really wanted to so i can click that

play06:50

and i can put the company name as

play06:53

execute automation

play06:56

and hit send and the number of employees

play06:59

let's put 12 for now and

play07:02

or maybe one and then average marketing

play07:07

cost

play07:07

is 10 and then i'm gonna say

play07:10

uh better lead qualification which we

play07:13

didn't selected actually

play07:14

uh so i'm gonna say no for now

play07:19

and it brings me up so many messages

play07:21

though yeah okay

play07:24

uh in the meantime you can sign up here

play07:26

to access and it says

play07:28

bye for now which is bad so i can just

play07:32

hit this

play07:33

you can see that once i click that it's

play07:34

going to open up a

play07:37

a new tab i'm just going to close that

play07:40

and it's all looking good so this is the

play07:42

one thing which i have automated at the

play07:44

moment so it looks like a small workflow

play07:46

though

play07:46

but i'm just gonna copy this code which

play07:48

i have recorded

play07:49

and i'm just gonna stop the recording

play07:53

option that i have

play07:53

created and i'm gonna add this in the

play07:57

new file over here uh new

play08:00

test dot js

play08:04

and i'm gonna paste this guy over here

play08:06

so whatever that i have

play08:07

uh created so generated it's all i'm

play08:10

just gonna copy paste it over here

play08:13

all right and looks like everything is

play08:16

clearly generated for us

play08:17

and now if i just wanted to run this

play08:19

particular test all i'm going to do is

play08:21

just put the node and then

play08:25

bought new test.js so once i hit that

play08:28

you will see that

play08:29

the recorder which it has recorded the

play08:32

whole

play08:32

operation that i just performed will be

play08:35

automatically played back for us

play08:37

using this automation testing tool like

play08:38

playwright which is quite cool and quite

play08:40

interesting

play08:41

because the most important thing to

play08:42

understand here is all these bots are

play08:44

once again

play08:45

a dom object and it is really really

play08:48

easier to automate these

play08:49

dom elements using any automation

play08:51

testing tool it can be playwright or it

play08:53

can be

play08:54

uh puppeteer or it can be cyprus you can

play08:57

name it and you can use them so it's

play08:59

much much easier so that's it guys this

play09:01

is another question i have been keep

play09:02

getting from

play09:03

from the community asking how we can

play09:05

automate these uh

play09:07

bars using an automation testing tool

play09:10

and the answer is

play09:11

it can be any automation testing tool

play09:12

that is nothing like a bottom that you

play09:14

can really wanted to use it i don't

play09:16

think you need to use a bar dm for that

play09:17

matter

play09:18

but personally i feel you can just use

play09:21

any automation testing tool

play09:23

to automate the bots so that's it guys

play09:25

once again thank you very much watching

play09:26

this video

play09:27

and you guys have a great day

Rate This

5.0 / 5 (0 votes)

Étiquettes Connexes
BotsAutomatizaciónPlaywrightPruebasDOMDesarrolloChatbotsTDDAzureLandbotGeneración de Leads
Besoin d'un résumé en anglais ?