Refactor data-test attribute

This commit is contained in:
Alejandro Alonso 2024-06-18 16:55:31 +02:00
parent 44676ecf25
commit 00c879a566
9 changed files with 57 additions and 57 deletions

View File

@ -16,7 +16,7 @@ exports.DashboardPage = class DashboardPage extends BasePage {
'div[class*="dashboard-grid"] div[class*="grid-item-th"]',
);
this.fileNameTitle = page.locator('div[class*="item-info"] h3');
this.deleteFileMenuItem = page.locator('a[data-test="file-delete"]');
this.deleteFileMenuItem = page.locator('a[data-testid="file-delete"]');
this.deleteFileButton = page.locator(
'input[value="Delete files"],input[value="Delete file"]',
);
@ -25,33 +25,33 @@ exports.DashboardPage = class DashboardPage extends BasePage {
'div[class*="dashboard-grid"] button[class*="create-new"]',
);
this.createFileButtonTitlePanel = page.locator(
'button[data-test="project-new-file"]',
'button[data-testid="project-new-file"]',
);
this.renameFileMenuItem = page.locator('a[data-test="file-rename"]');
this.duplicateFileMenuItem = page.locator('a[data-test="file-duplicate"]');
this.renameFileMenuItem = page.locator('a[data-testid="file-rename"]');
this.duplicateFileMenuItem = page.locator('a[data-testid="file-duplicate"]');
this.addFileAsSharedLibraryMenuItem = page.locator(
'a[data-test="file-add-shared"]',
'a[data-testid="file-add-shared"]',
);
this.addFileAsSharedLibraryButton = page.locator(
'input[value="Add as Shared Library"]',
);
this.sharedLibraryIcon = page.locator('svg[class="icon-library"]');
this.delFileAsSharedLibraryMenuItem = page.locator(
'a[data-test="file-del-shared"]',
'a[data-testid="file-del-shared"]',
);
this.delFileAsSharedLibraryButton = page.locator('input[value="Unpublish"]');
this.moveToFileMenuItem = page.locator(
'a[data-test="file-move-to"]',
'a[data-testid="file-move-to"]',
);
this.moveToOtherTeamMenuItem = page.locator(
'li[id="move-to-other-team"] a',
);
this.dashboardLibraryItem = page.locator(`button[title="New File 1"] div[class*="dashboard_grid__library"]`);
this.downloadFilePenpotMenuItem = page.locator(
'a[data-test="download-binary-file"]',
'a[data-testid="download-binary-file"]',
);
this.downloadFileStandardMenuItem = page.locator(
'a[data-test="download-standard-file"]',
'a[data-testid="download-standard-file"]',
);
this.dashboardSection = page.locator('[class="main_ui_dashboard__dashboard"]');
this.downloadFileTickIcon = page.locator('svg[class="icon-tick"]');
@ -65,32 +65,32 @@ exports.DashboardPage = class DashboardPage extends BasePage {
);
//Projects
this.addProjectButton = page.locator('button[data-test="new-project-button"]');
this.addProjectButton = page.locator('button[data-testid="new-project-button"]');
this.projectNameInput = page.locator(
'div[class*="project-name-wrapper"] div[class*="edit-wrapper"]',
);
this.projectNameTitle = page.locator('div[class*="project-name-wrapper"] h2');
this.deleteProjectMenuItem = page.locator('a[data-test="project-delete"]');
this.deleteProjectMenuItem = page.locator('a[data-testid="project-delete"]');
this.deleteProjectButton = page.locator(
'input[value="Delete files"],input[value="Delete project"]',
);
this.renameProjectMenuItem = page.locator('a[data-test="project-rename"]');
this.duplicateProjectMenuItem = page.locator('a[data-test="project-duplicate"]');
this.renameProjectMenuItem = page.locator('a[data-testid="project-rename"]');
this.duplicateProjectMenuItem = page.locator('a[data-testid="project-duplicate"]');
this.pinUnpinProjectButton = page.locator('button[aria-label="Pin/Unpin"]');
this.projectOptionsMenuButton = page.locator(
'button[data-test="project-options"]',
'button[data-testid="project-options"]',
);
this.projectsSidebarItem = page.locator('li:has-text("Projects")');
this.draftsSidebarItem = page.locator('li:has-text("Drafts")');
this.librariesSidebarItem = page.locator('li:has-text("Libraries")');
this.pinnedProjectsSidebarItem = page.locator(
'div[data-test="pinned-projects"]',
'div[data-testid="pinned-projects"]',
);
this.searchInput = page.locator('#search-input');
this.projectOptions = page.locator('[data-test="project-options"]');
this.projectOptions = page.locator('[data-testid="project-options"]');
// Import files
this.fileImport = page.locator('a[data-test="file-import"]');
this.fileImport = page.locator('a[data-testid="file-import"]');
this.modalTitle = page.locator('h2[class*="modal-title"]');
this.modalCancelButton = page.locator(
'div[class*="modal-footer"] input[class*="cancel-button"]',
@ -130,11 +130,11 @@ exports.DashboardPage = class DashboardPage extends BasePage {
this.fontFormatError = page.locator('.main_ui_notifications_toast_notification__text');
//Libraries & Templates
this.noLibrariesPlacelder = page.locator('div[data-test="empty-placeholder"] p');
this.noLibrariesPlacelder = page.locator('div[data-testid="empty-placeholder"] p');
this.onboardingNextBtn = page.locator('button[data-test="onboarding-next-btn"]');
this.onboardingNextBtn = page.locator('button[data-testid="onboarding-next-btn"]');
this.onboardingContinueBtn = page.locator('button[class="main_ui_onboarding_newsletter__accept-btn"]');
this.onboardingHeader = page.locator('h1[data-test="onboarding-welcome"]');
this.onboardingHeader = page.locator('h1[data-testid="onboarding-welcome"]');
this.planingToUsingDropdown = page.locator('div[class*="custom-select"]');
this.planingToUsingDropdownLabel = page.locator('div[class*="custom-select"] span').first();
this.planingOtherInput = page.locator('#planning-other');
@ -150,7 +150,7 @@ exports.DashboardPage = class DashboardPage extends BasePage {
this.toolsButton = page.locator('label[class*="components_forms__radio-label-image"]');
this.otherRole = page.locator('label[for="role-other"]').first();
this.otherRoleInput = page.locator('input[id="role-other"][type="text"]');
this.onboardingNewsHeader = page.locator('*[data-test="onboarding-newsletter-title"]');
this.onboardingNewsHeader = page.locator('*[data-testid="onboarding-newsletter-title"]');
this.onboardingNewsUpdatesCheckbox = page.locator('label[for="newsletter-updates"]');
this.onboardingNewsCheckbox = page.locator('label[for="newsletter-news"]');
this.onboardingCreateTeamInput = page.locator('input[class*="team-name-input"]');
@ -413,7 +413,7 @@ exports.DashboardPage = class DashboardPage extends BasePage {
async openProjectFromLeftSidebar(projectName) {
const projectSel = await this.page.locator(
`div[data-test="pinned-projects"] span[class*="element-title"]:has-text("${projectName}")`,
`div[data-testid="pinned-projects"] span[class*="element-title"]:has-text("${projectName}")`,
);
await projectSel.click();
await this.isHeaderDisplayed(projectName);

View File

@ -23,8 +23,8 @@ exports.TeamPage = class TeamPage extends BasePage {
this.teamOptionsMenuButton = page.locator('button[class*="switch-options"]');
this.deleteTeamMenuItem = page.locator('#teams-options-delete-team');
this.deleteTeamButton = page.locator('input[value="Delete team"]');
this.teamSettingsMenuItem = page.locator('li[data-test="team-settings"]');
this.renameTeamMenuItem = page.locator('li[data-test="rename-team"]');
this.teamSettingsMenuItem = page.locator('li[data-testid="team-settings"]');
this.renameTeamMenuItem = page.locator('li[data-testid="rename-team"]');
this.uploadTeamImageButton = page.locator('input[type="file"]');
this.updateTeamButton = page.locator('button:has-text("Update team")');
this.teamOwnerSpan = page.locator(
@ -43,11 +43,11 @@ exports.TeamPage = class TeamPage extends BasePage {
this.teamOwnerSection = page.locator('//div[text()="Team members"]/..');
this.teamStatsSection = page.locator('//div[text()="Team projects"]/..');
this.membersMenuItem = page.locator('li[data-test="team-members"]');
this.membersMenuItem = page.locator('li[data-testid="team-members"]');
//Invitations
this.invitationsMenuItem = page.locator('li[data-test="team-invitations"]');
this.inviteMembersToTeamButton = page.locator('a[data-test="invite-member"]');
this.invitationsMenuItem = page.locator('li[data-testid="team-invitations"]');
this.inviteMembersToTeamButton = page.locator('a[data-testid="invite-member"]');
this.inviteMembersPopUpHeader = page.locator(
'div[class*="modal-team-container"] div[class*="title"]',
);

View File

@ -9,7 +9,7 @@ exports.ForgotPasswordPage = class ForgotPasswordPage extends BasePage {
super(page);
this.emailInput = page.locator('#email');
this.recoverPasswordButton = page.locator('data-test=recovery-resquest-submit');
this.recoverPasswordButton = page.locator('data-testid=recovery-resquest-submit');
this.recoveryPwdInput = page.locator('#password-1');
this.recoveryPwdConfirmInput = page.locator('#password-2');

View File

@ -8,16 +8,16 @@ exports.LoginPage = class LoginPage extends BasePage {
constructor(page) {
super(page);
this.pageTitle = page.locator('h1[data-test="login-title"]');
this.pageTitle = page.locator('h1[data-testid="login-title"]');
this.emailInput = page.locator('#email');
this.pwdInput = page.locator('#password');
this.loginButton = page.locator('button[data-test="login-submit"]');
this.emailInputError = page.locator('div[data-test="-error"]');
this.loginButton = page.locator('button[data-testid="login-submit"]');
this.emailInputError = page.locator('div[data-testid="-error"]');
this.section = page.locator('section[class="auth-content"]');
this.loginErrorBanner = page.locator('aside[class*="context_notification__warning"] div:nth-of-type(2)');
this.createAccountLink = page.locator('a:has-text("Create an account")');
this.forgotPasswordLink = page.locator('a[data-test="forgot-password"]');
this.loginHereButton = page.locator('*[data-test="login-here-link"]');
this.forgotPasswordLink = page.locator('a[data-testid="forgot-password"]');
this.loginHereButton = page.locator('*[data-testid="login-here-link"]');
}
async checkLoginError(text) {

View File

@ -537,7 +537,7 @@ exports.PerformancePage = class PerformancePage extends BasePage {
* @returns {Promise<void>}
*/
async selectPage(pageId) {
const pageItem = await this.page.locator(`[data-test="page-${pageId}"]`);
const pageItem = await this.page.locator(`[data-testid="page-${pageId}"]`);
await pageItem.scrollIntoViewIfNeeded();
await pageItem.click();
}

View File

@ -11,24 +11,24 @@ exports.ProfilePage = class ProfilePage extends BasePage {
this.profileSection = page.locator('.main_ui_settings__dashboard-content');
//Account
this.profileMenuButton = page.locator('button[data-test="profile-btn"]');
this.yourAccountMenuItem = page.locator('li[data-test="profile-profile-opt"]');
this.logoutMenuItem = page.locator('li[data-test="logout-profile-opt"]');
this.giveFeedbackMenuItem = page.locator('li[data-test="feedback-profile-opt"]');
this.profileMenuButton = page.locator('button[data-testid="profile-btn"]');
this.yourAccountMenuItem = page.locator('li[data-testid="profile-profile-opt"]');
this.logoutMenuItem = page.locator('li[data-testid="logout-profile-opt"]');
this.giveFeedbackMenuItem = page.locator('li[data-testid="feedback-profile-opt"]');
this.backToDashboardBtn = page.locator('button[class*="back-to-dashboard"]');
//Profile
this.profileNameInput = page.locator('#fullname');
this.profileEmailInput = page.locator('#email');
this.saveSettingsButton = page.locator('button:has-text("Save settings")');
this.profileImageInput = page.locator('input[data-test="profile-image-input"]');
this.profileImageInput = page.locator('input[data-testid="profile-image-input"]');
this.profileAvatarBlock = page.locator(
'div.main_ui_settings_profile__form-container',
);
this.changeEmailBtn = page.locator('div[class="change-email"]');
this.newEmailInput = page.locator('#email-1');
this.confirmNewEmailInput = page.locator('#email-2');
this.confirmChangeEmailBtn = page.locator('div[data-test="change-email-submit"] button');
this.confirmChangeEmailBtn = page.locator('div[data-testid="change-email-submit"] button');
//Feedback
this.feedbackSubjectInput = page.locator('#subject');
@ -44,14 +44,14 @@ exports.ProfilePage = class ProfilePage extends BasePage {
this.passwordNewInput = page.locator('input[placeholder="New password"]');
this.passwordConfirmInput = page.locator('input[placeholder="Confirm password"]');
this.updateSettingsBtn = page.locator('button[name="submit"]');
this.passwordInputError = page.locator('div[data-test="-error"]');
this.passwordInputError = page.locator('div[data-testid="-error"]');
//Settings
this.settingsMenuButton = page.locator('li[data-test="settings-profile"]');
this.settingsMenuButton = page.locator('li[data-testid="settings-profile"]');
this.darkThemeOption = page.locator('li span:text-is("Penpot Dark (default)")');
this.lightThemeOption = page.locator('li span:text-is("Penpot Light")');
this.uiThemeDropdown = page.locator('[class*="select-wrapper"] >>nth=1');
this.giveFeedbackMenuItem = page.locator('li[data-test="feedback-profile-opt"]');
this.giveFeedbackMenuItem = page.locator('li[data-testid="feedback-profile-opt"]');
}
async openYourAccountPage() {

View File

@ -8,14 +8,14 @@ exports.RegisterPage = class RegisterPage extends BasePage {
constructor(page) {
super(page);
this.pageTitle = page.locator('h1[data-test="registration-title"]');
this.pageTitle = page.locator('h1[data-testid="registration-title"]');
this.emailInput = page.locator('#email');
this.passwordInput = page.locator('#password');
this.createAccountBtn = page.locator('button[data-test="register-form-submit"]');
this.createAccountBtn = page.locator('button[data-testid="register-form-submit"]');
this.createAccountSecondBtn = page.locator('button[type="submit"]');
this.emailInputError = page.locator('div[data-test="email-input-error"]');
this.emailInputError = page.locator('div[data-testid="email-input-error"]');
this.passwordInputHint = page.locator('div.main_ui_components_forms__hint');
this.passwordInputError = page.locator('div[data-test="-error"]');
this.passwordInputError = page.locator('div[data-testid="-error"]');
this.fullnameInput = page.locator('input[id="fullname"]');
this.acceptTermsCheckbox = page.locator('label[for="accept-terms-and-privacy"] span');
this.regEmailNotification = page.locator('div[class*="notification-text-email"]');

View File

@ -229,8 +229,8 @@ exports.DesignPanelPage = class DesignPanelPage extends BasePage {
this.strokeOpacityInput = page.locator(
'div[class*="stroke-data"] input[class*="opacity-input"]',
);
this.strokeAlignmentField = page.locator('div[data-test="stroke.alignment"]');
this.strokeTypeField = page.locator('div[data-test="stroke.style"]');
this.strokeAlignmentField = page.locator('div[data-testid="stroke.alignment"]');
this.strokeTypeField = page.locator('div[data-testid="stroke.style"]');
this.strokeFirstCapDropdown = page.locator('div[class*="stroke_row__cap-select"]').first();
this.strokeSecondCapDropdown = page.locator('div[class*="stroke_row__cap-select"]').last();

View File

@ -11,13 +11,13 @@ exports.MainPage = class MainPage extends BasePage {
//Main Toolbar
this.pencilBoxButton = page.locator('a[class*="header__main-icon"]');
this.createBoardButton = page.locator('button[data-test="artboard-btn"]');
this.createRectangleButton = page.locator('button[data-test="rect-btn"]');
this.createEllipseButton = page.locator('button[data-test="ellipse-btn"]');
this.createBoardButton = page.locator('button[data-testid="artboard-btn"]');
this.createRectangleButton = page.locator('button[data-testid="rect-btn"]');
this.createEllipseButton = page.locator('button[data-testid="ellipse-btn"]');
this.createTextButton = page.locator('button[title="Text (T)"]');
this.uploadImageSelector = page.locator('#image-upload');
this.createCurveButton = page.locator('button[data-test="curve-btn"]');
this.createPathButton = page.locator('button[data-test="path-btn"]');
this.createCurveButton = page.locator('button[data-testid="curve-btn"]');
this.createPathButton = page.locator('button[data-testid="path-btn"]');
this.colorsPaletteButton = page.locator('button[title^="Color Palette"]');
this.mainToolBar = page.locator(
'[class*="main-toolbar"] button[class*="toolbar-handler"]',
@ -93,10 +93,10 @@ exports.MainPage = class MainPage extends BasePage {
'#file-menu-color-palette span:text-is("Hide color palette")',
);
this.showBoardNamesMainMenuSubItem = page.locator(
'li[data-test="display-artboard-names"] span:text-is("Show boards names")',
'li[data-testid="display-artboard-names"] span:text-is("Show boards names")',
);
this.hideBoardNamesMainMenuSubItem = page.locator(
'li[data-test="display-artboard-names"] span:text-is("Hide board names")',
'li[data-testid="display-artboard-names"] span:text-is("Hide board names")',
);
this.showPixelGridMainMenuSubItem = page.locator(
'#file-menu-pixel-grid span:text-is("Show pixel grid")',
@ -105,7 +105,7 @@ exports.MainPage = class MainPage extends BasePage {
'#file-menu-pixel-grid span:text-is("Hide pixel grid")',
);
this.showHideUIMainMenuSubItem = page.locator(
'li[data-test="hide-ui"] span:text-is("Show / Hide UI")',
'li[data-testid="hide-ui"] span:text-is("Show / Hide UI")',
);
this.dowloadPenpotFileMenuSubItem = page.locator('#file-menu-binary-file');
this.dowloadStandartFileMenuSubItem = page.locator('#file-menu-standard-file');