Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenobject(update): add ui locators and methods for share did #674

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions tests/screenobjects/chats/MessageLocal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const SELECTORS_WINDOWS: selectorContainer = {
CHAT_MESSAGE_REPLY_TEXT: "<Text>",
CHAT_MESSAGE_TEXT_GROUP: '//Group[starts-with(@Name, "message-text")]',
CHAT_MESSAGE_TEXT_VALUE: "<Text>",
SHARED_DID_IDENTITY_BANNER_IMAGE: "[name='banner-image']",
SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON: "[name='embed-identity-button']",
SHARED_DID_IDENTITY_HEADER: "[name='identity-header']",
SHARED_DID_IDENTITY_PROFILE_IMAGE: "[name='profile-image']",
SHARED_DID_IDENTITY_PROFILE_NAME: "[name='profile-name']",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE: "[name='profile-name-value']",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT: "<Text>",
};

const SELECTORS_MACOS: selectorContainer = {
Expand Down Expand Up @@ -77,6 +84,14 @@ const SELECTORS_MACOS: selectorContainer = {
CHAT_MESSAGE_TEXT_GROUP:
'//XCUIElementTypeGroup[starts-with(@label, "message-text")]',
CHAT_MESSAGE_TEXT_VALUE: "-ios class chain:**/XCUIElementTypeStaticText",
SHARED_DID_IDENTITY_BANNER_IMAGE: "~banner-image",
SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON: "~embed-identity-button",
SHARED_DID_IDENTITY_HEADER: "~identity-header",
SHARED_DID_IDENTITY_PROFILE_IMAGE: "~profile-image",
SHARED_DID_IDENTITY_PROFILE_NAME: "~profile-name",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE: "~profile-name-value",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT:
"-ios class chain:**/XCUIElementTypeStaticText",
};

process.env.DRIVER === WINDOWS_DRIVER
Expand Down Expand Up @@ -216,6 +231,42 @@ class MessageLocal extends UplinkMainScreen {
return $$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP);
}

public get sharedDidIdentityBannerImage() {
return this.sharedDidIdentityHeader.$(
SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE,
);
}

public get sharedDidIdentityEmbedButton() {
return $(SELECTORS.SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON);
}

public get sharedDidIdentityHeader() {
return $(SELECTORS.SHARED_DID_IDENTITY_HEADER);
}

public get sharedDidIdentityProfileImage() {
return this.sharedDidIdentityBannerImage.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_IMAGE,
);
}

public get sharedDidIdentityProfileName() {
return $(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME);
}

public get sharedDidIdentityProfileNameValue() {
return this.sharedDidIdentityProfileName.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE,
);
}

public get sharedDidIdentityProfileNameValueText() {
return this.sharedDidIdentityProfileNameValue.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT,
);
}

// Message Local Methods

async waitForCodeMessageSentToExist(expectedLanguage: string) {
Expand Down Expand Up @@ -477,6 +528,62 @@ class MessageLocal extends UplinkMainScreen {
return iconTitle;
}

// Share DID Methods

async getLastMessageSent() {
const messagesSent = await this.chatMessageLocal;
const lastMessageSentIndex = (await messagesSent.length) - 1;
const lastMessageSent = await messagesSent[lastMessageSentIndex];
return lastMessageSent;
}

async getLastSharedDIDBannerImage() {
const messageSent = await this.getLastMessageSent();
const messageSentSharedDidBannerImage = await messageSent
.$(SELECTORS.SHARED_DID_IDENTITY_HEADER)
.$(SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE);
await messageSentSharedDidBannerImage.waitForExist();
return messageSentSharedDidBannerImage;
}

async getLastSharedDIDEmbedButton() {
const messageSent = await this.getLastMessageSent();
const messageSentSharedDidEmbedButton = await messageSent.$(
SELECTORS.SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON,
);
await messageSentSharedDidEmbedButton.waitForExist();
return messageSentSharedDidEmbedButton;
}

async getLastSharedDIDHeader() {
const messageSent = await this.getLastMessageSent();
const messageSentSharedDidIdentityHeader = await messageSent.$(
SELECTORS.SHARED_DID_IDENTITY_HEADER,
);
await messageSentSharedDidIdentityHeader.waitForExist();
return messageSentSharedDidIdentityHeader;
}

async getLastSharedDIDProfileImage() {
const messageSent = await this.getLastMessageSent();
const messageSentSharedDidProfileImage = await messageSent
.$(SELECTORS.SHARED_DID_IDENTITY_HEADER)
.$(SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_IMAGE);
await messageSentSharedDidProfileImage.waitForExist();
return messageSentSharedDidProfileImage;
}

async getLastSharedDIDProfileName() {
const messageSent = await this.getLastMessageSent();
const messageSentSharedDidProfileName = await messageSent
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT);
await messageSentSharedDidProfileName.waitForExist();
return messageSentSharedDidProfileName;
}

