init commit,

This commit is contained in:
louiscklaw
2025-05-28 09:55:51 +08:00
commit efe70ceb69
8042 changed files with 951668 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
export class CommonIdentityModal {
get displayNameTitle() {
return $("[data-testid=\"display-name-title\"]");
}
get themeTitle() {
return $(".theme-input-title");
}
async themeItem(index: number) {
return $(`[data-testid="identifier-theme-selector-item-${index}"]`);
}
async clickChosenTheme(index: number) {
await (await this.themeItem(index)).click();
}
async displayNameInputElement(elementName: string) {
return $(`#${elementName}-name-input input`);
}
async getIdElementLocator(elementName: string) {
return `[data-testid="${elementName}-identifier-modal"]`;
}
async idElement(elementName: string) {
return $(await this.getIdElementLocator(elementName));
}
async identifierTypeItem(name: string) {
return $(`[data-testid="identifier-aidtype-${name.toLowerCase()}"]`);
}
async modalTitleElement(elementName: string) {
return $(`[data-testid="${elementName}-title"]`);
}
async clickChosenIdentifierType(identifierType: string) {
await (await this.identifierTypeItem(identifierType)).click();
}
}
export default new CommonIdentityModal();

View File

@@ -0,0 +1,13 @@
import { CommonIdentityModal } from "./common-identity.modal.js";
export class IdentifierJsonModal extends CommonIdentityModal {
get copyJsonButton() {
return $("[data-testid=\"identifier-copy-json\"]");
}
get saveToDeviceButton() {
return $("[data-testid=\"save-to-device-button\"]");
}
}
export default new IdentifierJsonModal();

View File

@@ -0,0 +1,42 @@
import { expect } from "expect-webdriverio";
import { CommonIdentityModal } from "./common-identity.modal.js";
export class IdentityAddModal extends CommonIdentityModal {
get createIdentifierButton() {
return $("[data-testid=\"primary-button-create-identifier-modal\"]");
}
get displayNameInput() {
return this.displayNameInputElement("display");
}
get identifierTypeTitle() {
return $(".type-input-title");
}
get id() {
return this.idElement("create");
}
get modalTitle() {
return this.modalTitleElement("add-an-identifier");
}
async loads() {
await expect(this.id).toBeDisplayed();
await expect(this.modalTitle).toHaveText("Add an identifier");
await expect(super.displayNameTitle).toHaveText("Display name");
await expect(this.displayNameInput).toBeDisplayed();
await expect(this.identifierTypeTitle).toHaveText("AID type");
await expect(this.identifierTypeItem("default")).toBeDisplayed();
await expect(this.identifierTypeItem("multisig")).toBeDisplayed();
await expect(this.identifierTypeItem("delegated")).toBeDisplayed();
await expect(super.themeTitle).toHaveText("Choose a theme");
for (let i = 0; i < 2; i++) {
await expect(super.themeItem(i)).toBeDisplayed();
}
await expect(this.createIdentifierButton).toBeDisplayed();
}
}
export default new IdentityAddModal();

View File

@@ -0,0 +1,40 @@
import { expect } from "expect-webdriverio";
import { CommonIdentityModal } from "./common-identity.modal.js";
export class IdentityEditModal extends CommonIdentityModal {
modalName = "edit";
get confirmChangesButton() {
return $("[data-testid=\"continue-button\"]");
}
get displayNameInput() {
return this.displayNameInputElement(this.modalName);
}
get id() {
return this.idElement(this.modalName);
}
get idLocator() {
return this.getIdElementLocator(this.modalName);
}
get modalTitle() {
return this.modalTitleElement(`${this.modalName}-identifier`);
}
async loads() {
await expect(this.id).toBeDisplayed();
await expect(this.modalTitle).toHaveText("Edit identifier");
await expect(super.displayNameTitle).toHaveText("Display name");
await expect(this.displayNameInput).toBeDisplayed();
await expect(this.themeTitle).toHaveText("Edit theme");
for (let i = 0; i < 4; i++) {
await expect(this.themeItem(i)).toBeDisplayed();
}
await expect(this.confirmChangesButton).toBeDisplayed();
}
}
export default new IdentityEditModal();

View File

@@ -0,0 +1,25 @@
import { CommonIdentityModal } from "./common-identity.modal.js";
export class IdentityOptionsModal extends CommonIdentityModal {
get deleteIdentifierOption() {
return $("[data-testid=\"delete-identifier-options\"]");
}
get editIdentifierOption() {
return $("[data-testid=\"edit-identifier-options\"]");
}
get id() {
return this.idElement("view");
}
get shareIdentifierOption() {
return $("[data-testid=\"share-identifier-options\"]");
}
get viewJsonOption() {
return $("[data-testid=\"view-json-identifier-options\"]");
}
}
export default new IdentityOptionsModal();

View File

@@ -0,0 +1,43 @@
import { expect } from "expect-webdriverio";
import { CommonIdentityModal } from "./common-identity.modal.js";
export class IdentityShareModal extends CommonIdentityModal {
get copyButton() {
return $("[data-testid=\"share-identifier-copy-button\"]");
}
get copyButton2() {
return $(".share-identifier-option");
}
get copyButtonLabel() {
return $("[data-testid=\"share-identifier-copy-label\"]");
}
get moreOptionsButton() {
return $("[data-testid=\"share-identifier-more-button\"]");
}
get moreOptionsButtonLabel() {
return $("[data-testid=\"share-identifier-more-label\"]");
}
get modalTitle() {
return this.modalTitleElement("share-connection");
}
get qrCodeColumn() {
return $("[data-testid=\"share-identifier-qr-code\"]");
}
async loads() {
await expect(this.modalTitle).toHaveText("Share connection");
await expect(this.qrCodeColumn).toBeDisplayed();
await expect(this.copyButton).toBeDisplayed();
await expect(this.copyButtonLabel).toHaveText("Copy Out-of-Band Invitation (OOBI)");
await expect(this.moreOptionsButton).toBeDisplayed();
await expect(this.moreOptionsButtonLabel).toHaveText("More share options");
}
}
export default new IdentityShareModal();