In this article, we discuss about how to use test data from .json file in Playwright POM implementation.
This blog is a continuation of my blog on POM in Playwright — https://medium.com/@anandhik/page-object-model-in-playwright-fb1b60597c95.
Application url : https://react-redux.realworld.io/
Scenario : Create a new post
Create new post can be implemented in two ways,
1. Test 01 : Create a single post
2. Test 02 : Create more than one post by implementing data driven framework
Create a test data file:
Create a folder called ‘testData’ under project folder and create a file named ‘posts.json’ inside this folder.
{
"posts": [
{
"articleTitle": "MyNewArticle4",
"aboutArticle": "This article is about Playwright BDD",
"articleDetail": "In this article we are going to discuss about Playwright POM",
"tagName": "introduction"
},
{
"articleTitle": "MyNewArticle5",
"aboutArticle": "This article is about Playwright POM",
"articleDetail": "In this article we are going to discuss about Playwright POM",
"tagName": "introduction"
}…