SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Web UI Tests Examples
with
Selenide, nSelene, Selene & Capybara
http://todomvc4tasj.herokuapp.com
Tests
public class TodoMVCTest {



@Test

public void testFilterTasks(){

Tasks.visit();



Tasks.add("a", "b", "c");

Tasks.shouldBe("a", "b", "c");



Tasks.toggle("b");



Tasks.filterActive ();

Tasks.shouldBe("a", "c");



Tasks.filterCompleted ();

Tasks.shouldBe("b");

}

}
[TestFixture ()]

public class Test : BaseTest

{

[Test ()]

public void FilterTasks ()

{

Tasks.Visit ();



Tasks.Add ("a", "b", "c");

Tasks.ShouldBe ("a", "b", "c");



Tasks.Toggle ("b"); 



Tasks.FilterActive ();

Tasks.ShouldBe ("a", "c");



Tasks.FilterCompleted ();

Tasks.ShouldBe ("b");

}

}
class TestTodoMVC(BaseTest):



def test_filter_tasks(self):



tasks.visit()



tasks.add("a", "b", "c")

tasks.should_be("a", "b", "c")



tasks.toggle("b")



tasks.filter_active ()

tasks.should_be("a", "c")



tasks.filter_completed ()

tasks.should_be("b")
describe "todomvc" do


it "filters tasks" do

Tasks.open

Tasks.add "a", "b", "c"

Tasks.should_be "a", "b", "c"



Tasks.toggle "b"



Tasks.filter_active

Tasks.should_be "a", "c"



Tasks.filter_completed

Tasks.should_be "b"

end

end
Step-Helpers
simpler
public class Tasks {



...

public static void visit() {


open("https://todomvc4tasj.herokuapp.com/");

}



public static void filterActive(){


$(By.linkText("Active")).click();

}



public static void filterCompleted(){


$(By.linkText("Completed")).click();

}



public static void add(String... taskTexts) {


for(String text: taskTexts){


$("#new-todo").setValue(text).pressEnter();

}

}
...

}
public static class Tasks

{

... 

public static void Visit()

{

Open ("https://todomvc4tasj.herokuapp.com/");

}



public static void FilterActive ()

{

S (By.LinkText ("Active")).Click ();

}



public static void FilterCompleted ()

{

S (By.LinkText ("Completed")).Click ();

}



public static void Add(params string[] taskTexts)

{

foreach (var text in taskTexts) 

{

S ("#new-todo").SetValue (text).PressEnter ();

}

}
...

}
…
def visit():



tools.visit("https://todomvc4tasj.herokuapp.com/")





def filter_active():



s(by_link_text(”Active”)).click()





def filter_completed():



s(by_link_text(”Completed”)).click()





def add(*task_texts):



for text in task_texts:


s("#new-todo").set_value(text).press_enter()
module Tasks

extend Capybara::DSL

def self.open


visit 'https://todomvc4tasj.herokuapp.com'

end


def self.filter_active


find("a", text:"Active").click

end



def self.filter_completed


find("a", text:"Completed").click

end



def self.add *task_texts


task_texts.each do |text|


find("#new-todo").send_keys(text, :enter)

end

end



...

Step-Helpers
a bit harder
public class Tasks {



public static ElementsCollection tasks = $$("#todo-list>li");



...


public static void toggle(String taskText) {


tasks.findBy(exactText(taskText)).find(".toggle").click();

}



public static void shouldBe(String... taskTexts) {


tasks.filterBy(visible).shouldHave(exactTexts(taskTexts));

}

}
public static class Tasks

{

public static SCollection List = SS ("#todo-list>li"); 



...



public static void Toggle (string taskText)

{

List.FindBy (Have.ExactText(taskText)).Find (".toggle").Click();

}



public static void ShouldBe(params string[] names)
{

List.FilterBy (Be.Visible).Should (Have.Texts (names));

}

}
tasks = ss("#todo-list>li")



...
def toggle(task_text):



tasks.findBy(exact_text(task_text)).find(".toggle").click()





def should_be(*task_texts):



tasks.filterBy(visible).should_have(exact_texts(*task_texts))
module Tasks

extend Capybara::DSL



def self.tasks

all "#todo-list>li"

end


...

def self.toggle task_text


(tasks.findBy {|task| task.text == task_text}).find(".toggle").click

end



def self.should_be *task_texts


tasks.texts.should == task_texts

end

end
module Tasks

extend Capybara::DSL



def self.tasks

all "#todo-list>li"

end


...

def self.toggle task_text


(tasks.findBy {|task| task.text == task_text}).find(".toggle").click