// Replies Methods

async getLastReply() {
Expand Down
108 changes: 108 additions & 0 deletions tests/screenobjects/chats/MessageRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const SELECTORS_WINDOWS: selectorContainer = {
CHAT_MESSAGE_REPLY_TEXT: "<Text>",
CHAT_MESSAGE_TEXT_GROUP: '//Group[starts-with(@Name, "message-text")]',
CHAT_MESSAGE_TEXT_VALUE: "<Text>",
SHARED_DID_IDENTITY_BANNER_IMAGE: "[name='banner-image']",
SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON: "[name='embed-identity-button']",
SHARED_DID_IDENTITY_HEADER: "[name='identity-header']",
SHARED_DID_IDENTITY_PROFILE_IMAGE: "[name='profile-image']",
SHARED_DID_IDENTITY_PROFILE_NAME: "[name='profile-name']",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE: "[name='profile-name-value']",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT: "<Text>",
};

const SELECTORS_MACOS: selectorContainer = {
Expand Down Expand Up @@ -79,6 +86,14 @@ const SELECTORS_MACOS: selectorContainer = {
CHAT_MESSAGE_TEXT_GROUP:
'//XCUIElementTypeGroup[starts-with(@label, "message-text")]',
CHAT_MESSAGE_TEXT_VALUE: "-ios class chain:**/XCUIElementTypeStaticText",
SHARED_DID_IDENTITY_BANNER_IMAGE: "~banner-image",
SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON: "~embed-identity-button",
SHARED_DID_IDENTITY_HEADER: "~identity-header",
SHARED_DID_IDENTITY_PROFILE_IMAGE: "~profile-image",
SHARED_DID_IDENTITY_PROFILE_NAME: "~profile-name",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE: "~profile-name-value",
SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT:
"-ios class chain:**/XCUIElementTypeStaticText",
};

process.env.DRIVER === WINDOWS_DRIVER
Expand Down Expand Up @@ -218,6 +233,42 @@ class MessageRemote extends UplinkMainScreen {
return $$(SELECTORS.CHAT_MESSAGE_TEXT_GROUP);
}

public get sharedDidIdentityBannerImage() {
return this.sharedDidIdentityHeader.$(
SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE,
);
}

public get sharedDidIdentityEmbedButton() {
return $(SELECTORS.SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON);
}

public get sharedDidIdentityHeader() {
return $(SELECTORS.SHARED_DID_IDENTITY_HEADER);
}

public get sharedDidIdentityProfileImage() {
return this.sharedDidIdentityBannerImage.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_IMAGE,
);
}

public get sharedDidIdentityProfileName() {
return $(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME);
}

public get sharedDidIdentityProfileNameValue() {
return this.sharedDidIdentityProfileName.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE,
);
}

public get sharedDidIdentityProfileNameValueText() {
return this.sharedDidIdentityProfileNameValue.$(
SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT,
);
}

// Messages Received Methods

async waitForMessageToBeDeleted(expectedMessage: string) {
Expand Down Expand Up @@ -476,6 +527,63 @@ class MessageRemote extends UplinkMainScreen {
return iconTitle;
}

// Share DID Methods

async getLastMessageReceived() {
const messagesReceived = await this.chatMessageRemote;
const lastMessageReceivedIndex = (await messagesReceived.length) - 1;
const lastMessageReceived =
await messagesReceived[lastMessageReceivedIndex];
return lastMessageReceived;
}

async getLastSharedDIDBannerImage() {
const messageReceived = await this.getLastMessageReceived();
const messageReceivedSharedDidBannerImage = await messageReceived
.$(SELECTORS.SHARED_DID_IDENTITY_HEADER)
.$(SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE);
await messageReceivedSharedDidBannerImage.waitForExist();
return messageReceivedSharedDidBannerImage;
}

async getLastSharedDIDEmbedButton() {
const messageReceived = await this.getLastMessageReceived();
const messageReceivedSharedDidEmbedButton = await messageReceived.$(
SELECTORS.SHARED_DID_IDENTITY_EMBED_IDENTITY_BUTTON,
);
await messageReceivedSharedDidEmbedButton.waitForExist();
return messageReceivedSharedDidEmbedButton;
}

async getLastSharedDIDHeader() {
const messageReceived = await this.getLastMessageReceived();
const messageReceivedSharedDidIdentityHeader = await messageReceived.$(
SELECTORS.SHARED_DID_IDENTITY_HEADER,
);
await messageReceivedSharedDidIdentityHeader.waitForExist();
return messageReceivedSharedDidIdentityHeader;
}

async getLastSharedDIDProfileImage() {
const messageReceived = await this.getLastMessageReceived();
const messageReceivedSharedDidProfileImage = await messageReceived
.$(SELECTORS.SHARED_DID_IDENTITY_HEADER)
.$(SELECTORS.SHARED_DID_IDENTITY_BANNER_IMAGE)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_IMAGE);
await messageReceivedSharedDidProfileImage.waitForExist();
return messageReceivedSharedDidProfileImage;
}

