Skip to content

Commit

Permalink
update(fix): fix input text locators (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm authored Oct 2, 2024
1 parent 2657f12 commit d35a125
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 47 deletions.
12 changes: 6 additions & 6 deletions playwright/PageObjects/AuthNewAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class AuthNewAccount extends MainPage {
);
this.identiconNewAccount = this.page.locator(".identicon").locator("img");
this.inputNewAccountFileUpload = this.page.locator("input[type=file]");
this.inputNewAccountStatus = this.page.getByTestId(
"input-new-account-status",
);
this.inputNewAccountUsername = this.page.getByTestId(
"input-new-account-username",
);
this.inputNewAccountStatus = this.page
.getByTestId("input-new-account-status")
.locator("input");
this.inputNewAccountUsername = this.page
.getByTestId("input-new-account-username")
.locator("input");
this.labelNewAccountUsername = this.page.getByTestId(
"label-new-account-username",
);
Expand Down
6 changes: 3 additions & 3 deletions playwright/PageObjects/ChatsElements/EmojiPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export class EmojiPicker extends CombinedSelector {
constructor(public readonly page: Page) {
super(page);
this.categoryNav = this.page.getByTestId("emoji-category-nav");
this.emojiContainerSearchInput = this.page.getByTestId(
"emoji-container-search-input",
);
this.emojiContainerSearchInput = this.page
.getByTestId("emoji-container-search-input")
.locator("input");
this.emojiContainerSizeLabel = this.page.getByTestId(
"emoji-container-size-label",
);
Expand Down
12 changes: 8 additions & 4 deletions playwright/PageObjects/FriendsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ export class FriendsScreen extends MainPage {
this.friendsSectionRequests = this.page.getByTestId(
"friends-section-requests",
);
this.inputAddFriend = this.page.getByTestId("input-add-friend");
this.inputAddFriend = this.page
.getByTestId("input-add-friend")
.locator("input");
this.inputContainerAddFriend = this.page
.getByTestId("input-add-friend")
.locator("xpath=..");
.locator(".input-container");
this.inputContainerSearchFriends = this.page
.getByTestId("input-search-friends")
.locator("xpath=..");
this.inputSearchFriends = this.page.getByTestId("input-search-friends");
.locator(".input-container");
this.inputSearchFriends = this.page
.getByTestId("input-search-friends")
.locator("input");
this.labelAddSomeone = this.page.getByTestId("label-add-someone");
this.labelBlockedUsers = this.page.getByTestId("label-blocked-users");
this.labelFriendList = this.page.locator('[data-cy^="label-friend-list-"]');
Expand Down
8 changes: 7 additions & 1 deletion playwright/PageObjects/MainPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class MainPage {
readonly favoriteProfileStatusIndicator: Locator;
readonly favoritesLabel: Locator;
readonly inputSidebarSearch: Locator;
readonly inputSidebarSearchContainer: Locator;
readonly navigationBar: Locator;
readonly sidebar: Locator;
readonly sidebarChatPreview: Locator;
Expand Down Expand Up @@ -66,7 +67,12 @@ export default class MainPage {
this.favoriteProfileStatusIndicator =
this.favoriteProfilePicture.getByTestId("status-indicator");
this.favoritesLabel = this.page.getByTestId("label-favorites");
this.inputSidebarSearch = this.page.getByTestId("input-sidebar-search");
this.inputSidebarSearch = this.page
.getByTestId("input-sidebar-search")
.locator("input");
this.inputSidebarSearchContainer = this.page
.getByTestId("input-sidebar-search")
.locator(".input-container");
this.navigationBar = this.page.getByTestId(".navigation");
this.sidebar = this.page.getByTestId("sidebar");
this.sidebarChatPreview = this.sidebar.locator(".chat-preview");
Expand Down
5 changes: 3 additions & 2 deletions playwright/PageObjects/Settings/SettingsCustomizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ export class SettingsCustomizations extends SettingsBase {
this.fontScalingSectionIncreaseButton = this.fontScalingSection.getByTestId(
"button-font-scaling-increase",
);
this.fontScalingSectionInput =
this.fontScalingSection.getByTestId("input-font-scaling");
this.fontScalingSectionInput = this.fontScalingSection
.getByTestId("input-font-scaling")
.locator("input");
this.fontScalingSectionLabel = this.fontScalingSection.getByTestId(
"setting-section-label",
);
Expand Down
45 changes: 21 additions & 24 deletions playwright/PageObjects/Settings/SettingsProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ export class SettingsProfile extends SettingsBase {
this.accountIntegrationsItem = this.page.getByTestId(
"account-integrations-item",
);
this.accountIntegrationsItemAddressInput =
this.accountIntegrationsItem.getByTestId(
"input-address-account-integration-item",
);
this.accountIntegrationsItemAddressInput = this.accountIntegrationsItem
.getByTestId("input-address-account-integration-item")
.locator("input");
this.accountIntegrationsItemCopyButton =
this.accountIntegrationsItem.getByTestId(
"button-account-integration-item",
Expand All @@ -116,10 +115,9 @@ export class SettingsProfile extends SettingsBase {
this.accountIntegrationsItem.getByTestId(
"button-account-integrations-item-edit",
);
this.accountIntegrationsItemInput =
this.accountIntegrationsItem.getByTestId(
"input-account-integration-item",
);
this.accountIntegrationsItemInput = this.accountIntegrationsItem
.getByTestId("input-account-integration-item")
.locator("input");
this.accountIntegrationsItemLabel =
this.accountIntegrationsItem.getByTestId(
"label-account-integrations-item",
Expand All @@ -130,25 +128,24 @@ export class SettingsProfile extends SettingsBase {
this.accountIntegrationsItemLogo = this.accountIntegrationsItem.getByTestId(
"account-integration-item-logo",
);
this.accountIntegrationsItemPlatformInput =
this.accountIntegrationsItem.getByTestId(
"input-platform-account-integration-item",
);
this.accountIntegrationsItemPlatformInput = this.accountIntegrationsItem
.getByTestId("input-platform-account-integration-item")
.locator("input");
this.accountIntegrationsNewAddButton = this.page.getByTestId(
"button-account-integrations-new-add",
);
this.accountIntegrationsNewCancelButton = this.page.getByTestId(
"button-account-integrations-new-cancel",
);
this.accountIntegrationsNewAddressInput = this.page.getByTestId(
"input-account-integrations-new-address",
);
this.accountIntegrationsNewAddressInput = this.page
.getByTestId("input-account-integrations-new-address")
.locator("input");
this.accountIntegrationsNewAddressLabel = this.page.getByTestId(
"label-account-integration-new-address",
);
this.accountIntegrationsNewGenericInput = this.page.getByTestId(
"input-account-integrations-new-generic",
);
this.accountIntegrationsNewGenericInput = this.page
.getByTestId("input-account-integrations-new-generic")
.locator("input");
this.accountIntegrationsNewLogo = this.page.getByTestId(
"logo-account-integrations-new",
);
Expand Down Expand Up @@ -192,12 +189,12 @@ export class SettingsProfile extends SettingsBase {
this.inputSettingsProfileShortIDGroup = this.page.locator(
'[data-tooltip="Copy"]',
);
this.inputSettingsProfileStatus = this.page.getByTestId(
"input-settings-profile-status-message",
);
this.inputSettingsProfileUsername = this.page.getByTestId(
"input-settings-profile-username",
);
this.inputSettingsProfileStatus = this.page
.getByTestId("input-settings-profile-status-message")
.locator("input");
this.inputSettingsProfileUsername = this.page
.getByTestId("input-settings-profile-username")
.locator("input");
this.labelSettingsProfileStatusMessage = this.page.getByTestId(
"label-settings-profile-status-message",
);
Expand Down
5 changes: 3 additions & 2 deletions playwright/specs/02-friends-one-instance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ test.describe("Friends tests", () => {
await expect(friendsScreen.buttonAddFriend).toBeDisabled();

// H8 - Highlighted border should appear around Search Friends textbox when user enters a text on input field
await friendsScreen.inputSearchFriends.focus();
await expect(friendsScreen.inputContainerSearchFriends).toHaveCSS(
await friendsScreen.inputSearchFriends.fill("1234");
const container = friendsScreen.inputContainerSearchFriends;
await expect(container).toHaveCSS(
"box-shadow",
"rgb(77, 77, 255) 0px 0px 0px 1px",
);
Expand Down
2 changes: 2 additions & 0 deletions playwright/specs/03-friends-two-instances.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1748,9 +1748,11 @@ test.describe("Two instances tests - Friends and Chats", () => {
const imageSent = chatsMainPageSecond.messageBubbleContent
.last()
.locator("img");
await imageSent.waitFor({ state: "attached" });
const imageReceived = chatsMainPageFirst.messageBubbleContent
.last()
.locator("img");
await imageReceived.waitFor({ state: "attached" });
await expect(imageSent).toHaveAttribute("alt", "Power Up");
await expect(imageSent).toBeVisible();
await expect(imageReceived).toHaveAttribute("alt", "Power Up");
Expand Down
4 changes: 1 addition & 3 deletions playwright/specs/05-chats-sidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ test.describe("Chats Sidebar Tests", () => {

await chatsMainPage.inputSidebarSearch.focus();

const inputContainer = chatsMainPage.inputSidebarSearch.locator("xpath=..");

await expect(inputContainer).toHaveCSS(
await expect(chatsMainPage.inputSidebarSearchContainer).toHaveCSS(
"box-shadow",
"rgb(77, 77, 255) 0px 0px 0px 1px",
);
Expand Down
4 changes: 2 additions & 2 deletions playwright/specs/07-settings-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ test.describe("Settings Profile Tests", () => {

// User clicks on username textbox and all text is selected
await settingsProfile.assertInputTextSelected(
"[data-cy='input-settings-profile-username']",
"[data-cy='input-settings-profile-username'] input",
);
});

Expand Down Expand Up @@ -347,7 +347,7 @@ test.describe("Settings Profile Tests", () => {

// User clicks on status textbox and all text is selected
await settingsProfile.assertInputTextSelected(
"[data-cy='input-settings-profile-status-message']",
"[data-cy='input-settings-profile-status-message'] input",
);
});

Expand Down

0 comments on commit d35a125

Please sign in to comment.