end



def self.should_be *task_texts


tasks.texts.should == task_texts

end

end
is == above ;)==
Easy?
Easy Tools
http://selenide.org
https://github.com/jnicklas/capybara
https://github.com/yashaka/selene
https://github.com/yashaka/NSelene
github.com/yashaka
twitter.com/yashaka
yashaka@gmail.com
Thank You

Más contenido relacionado

La actualidad más candente

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Enhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order componentEnhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order componentYao Nien Chung
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorJie-Wei Wu
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersDavid Rodenas
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react formYao Nien Chung
 
軟體測試是在測試什麼?
軟體測試是在測試什麼?軟體測試是在測試什麼?
軟體測試是在測試什麼?Yao Nien Chung
 
Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App Yao Nien Chung
 
Adventures In JavaScript Testing
Adventures In JavaScript TestingAdventures In JavaScript Testing
Adventures In JavaScript TestingThomas Fuchs
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsLudmila Nesvitiy
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
The Screenplay Pattern: Better Interactions for Better Automation
The Screenplay Pattern: Better Interactions for Better AutomationThe Screenplay Pattern: Better Interactions for Better Automation
The Screenplay Pattern: Better Interactions for Better AutomationApplitools
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJSPeter Drinnan
 
Droidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineDroidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineJavier de Pedro López
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingMark Rickerby
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cliCory Forsyth
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page ObjectArtem Sokovets
 
Test like a pro with Ember.js
Test like a pro with Ember.jsTest like a pro with Ember.js
Test like a pro with Ember.jsMike North
 

La actualidad más candente (20)

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Enhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order componentEnhance react app with patterns - part 1: higher order component
Enhance react app with patterns - part 1: higher order component
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for Programmers
 
Lets make a better react form
Lets make a better react formLets make a better react form
Lets make a better react form
 
軟體測試是在測試什麼?
軟體測試是在測試什麼?軟體測試是在測試什麼?
軟體測試是在測試什麼?
 
Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App Use React Patterns to Build Large Scalable App
Use React Patterns to Build Large Scalable App
 
Adventures In JavaScript Testing
Adventures In JavaScript TestingAdventures In JavaScript Testing
Adventures In JavaScript Testing
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet Protractor Training in Pune by QuickITDotnet
Protractor Training in Pune by QuickITDotnet
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
The Screenplay Pattern: Better Interactions for Better Automation
The Screenplay Pattern: Better Interactions for Better AutomationThe Screenplay Pattern: Better Interactions for Better Automation
The Screenplay Pattern: Better Interactions for Better Automation
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Droidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineDroidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offline
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Getting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe TestingGetting to Grips with SilverStripe Testing
Getting to Grips with SilverStripe Testing
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cli
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page Object
 
Test like a pro with Ember.js
Test like a pro with Ember.jsTest like a pro with Ember.js
Test like a pro with Ember.js
 

Destacado

Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 minIakiv Kramarenko
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)Iakiv Kramarenko
 
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQAFest
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternSargis Sargsyan
 
Web testing with Selenium
Web testing with SeleniumWeb testing with Selenium
Web testing with SeleniumXBOSoft
 
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DCPivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DCDave Haeffner
 
Continuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgContinuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgSauce Labs
 
Full Stack Testing Done Well
Full Stack Testing Done WellFull Stack Testing Done Well
Full Stack Testing Done WellDave Haeffner
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Agile testing for mere mortals
Agile testing for mere mortalsAgile testing for mere mortals
Agile testing for mere mortalsDave Haeffner
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToGlobalLogic Ukraine
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users AnonymousDave Haeffner
 

Destacado (17)

Write Selenide in Python 15 min
Write Selenide in Python 15 minWrite Selenide in Python 15 min
Write Selenide in Python 15 min
 
Automation is Easy! (python version)
Automation is Easy! (python version)Automation is Easy! (python version)
Automation is Easy! (python version)
 
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSeleneQA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
QA Fest 2016. Яков Крамаренко. Укрощаем фреймворки-динозавры используя NSelene
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Web testing with Selenium
Web testing with SeleniumWeb testing with Selenium
Web testing with Selenium
 
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DCPivotal Failure - Lessons Learned from Lean Startup Machine DC
Pivotal Failure - Lessons Learned from Lean Startup Machine DC
 
Continuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.orgContinuous Testing Meets the Classroom at Code.org
Continuous Testing Meets the Classroom at Code.org
 
Selenium
SeleniumSelenium
Selenium
 