async getLastSharedDIDProfileName() {
const messageReceived = await this.getLastMessageReceived();
const messageReceivedSharedDidProfileName = await messageReceived
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE)
.$(SELECTORS.SHARED_DID_IDENTITY_PROFILE_NAME_VALUE_TEXT);
await messageReceivedSharedDidProfileName.waitForExist();
return messageReceivedSharedDidProfileName;
}

// Replies Methods

async getLastReply() {
Expand Down
59 changes: 23 additions & 36 deletions tests/screenobjects/chats/QuickProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,91 +67,78 @@ class QuickProfile extends UplinkMainScreen {
super(SELECTORS.QUICK_PROFILE);
}

public get chatLayout() {
return $(SELECTORS.CHAT_LAYOUT);
}

public get quickProfile() {
return $(SELECTORS.CHAT_LAYOUT).$(SELECTORS.QUICK_PROFILE);
return this.chatLayout.$(SELECTORS.QUICK_PROFILE);
}

public get quickProfileBannerImage() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_BANNER_IMAGE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_BANNER_IMAGE);
}

public get quickProfileBlockUser() {
return $(SELECTORS.QUICK_PROFILE).$(SELECTORS.QUICK_PROFILE_BLOCK);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_BLOCK);
}

public get quickProfileEditProfile() {
return $(SELECTORS.QUICK_PROFILE).$(SELECTORS.QUICK_PROFILE_SELF_EDIT);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_SELF_EDIT);
}

public get quickProfileIdentityHeader() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_IDENTITY_HEADER);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_IDENTITY_HEADER);
}

public get quickProfileIndicator() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_INDICATOR);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_INDICATOR);
}

public get quickProfileIndicatorOffline() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_INDICATOR_OFFLINE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_INDICATOR_OFFLINE);
}

public get quickProfileIndicatorOnline() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_INDICATOR_ONLINE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_INDICATOR_ONLINE);
}

public get quickProfileMessage() {
return $(SELECTORS.QUICK_PROFILE).$(SELECTORS.QUICK_PROFILE_MESSAGE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_MESSAGE);
}

public get quickProfileRemoveFriend() {
return $(SELECTORS.QUICK_PROFILE).$(SELECTORS.QUICK_PROFILE_FRIEND_REMOVE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_FRIEND_REMOVE);
}

public get quickProfileShareDid() {
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_SHARE_DID);
}

public get quickProfileUnblockUser() {
return $(SELECTORS.QUICK_PROFILE).$(SELECTORS.QUICK_PROFILE_UNBLOCK);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_UNBLOCK);
}

public get quickProfileUserImage() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_USER_IMAGE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_USER_IMAGE);
}

public get quickProfileUserName() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_USER_NAME);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_USER_NAME);
}

public get quickProfileUserNameValue() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_USER_NAME_VALUE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_USER_NAME_VALUE);
}

public get quickProfileUserNameValueText() {
return $(SELECTORS.CHAT_LAYOUT)
.$(SELECTORS.QUICK_PROFILE)
.$(SELECTORS.QUICK_PROFILE_USER_NAME_VALUE)
.$(SELECTORS.QUICK_PROFILE_USER_NAME_VALUE_TEXT);
return this.quickProfileUserNameValue.$(
SELECTORS.QUICK_PROFILE_USER_NAME_VALUE_TEXT,
);
}

public get quickProfileUserVolumeLabel() {
return $(SELECTORS.QUICK_PROFILE_USER_VOLUME_LABEL);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_USER_VOLUME_LABEL);
}

public get quickProfileUserVolumeLabelText() {
Expand All @@ -161,7 +148,7 @@ class QuickProfile extends UplinkMainScreen {
}

public get quickProfileUserVolumeRange() {
return $(SELECTORS.QUICK_PROFILE_USER_VOLUME_RANGE);
return this.quickProfile.$(SELECTORS.QUICK_PROFILE_USER_VOLUME_RANGE);
}

public get quickProfileUserVolumeRangeInput() {
Expand Down
Loading
Loading