Skip to content

Commit 99510c2

Browse files
automation for scan screen (#1240)
* fix: wip scan.feature * fix: wip scan.feature * fix: done scan.feature * fix: wip scan.feature * fix: wip scan.feature * fix: wip scan.feature * fix: wip scan.feature * fix: wip scan.feature * fix: wip refactor-existing-automation-framework * fix: wip refactor-existing-automation-framework * fix: wip * fix: wip * fix: wip * fix: wip refactor-existing-automation-framework * fix: wip refactor-existing-automation-framework * chore: update project references from Identity Wallet to Veridian Wallet * Revert "fix: wip refactor-existing-automation-framework" This reverts commit 636302c. * Revert "Revert "fix: wip refactor-existing-automation-framework"" This reverts commit 13eb926. * Revert "chore: update project references from Identity Wallet to Veridian Wallet" This reverts commit 0d9770d. * fix: wip scan.feature * fix: wip scan.feature * fix: wip scan.feature * fix: done --------- Co-authored-by: Jorge Navarro Bendicho <[email protected]>
1 parent 21fc7b0 commit 99510c2

File tree

6 files changed

+151
-1
lines changed

6 files changed

+151
-1
lines changed

tests/actions/identifiers.action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function inputAndReturnIdentifierName() {
2323
return identifierName;
2424
}
2525

26-
async function addChosenIdentifierType() {
26+
export async function addChosenIdentifierType() {
2727
const identifierName = inputAndReturnIdentifierName();
2828
await AddAnIdentifierModal.createIdentifierButton.waitForClickable();
2929
await AddAnIdentifierModal.createIdentifierButton.click();

tests/constants/text.constants.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export enum WelcomeMessage {
2929
Description = "You're in the perfect spot to create your secure and private digital identity. Let's begin by adding your first identifier!",
3030
}
3131

32+
export enum Scan {
33+
ValidContent = "https://keria-ext.dev.idw-sandboxes.cf-deployments.org/oobi/EMNJSzxcbs5iMsVrbUuusC4HJD4OnViw9KklvAw4n09k/agent/EBuxdKcxfPY0qoNb08DM-lsV7zQ027wqq6C_h5rq-eK5?name=CF%20Credential%20Issuance",
34+
InvalidContent = "https://www.google.com/",
35+
}
36+
3237
export enum PrivacyPolicy {
3338
Title = "Privacy Policy",
3439
Intro = "Cardano Foundation (referred to as “Foundation” “We” “Our” or “Us”) is committed to innovating in digital identity management while prioritising user privacy and data protection. This Privacy Policy specifically applies to the Identity Wallet developed by the Cardano Foundation (the “Identity Wallet”) and the website http://identity.cardanofoundation.org/ (the “Products”). The Identity Wallet is a product designed to facilitate the creation and management of digital identities using Key Event Receipt Infrastructure (KERI) and Decentralized Identifiers (DIDs), operating without linking to any real-world names or personal identifiable information (PII). The Identity Wallet does not require users to submit emails, names, phone numbers, or any documents. Instead, it provides a framework for users to manage their own digital identities autonomously. This is achieved by securely storing private key material on the user's device for identification purposes, enabling users to control their own identity information and securely communicate with other users and entities. This policy outlines our practices regarding the collection, use, disclosure, and protection of any data associated with the Identity Wallet. Note that this policy may differ from other privacy policies pertaining to different CF products or services.\n\nPlease read this Privacy Policy carefully.",
@@ -169,3 +174,8 @@ export enum TermsOfUse {
169174
Section6Subtitle1 = "a. Amendment:",
170175
Section6Subtitle2 = "b. Application Provider Terms:",
171176
}
177+
178+
export enum ScanContent {
179+
ScannerText = "Align the QR code within the frame to scan",
180+
ErrorMessage = "Something went wrong. Please try again.",
181+
}

tests/features/scan/scan.feature

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Feature: Scan
2+
3+
Background:
4+
Given user is onboarded with skipped password creation
5+
And user tap skip button on Welcome screen
6+
And user create new Identifier
7+
8+
Scenario: C225 Scan - Loads correctly
9+
When user click on scan button
10+
Then scan screen load correctly
11+
12+
Scenario: C226 Scan - Not recognized paste contents
13+
Given user click on scan button
14+
When user paste faulty content
15+
Then a error message appear
16+
17+
Scenario: C307 Scan - Paste contents successfully
18+
Given user click on scan button
19+
When user paste content
20+
Then connection setup successfully
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { expect } from "expect-webdriverio";
2+
import { ScanContent } from "../../constants/text.constants";
3+
import { findAndClickLocator } from "../base.screen";
4+
5+
export class ScanScreen {
6+
get scanItem() {
7+
return $("[data-testid='tab-button-scan']");
8+
}
9+
10+
get scannerText() {
11+
return $("span.qr-code-scanner-text");
12+
}
13+
14+
get pasteButton() {
15+
return $("[data-testid='secondary-button-scanner']");
16+
}
17+
18+
get pasteTextbox() {
19+
return $("[id*='ion-input']");
20+
}
21+
22+
get confirmButton() {
23+
return ("//*[@data-testid='action-button']/following::p[text()='Confirm']");
24+
}
25+
26+
get errorMessage() {
27+
return $("[data-testid='app-error-alert'] .alert-title.sc-ion-alert-ios");
28+
}
29+
30+
get confirmAlertButton() {
31+
return $("[data-testid='app-error-alert-confirm-button']");
32+
}
33+
34+
get connectionTitle() {
35+
return $("[data-testid='connections-title']");
36+
}
37+
38+
get listConnection(): string[] {
39+
return ["[data-testid*='connection-group'] ion-item"];
40+
}
41+
42+
get pendingIcon() {
43+
return $("[data-testid*='connection-group'] .md.ion-activatable");
44+
}
45+
46+
get addedToast() {
47+
return $("[message='New connection added']");
48+
}
49+
50+
async loads() {
51+
await expect(this.scannerText).toBeDisplayed();
52+
await expect(this.scannerText).toHaveText(ScanContent.ScannerText);
53+
await expect(this.pasteButton).toBeDisplayed();
54+
}
55+
56+
async checkErrorMessage() {
57+
await expect(this.errorMessage).toBeDisplayed();
58+
await expect(this.errorMessage).toHaveText(ScanContent.ErrorMessage);
59+
}
60+
61+
async inputToPasteContentTextbox(content: string) {
62+
await this.pasteButton.click();
63+
await this.pasteTextbox.setValue(content);
64+
}
65+
66+
async clickConfirmButtonOf(locator: string) {
67+
await findAndClickLocator(`${locator}`);
68+
}
69+
70+
async checkListConnection(length: number) {
71+
await expect(this.connectionTitle).toHaveText("Connections");
72+
await expect(this.listConnection).toHaveLength(length);
73+
await expect(this.pendingIcon).not.toBeDisplayed();
74+
}
75+
76+
async checkToast() {
77+
if (await this.addedToast.getAttribute("message") == "New connection added") {
78+
await this.addedToast.waitForDisplayed({reverse: true});
79+
}
80+
}
81+
}
82+
83+
export default new ScanScreen();

tests/steps-definitions/identifier/identifier.steps.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { expect } from "expect-webdriverio";
33
import Assert from "../../helpers/assert.js";
44
import IdentifiersScreen from "../../screen-objects/identifiers/identifiers.screen.js";
55
import { Message } from "../../constants/toast.constants.js";
6+
import { addChosenIdentifierType } from "../../actions/identifiers.action";
67

78
Given(
89
/^user tap Add an identifier button on the Identifiers screen$/,
@@ -57,3 +58,8 @@ Then(
5758
await expect(await IdentifiersScreen.identityFavouriteCard(0)).toBeDisplayed();
5859
}
5960
);
61+
62+
Given(/^user create new Identifier$/, async function() {
63+
await IdentifiersScreen.addAnIdentifierButton.click();
64+
await addChosenIdentifierType();
65+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { When, Then } from "@wdio/cucumber-framework";
2+
import ScanScreen from "../../screen-objects/scan/scan.screen";
3+
import { Scan } from "../../constants/text.constants";
4+
5+
When(/^user click on scan button$/, async function () {
6+
await ScanScreen.scanItem.click();
7+
});
8+
9+
Then(/^scan screen load correctly$/, async function () {
10+
await ScanScreen.loads();
11+
});
12+
13+
When(/^user paste faulty content$/, async function () {
14+
await ScanScreen.inputToPasteContentTextbox(Scan.InvalidContent);
15+
await ScanScreen.clickConfirmButtonOf(ScanScreen.confirmButton);
16+
});
17+
18+
Then(/^a error message appear$/, async function () {
19+
await ScanScreen.checkErrorMessage();
20+
await ScanScreen.confirmAlertButton.click();
21+
});
22+
23+
When(/^user paste content$/, async function() {
24+
await ScanScreen.inputToPasteContentTextbox(Scan.ValidContent);
25+
await ScanScreen.clickConfirmButtonOf(ScanScreen.confirmButton);
26+
});
27+
28+
Then(/^connection setup successfully$/, async function() {
29+
await ScanScreen.checkToast();
30+
await ScanScreen.checkListConnection(1);
31+
});

0 commit comments

Comments
 (0)