Full Stack Testing Done Well
Full Stack Testing Done WellFull Stack Testing Done Well
Full Stack Testing Done Well
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Agile testing for mere mortals
Agile testing for mere mortalsAgile testing for mere mortals
Agile testing for mere mortals
 
The Testable Web
The Testable WebThe Testable Web
The Testable Web
 
Selenium Basics
Selenium BasicsSelenium Basics
Selenium Basics
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How To
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Bdd lessons-learned
Bdd lessons-learnedBdd lessons-learned
Bdd lessons-learned
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users Anonymous
 

Similar a Web ui tests examples with selenide, nselene, selene & capybara

Testing basics for developers
Testing basics for developersTesting basics for developers
Testing basics for developersAnton Udovychenko
 
Роман Иовлев «Open Source UI Automation Tests on C#»
Роман Иовлев «Open Source UI Automation Tests on C#»Роман Иовлев «Open Source UI Automation Tests on C#»
Роман Иовлев «Open Source UI Automation Tests on C#»SpbDotNet Community
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4jeresig
 
Future of UI Automation testing and JDI
Future of UI Automation testing and JDIFuture of UI Automation testing and JDI
Future of UI Automation testing and JDICOMAQA.BY
 
Roman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campRoman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campРоман Иовлев
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testingjeresig
 
WuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestWuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestSummer Lu
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
apache tajo 연동 개발 후기
apache tajo 연동 개발 후기apache tajo 연동 개발 후기
apache tajo 연동 개발 후기효근 박
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworksTomáš Kypta
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
QA Fest 2015. Яков Крамаренко. Polyglot automation
QA Fest 2015. Яков Крамаренко. Polyglot automation QA Fest 2015. Яков Крамаренко. Polyglot automation
QA Fest 2015. Яков Крамаренко. Polyglot automation QAFest
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's testsSean P. Floyd
 
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"GeeksLab Odessa
 

Similar a Web ui tests examples with selenide, nselene, selene & capybara (20)

Testing basics for developers
Testing basics for developersTesting basics for developers
Testing basics for developers
 
Google guava
Google guavaGoogle guava
Google guava
 
Роман Иовлев «Open Source UI Automation Tests on C#»
Роман Иовлев «Open Source UI Automation Tests on C#»Роман Иовлев «Open Source UI Automation Tests on C#»
Роман Иовлев «Open Source UI Automation Tests on C#»
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
 
Future of UI Automation testing and JDI
Future of UI Automation testing and JDIFuture of UI Automation testing and JDI
Future of UI Automation testing and JDI
 
Roman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium campRoman iovlev. Test UI with JDI - Selenium camp
Roman iovlev. Test UI with JDI - Selenium camp
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
WuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestWuKong - Framework for Integrated Test
WuKong - Framework for Integrated Test
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
apache tajo 연동 개발 후기
apache tajo 연동 개발 후기apache tajo 연동 개발 후기
apache tajo 연동 개발 후기
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Guide to the jungle of testing frameworks
Guide to the jungle of testing frameworksGuide to the jungle of testing frameworks
Guide to the jungle of testing frameworks
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
SWTBot Tutorial
SWTBot TutorialSWTBot Tutorial
SWTBot Tutorial
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
guice-servlet
guice-servletguice-servlet
guice-servlet
 
QA Fest 2015. Яков Крамаренко. Polyglot automation
QA Fest 2015. Яков Крамаренко. Polyglot automation QA Fest 2015. Яков Крамаренко. Polyglot automation
QA Fest 2015. Яков Крамаренко. Polyglot automation
 
