-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Recording feature and convert to corresponding curl commands (#48)
- Loading branch information
Showing
24 changed files
with
625 additions
and
221 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
56 changes: 56 additions & 0 deletions
56
selenium-tests/src/test/java/com/nuodb/selenium/basic/AutomationTest.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,56 @@ | ||
// (C) Copyright 2024 Dassault Systemes SE. All Rights Reserved. | ||
|
||
package com.nuodb.selenium.basic; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.nuodb.selenium.Constants; | ||
import com.nuodb.selenium.TestRoutines; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class AutomationTest extends TestRoutines { | ||
@Test | ||
public void testRecordingCreateAndDeleteUsers() throws JsonProcessingException { | ||
// Start Recording | ||
login(Constants.ADMIN_ORGANIZATION, Constants.ADMIN_USER, Constants.ADMIN_PASSWORD); | ||
clickUserMenu("automation"); | ||
clearSessionStorage("nuodbaas-webui-recorded"); | ||
clearSessionStorage("nuodbaas-webui-isRecording"); | ||
click("btnStartRecording"); | ||
|
||
// Setup and list users | ||
String userName = createUser(); | ||
clickMenu("users"); | ||
|
||
// find user and delete | ||
deleteUser(userName); | ||
waitRestComplete(); | ||
|
||
// Stop Recording | ||
retry(()->{ | ||
clickUserMenu("automation"); | ||
click("btnStopRecording"); | ||
}); | ||
|
||
// Validate recording | ||
String strRecording = getSessionStorage("nuodbaas-webui-recorded"); | ||
ObjectMapper mapper = new ObjectMapper(); | ||
JsonNode items = mapper.readTree(strRecording); | ||
int [] putDelete = { 0, 0}; | ||
items.forEach(item -> { | ||
String method = item.get("method").asText(); | ||
if(method.equalsIgnoreCase("put")) { | ||
putDelete[0]++; | ||
} | ||
else if(method.equalsIgnoreCase("delete")) { | ||
putDelete[1]++; | ||
} | ||
}); | ||
assertEquals(1, putDelete[0]); | ||
assertEquals(1, putDelete[1]); | ||
} | ||
} |
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
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
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
Oops, something went wrong.