-
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.
Merge pull request #21 from docknetwork/qr-related-tests
feat: qr related tests
- Loading branch information
Showing
7 changed files
with
294 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/test/java/dock/android/smoketests/appResetFalse/QRScanAddress.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,32 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanAddress extends BaseTestCaseAndroid { | ||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR credential") | ||
public void verifyScanAddress() { | ||
String address = "3C7Hq5jQGxeYzL7LnVASn48tEfr6D7yKtNYSuXcgioQoWWsB"; | ||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet(); | ||
walletHomePage.scanQRCode(address).waitABit(5000); | ||
|
||
Assert.assertTrue(walletHomePage.isDisplayedByText(address)); | ||
walletHomePage.click(By.xpath("//android.widget.TextView[contains(@text,'Next')]")); | ||
walletHomePage.clickSendMax(); | ||
|
||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/test/java/dock/android/smoketests/appResetFalse/QRScanCredentialOffer.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,50 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.Selector; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanCredentialOffer extends BaseTestCaseAndroid { | ||
private By btnProceed = By.xpath("//android.widget.TextView[contains(@text,'Proceed')]"); | ||
private By txtField = Selector.contentResourceID("root.name"); | ||
private By btnSubmit = Selector.contentResourceID("vc-form-submit"); | ||
|
||
|
||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR credential offer") | ||
public void verifyScanCredentialOffer() { | ||
String name = "Test name"; | ||
String qrValue = "openid://discovery?issuer=https://api-testnet.dock.io/openid/connect/issuers/eda7ac1a-4a33-4b5e-8017-22c20631149d"; | ||
|
||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet().ensureHasDID(); | ||
walletHomePage.scanQRCode(qrValue).waitABit(7000); | ||
|
||
walletHomePage.click(btnProceed); | ||
|
||
walletHomePage.waitABit(10000); | ||
|
||
walletHomePage.sendText(txtField, name); | ||
walletHomePage.click(btnSubmit); | ||
|
||
walletHomePage.waitABit(10000); | ||
|
||
if(walletHomePage.checkElementExistByXpathContains("Import Credential")){ | ||
walletHomePage.clickOk(); | ||
} | ||
|
||
Assert.assertTrue(walletHomePage.isDisplayedByText(name)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/java/dock/android/smoketests/appResetFalse/QRScanDIDComm.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,33 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import org.openqa.selenium.By; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanDIDComm extends BaseTestCaseAndroid { | ||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR DIDComm") | ||
public void verifyScanDIDComm() { | ||
String qrCodeValue = "didcomm://eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpkb2NrOjVHNW42TkQ2djUyTDNXVVR1VEI5eGZwbWZUcnNFdlAyRHZRZTlmTkI1aU56cjNyWCNrZXlzLTEifQ.eyJ0eXBlIjoiaHR0cHM6Ly9kaWRjb21tLm9yZy9pc3N1ZS1jcmVkZW50aWFsLzIuMC9pc3N1ZS1jcmVkZW50aWFsIiwic2VuZGVyRGlkIjoiZGlkOmRvY2s6NUc1bjZORDZ2NTJMM1dVVHVUQjl4ZnBtZlRyc0V2UDJEdlFlOWZOQjVpTnpyM3JYIiwicGF5bG9hZCI6eyJkb21haW4iOiJhcGkuZG9jay5pbyIsImNyZWRlbnRpYWxzIjpbeyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIseyJkayI6Imh0dHBzOi8vbGQuZG9jay5pby9jcmVkZW50aWFscyMiLCJCYXNpY0NyZWRlbnRpYWwiOiJkazpCYXNpY0NyZWRlbnRpYWwiLCJuYW1lIjoiZGs6bmFtZSIsImRlc2NyaXB0aW9uIjoiZGs6ZGVzY3JpcHRpb24iLCJsb2dvIjoiZGs6bG9nbyJ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Cg_6bNKmoIzAg"; | ||
|
||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet().ensureHasDID() | ||
.scanQRCode(qrCodeValue); | ||
walletHomePage.waitABit(3000); | ||
|
||
// Verify Credential is displayed | ||
Assert.assertTrue(walletHomePage.isDisplayedByText("Basic Credential")); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/test/java/dock/android/smoketests/appResetFalse/QRScanEncryptedWallet.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,38 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.annotations.Test; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.Selector; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanEncryptedWallet extends BaseTestCaseAndroid { | ||
private By btnContinue = Selector.contentResourceID("Next"); | ||
private By passwordInput = Selector.contentResourceID("Password"); | ||
|
||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR credential") | ||
public void verifyScanEncryptedWallet() { | ||
String qrCodeValue = "{\"@context\":[\"https://w3id.org/wallet/v1\"],\"id\":\"did:key:z6LSd1HEdsPzejHbcKpWH44bF5oA4ET2hvxRBGJK17m4EQgH#encrypted-wallet\",\"type\":[\"EncryptedWallet\"],\"issuer\":\"did:key:z6LSd1HEdsPzejHbcKpWH44bF5oA4ET2hvxRBGJK17m4EQgH\",\"issuanceDate\":\"2022-03-28T11:44:06.296Z\",\"credentialSubject\":{\"id\":\"did:key:z6LSd1HEdsPzejHbcKpWH44bF5oA4ET2hvxRBGJK17m4EQgH\",\"encryptedWalletContents\":{}}}"; | ||
String password = "Password"; | ||
|
||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet() | ||
.ensureHasCredential() | ||
.ensureHasDID(); | ||
walletHomePage.scanQRCode(qrCodeValue); | ||
walletHomePage.sendText(passwordInput, password); | ||
|
||
walletHomePage.click(btnContinue); | ||
|
||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/test/java/dock/android/smoketests/appResetFalse/QRScanImportAccount.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,44 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.annotations.Test; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanImportAccount extends BaseTestCaseAndroid { | ||
private By btnSelectCredential = By.xpath("//*[@content-desc=\"Select credential\"]"); | ||
private By btnContinue = By.xpath("(//android.widget.Button[@content-desc=\"PresentCredentialBtn\"])[2]"); | ||
private By btnSelectAttribute = By.xpath("(//android.view.ViewGroup[@content-desc=\"Select attribute\"])[1]"); | ||
private By btnContinuePresent = By.xpath("//android.widget.Button[@content-desc=\"PresentCredentialBtnContinue\"]"); | ||
private By btnSelectDid = By.xpath("//android.view.ViewGroup[@content-desc=\"showContent\"]"); | ||
|
||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR credential") | ||
public void verifyScanImportAccount() { | ||
String qrCodeValue = "{\"encoded\":\"vEWv+0kxsH6Jo6c4ycvaxjyQP7RV8/YEH+GEjIfhvCEAgAAAAQAAAAgAAAB/ijDJSVTdxdHthiRDcuQc1YyihA97m6Y5m06wynIA18HzI9+v9/Qj3H3ln+ByqrC4lEjh7a2eeuM6Wt4cthCUWIq8qJNsarky9gBuLCisHZOpw2s9Efq1nPZ/qAo+qkptLh+aJ9Lo8Rl27USkmbN9zUwWJel8n/mCKZMMD2DSTHUkvCex6Lw7OTzXAGt5wsz+3xCgiiZQXzcFYO1J\",\"encoding\":{\"content\":[\"pkcs8\",\"sr25519\"],\"type\":[\"scrypt\",\"xsalsa20-poly1305\"],\"version\":\"3\"},\"address\":\"3C4VGFTSftFRpG98LdR1eh8SzSTbPzSKtA775B2hM5u44EU3\",\"meta\":{}}"; | ||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet() | ||
.ensureHasCredential() | ||
.ensureHasDID(); | ||
walletHomePage.clickScan().scanQRCode(qrCodeValue); | ||
|
||
walletHomePage.click(btnContinue); | ||
walletHomePage.click(btnSelectAttribute); | ||
if(driver.findElements(btnSelectDid).size() > 0){ | ||
walletHomePage.click(btnSelectDid); | ||
walletHomePage.click(By.xpath("//android.widget.TextView[contains(@text,'did:key')]")); | ||
} | ||
walletHomePage.click(btnContinuePresent); | ||
walletHomePage.click(btnContinuePresent); | ||
|
||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/test/java/dock/android/smoketests/appResetFalse/QRScanProofRequest.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,47 @@ | ||
package dock.android.smoketests.appResetFalse; | ||
|
||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import org.openqa.selenium.By; | ||
|
||
import dock.android.pageobjects.BaseTestCaseAndroid; | ||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.TestGroup; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanProofRequest extends BaseTestCaseAndroid { | ||
private By btnSelectCredential = By.xpath("//*[@content-desc=\"Select credential\"]"); | ||
private By btnContinue = By.xpath("(//android.widget.Button[@content-desc=\"PresentCredentialBtn\"])[2]"); | ||
private By btnSelectAttribute = By.xpath("(//android.view.ViewGroup[@content-desc=\"Select attribute\"])[1]"); | ||
private By btnContinuePresent = By.xpath("//android.widget.Button[@content-desc=\"PresentCredentialBtnContinue\"]"); | ||
private By btnSelectDid = By.xpath("//android.view.ViewGroup[@content-desc=\"showContent\"]"); | ||
|
||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify scanning QR credential") | ||
public void verifyScanProofRequest() { | ||
String qrCodeValue = "https://creds-testnet.dock.io/proof/06579da1-4195-428b-81d2-4bb7ff2787c4"; | ||
AndroidDriver driver = getDriverInstance(); | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
if (walletHomePage.getWalletStatus()) { | ||
walletHomePage.createNewWallet(); | ||
} | ||
else { | ||
walletHomePage.enterPassCodeOneTime(); | ||
} | ||
walletHomePage.ensureTestnet() | ||
.ensureHasDID() | ||
.ensureHasCredential(); | ||
walletHomePage.scanQRCode(qrCodeValue).click(btnSelectCredential); | ||
walletHomePage.click(btnContinue); | ||
walletHomePage.click(btnSelectAttribute); | ||
if(driver.findElements(btnSelectDid).size() > 0){ | ||
walletHomePage.click(btnSelectDid); | ||
walletHomePage.click(By.xpath("//android.widget.TextView[contains(@text,'did:key')]")); | ||
} | ||
walletHomePage.click(btnContinuePresent); | ||
walletHomePage.click(btnContinuePresent); | ||
walletHomePage.waitABit(5000); | ||
|
||
Assert.assertTrue(walletHomePage.isDisplayedByText("Verification Successful")); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/test/java/dock/android/smoketests/appResetTrue/QRScanCredential.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,50 @@ | ||
package dock.android.smoketests.appResetTrue; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.Assert; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import dock.android.pageobjects.WalletHomePage; | ||
import dock.utilities.TestGroup; | ||
import dock.utilities.WebDriverBuilder; | ||
import io.appium.java_client.android.AndroidDriver; | ||
|
||
public class QRScanCredential { | ||
|
||
AndroidDriver driver; | ||
|
||
@BeforeMethod | ||
public synchronized void openApp() { | ||
driver = WebDriverBuilder.getInstance().getAndroidDriverByAppReset(); | ||
} | ||
|
||
@Test(groups = TestGroup.SmokeTest, description = "Test to verify Edit Did functionality") | ||
public void verifyScanCredential() { | ||
String qrCodeValue = "https://creds-testnet.dock.io/6064d2eb3778bb7e0a8fa68384f4b345c3c5386492fab4789de2a7f0b0b57c6b"; | ||
String password = "Password1!"; | ||
|
||
// Create new Wallet | ||
WalletHomePage walletHomePage = new WalletHomePage(driver); | ||
walletHomePage.createNewWallet().waitABit(300); | ||
walletHomePage.ensureTestnet().waitABit(300); | ||
walletHomePage.scanQRCode(qrCodeValue); | ||
|
||
walletHomePage.sendTextVisibleKeyboard(By.xpath("//*[contains(@text,'Password')]"), password); | ||
walletHomePage.clickOk(); | ||
walletHomePage.waitABit(10000); | ||
|
||
if(walletHomePage.checkElementExistByXpathContains("Import Credential")){ | ||
walletHomePage.clickOk(); | ||
} | ||
|
||
// Verify Credential is displayed | ||
Assert.assertTrue(walletHomePage.isDisplayedByText("Test Credential")); | ||
} | ||
|
||
@AfterMethod(alwaysRun = true) | ||
public synchronized void closeApp() { | ||
driver.quit(); | ||
} | ||
} |