servlets
servletsservlets
servlets
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's tests
 
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
QA Lab: тестирование ПО. Яков Крамаренко: "KISS Automation"
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Web ui tests examples with selenide, nselene, selene & capybara

  • 1. Web UI Tests Examples with Selenide, nSelene, Selene & Capybara
  • 4. public class TodoMVCTest {
 
 @Test
 public void testFilterTasks(){
 Tasks.visit();
 
 Tasks.add("a", "b", "c");
 Tasks.shouldBe("a", "b", "c");
 
 Tasks.toggle("b");
 
 Tasks.filterActive ();
 Tasks.shouldBe("a", "c");
 
 Tasks.filterCompleted ();
 Tasks.shouldBe("b");
 }
 }
  • 5. [TestFixture ()]
 public class Test : BaseTest
 {
 [Test ()]
 public void FilterTasks ()
 {
 Tasks.Visit ();
 
 Tasks.Add ("a", "b", "c");
 Tasks.ShouldBe ("a", "b", "c");
 
 Tasks.Toggle ("b"); 
 
 Tasks.FilterActive ();
 Tasks.ShouldBe ("a", "c");
 
 Tasks.FilterCompleted ();
 Tasks.ShouldBe ("b");
 }
 }
  • 6. class TestTodoMVC(BaseTest):
 
 def test_filter_tasks(self):
 
 tasks.visit()
 
 tasks.add("a", "b", "c")
 tasks.should_be("a", "b", "c")
 
 tasks.toggle("b")
 
 tasks.filter_active ()
 tasks.should_be("a", "c")
 
 tasks.filter_completed ()
 tasks.should_be("b")
  • 7. describe "todomvc" do 
 it "filters tasks" do
 Tasks.open
 Tasks.add "a", "b", "c"
 Tasks.should_be "a", "b", "c"
 
 Tasks.toggle "b"
 
 Tasks.filter_active
 Tasks.should_be "a", "c"
 
 Tasks.filter_completed
 Tasks.should_be "b"
 end
 end
  • 9. public class Tasks {
 
 ...
 public static void visit() { 
 open("https://todomvc4tasj.herokuapp.com/");
 }
 
 public static void filterActive(){ 
 $(By.linkText("Active")).click();
 }
 
 public static void filterCompleted(){ 
 $(By.linkText("Completed")).click();
 }
 
 public static void add(String... taskTexts) { 
 for(String text: taskTexts){ 
 $("#new-todo").setValue(text).pressEnter();
 }
 } ...
 }
  • 10. public static class Tasks
 {
 ... 
 public static void Visit()
 {
 Open ("https://todomvc4tasj.herokuapp.com/");
 }
 
 public static void FilterActive ()
 {
 S (By.LinkText ("Active")).Click ();
 }
 
 public static void FilterCompleted ()
 {
 S (By.LinkText ("Completed")).Click ();
 }
 
 public static void Add(params string[] taskTexts)
 {
 foreach (var text in taskTexts) 
 {
 S ("#new-todo").SetValue (text).PressEnter ();
 }
 } ...
 }
  • 11. … def visit():
 
 tools.visit("https://todomvc4tasj.herokuapp.com/")
 
 
 def filter_active():
 
 s(by_link_text(”Active”)).click()
 
 
 def filter_completed():
 
 s(by_link_text(”Completed”)).click()
 
 
 def add(*task_texts):
 
 for text in task_texts: 
 s("#new-todo").set_value(text).press_enter()
  • 12. module Tasks
 extend Capybara::DSL
 def self.open 
 visit 'https://todomvc4tasj.herokuapp.com'
 end 
 def self.filter_active 
 find("a", text:"Active").click
 end
 
 def self.filter_completed 
 find("a", text:"Completed").click
 end
 
 def self.add *task_texts 
 task_texts.each do |text| 
 find("#new-todo").send_keys(text, :enter)
 end
 end
 
 ...

  • 14. public class Tasks {
 
 public static ElementsCollection tasks = $$("#todo-list>li");
 
 ... 
 public static void toggle(String taskText) { 
 tasks.findBy(exactText(taskText)).find(".toggle").click();
 }
 
 public static void shouldBe(String... taskTexts) { 
 tasks.filterBy(visible).shouldHave(exactTexts(taskTexts));
 }
 }
  • 15. public static class Tasks
 {
 public static SCollection List = SS ("#todo-list>li"); 
 
 ...
 
 public static void Toggle (string taskText)
 {
 List.FindBy (Have.ExactText(taskText)).Find (".toggle").Click();
 }
 
 public static void ShouldBe(params string[] names) {
 List.FilterBy (Be.Visible).Should (Have.Texts (names));
 }
 }
  • 16. tasks = ss("#todo-list>li")
 
 ... def toggle(task_text):
 
 tasks.findBy(exact_text(task_text)).find(".toggle").click()
 
 
 def should_be(*task_texts):
 
 tasks.filterBy(visible).should_have(exact_texts(*task_texts))
  • 17. module Tasks
 extend Capybara::DSL
 
 def self.tasks
 all "#todo-list>li"
 end 
 ...
 def self.toggle task_text 
 (tasks.findBy {|task| task.text == task_text}).find(".toggle").click
 end
 
 def self.should_be *task_texts 
 tasks.texts.should == task_texts
 end
 end
  • 18. module Tasks
 extend Capybara::DSL
 
 def self.tasks
 all "#todo-list>li"
 end 
 ...
 def self.toggle task_text 
 (tasks.findBy {|task| task.text == task_text}).find(".toggle").click
 end
 
 def self.should_be *task_texts 
 tasks.texts.should == task_texts
 end
 end is == above ;)==
  • 19. Easy?