-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated date format in booking data builder
- Loading branch information
1 parent
3d37eec
commit 7512d25
Showing
6 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/java/io/github/mfaisalkhatri/api/restfulecommerce/APITests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.github.mfaisalkhatri.api.restfulecommerce; | ||
|
||
|
||
import org.testng.annotations.Test; | ||
|
||
public class APITests extends BaseTest{ | ||
|
||
@Test | ||
public void testShouldCreateNewOrders() { | ||
//request.post("/addOrder").body() | ||
} | ||
|
||
|
||
} |
60 changes: 60 additions & 0 deletions
60
src/test/java/io/github/mfaisalkhatri/api/restfulecommerce/BaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package io.github.mfaisalkhatri.api.restfulecommerce; | ||
|
||
import com.microsoft.playwright.APIRequest; | ||
import com.microsoft.playwright.APIRequestContext; | ||
import com.microsoft.playwright.Playwright; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class BaseTest { | ||
|
||
protected Playwright playwright; | ||
protected APIRequestContext request; | ||
private static final String BASE_URL = "http://localhost:3004"; | ||
|
||
@BeforeClass | ||
public void setup() { | ||
createPlaywright(); | ||
createAPIRequestContext(); | ||
} | ||
|
||
@AfterClass | ||
public void tearDown() { | ||
disposeAPIRequestContext(); | ||
closePlaywright(); | ||
|
||
} | ||
|
||
private void createPlaywright() { | ||
playwright = Playwright.create(); | ||
} | ||
|
||
private void createAPIRequestContext() { | ||
Map<String, String> headers = new HashMap<>(); | ||
headers.put("Content-Type", "application/json"); | ||
|
||
request = playwright.request().newContext(new APIRequest.NewContextOptions() | ||
.setBaseURL(BASE_URL) | ||
.setExtraHTTPHeaders(headers)); | ||
} | ||
|
||
|
||
private void closePlaywright() { | ||
if (playwright != null) { | ||
playwright.close(); | ||
playwright = null; | ||
} | ||
} | ||
|
||
private void disposeAPIRequestContext() { | ||
if (request != null) { | ||
request.dispose(); | ||
request = null; | ||
} | ||
} | ||
|
||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/test/java/io/github/mfaisalkhatri/api/restfulecommerce/testdata/OrderData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.mfaisalkhatri.api.restfulecommerce.testdata; | ||
|
||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class OrderData { | ||
@SerializedName("user_id") | ||
private String userId; | ||
@SerializedName("product_id") | ||
private String productId; | ||
@SerializedName("product_name") | ||
private String productName; | ||
@SerializedName("product_amount") | ||
private int productAmount; | ||
private int qty; | ||
@SerializedName("tax_amt") | ||
private int taxAmt; | ||
@SerializedName("total_amt") | ||
private int totalAmt; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/test/java/io/github/mfaisalkhatri/api/restfulecommerce/testdata/OrderDataBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.github.mfaisalkhatri.api.restfulecommerce.testdata; | ||
|
||
public class OrderDataBuilder { | ||
|
||
|
||
} |