swaglabs-test-2's Introduction
#BUY TWO PRODUCTS IN SWAGlABS PAGE To this automation I going to login in the page, select two products under my election and complete the E2E of a purchase. ## Previous Requirements - The page working in the link https://www.saucedemo.com/ - A chromedriver compatible, in my case 120.0.6099.109 - The IDE working correctly. in my case intellij - java version "21.0.1" 2023-10-17 LTS ## Configuration Create the folders to manage the project main/test where we going to create and structure that help us to apply the single responsibility principle (SOLID) For main I usually create the next folders into java folder: -interactions: Manages user interactions with the application, housing methods for actions like clicking buttons and navigating the UI. -models: Contains classes representing data structures or business entities relevant to the application. -question: Holds classes for querying the state or properties of elements on the screen. -task: Manages high-level user tasks by encapsulating multiple interactions needed to achieve a specific goal. -userinterfaces:Contains classes representing different application screens, encapsulating elements and interactions. -utils:Includes utility functions or helper classes for common tasks like logging or configuration. For test I create the java an resource folder: java: in here I create the runners and stepdefinitions ## Creation process 1. Create the build.gradle with stable dependencies. This help with security problems, help with the compatibility and fit the standards and the good practices. 2. Create the file feature with the feature and its scenarios. The file is writing with Gherkin language following a structure Given,When and Then. 3. If we have data in the feature we should create a data model in the models folder. When we use Scenario outline we usually have data to manage, a model could help us to work with the information. 4. Create the runner, if we have many scenarios we can configure which run with the tags. In the runner we put the interpreter in this case cucumber, this communicate our gherkin language with java code. 5. Create a hook for execute code before or after the scenarios execution. In this case I use the hook to prepare the scenario and make the code in the stepdefinition easier to read. 6. Create the step definition file where we put the communication between the feature and the task (the code with the steps/interactions). In here we have the given, when and then steps, in here we put the spotlight in the actor and create the classes and methods with names easily to read. 7. Create the task and the user interface files, the task are the the interactions between the user and the page, in the ui files we put the locators of the objets. In the task we write the instruction as enter a value, click on a button, scroll, wait for a object or a specific time. In the user interface file we declare the targets we can do this using locators as id, class, names, xpath etc. 8. If we already have complete the steps for the E2E we confirm if the result is the expected with the Question file where I confirm throw a boolean if the message match with our data. When we create a Question is usually to confirm the expected result. 9. Run the automation and verify the answer, in this case the automation answer is passed. We run the runner file to execute the automation. 10. We can confirm and watch the process in the index.html file. The index.html file is generated by serenity when we execute the automation, in there we can see step by step throw screenshots the execution.
swaglabs-test-2's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.