-
Notifications
You must be signed in to change notification settings - Fork 14
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
wire - topic e2e test #617
Conversation
@@ -95,12 +96,15 @@ export function TopicFolder({ | |||
<button | |||
type="button" | |||
className="icon-button icon-button--tertiary" | |||
data-test-id="simple-card-toggle-btn" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improve data-test-id - call it "expand"
@@ -121,7 +125,9 @@ export function TopicFolder({ | |||
}} | |||
ref={buttonRef} | |||
className="icon-button icon-button--tertiary" | |||
aria-label={gettext('Folder Actions')}> | |||
aria-label={gettext('Folder Actions')} | |||
data-test-id={`folder-action-${folder.name}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-test-id={folder-action-${folder.name}
} -> data-test-id="menu" (or remove if unused)
@@ -47,6 +47,7 @@ export function TopicFolderActions({folder, toggleFolderPopover, folderPopover, | |||
toggle(e); | |||
action.callback(); | |||
}} | |||
data-test-id={`action-topic-${action.name}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove all usages of dynamic data-test-id
profileTopics.getTopicCardAction("Topic 1", "Edit").click(); | ||
UserTopicForm | ||
.getFormGroup('folder', '[data-test-id="dropdown-btn"]') | ||
.contains('New Folder'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use data-test-id
UserTopicForm | ||
.getFormGroup('folder', '[data-test-id="dropdown-btn"]') | ||
.contains('New Folder'); | ||
cy.get('[data-test-id="profile-content-close"]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improve naming -> profile-page-close
// check Share with my company checkbox | ||
cy.get('[data-test-id="field-is_global"] input').check(); | ||
UserTopicForm | ||
.getFormGroup('folder', '[data-test-id="dropdown-btn"]').click() | ||
cy.get('[data-test-id="dropdown-item--Folder 1"]').should("not.exist"); | ||
cy.get('[data-test-id="dropdown-item--company folder"]').should("exist"); | ||
|
||
// uncheck Share with my company checkbox | ||
cy.get('[data-test-id="field-is_global"] input').uncheck(); | ||
UserTopicForm | ||
.getFormGroup('folder', '[data-test-id="dropdown-btn"]').click() | ||
cy.get('[data-test-id="dropdown-item--Folder 1"]').should("exist"); | ||
cy.get('[data-test-id="dropdown-item--company folder"]').should("not.exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract into a separate test
|
||
// save to folder | ||
cy.get('[data-test-id="dropdown-item--Folder 1"]').click(); | ||
cy.get('[class="nh-button nh-button--primary"]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use data-test-id
|
||
// check if folder exist in appropriate folder in My Wire Topics | ||
cy.get('[data-test-id="edit-btn"]').click(); | ||
profileTopics.getFolderCard("Folder 1").find('[data-test-id="simple-card-toggle-btn"]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix naming of data-test-id
NewshubLayout.login('[email protected]', 'admin'); | ||
navigateToMyWireTopic(); | ||
|
||
profileTopics.getFolderCard("Folder 1").find('[data-test-id="simple-card-toggle-btn"]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix naming of data-test-id
navigateToMyWireTopic(); | ||
|
||
// remove topic from folder | ||
profileTopics.getFolderCard("Folder 1").find('[data-test-id="simple-card-toggle-btn"]').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix naming in data-test-id
assets/components/SidebarFolder.jsx
Outdated
@@ -6,7 +6,7 @@ export function SidebarFolder({folder, children}) { | |||
|
|||
return ( | |||
<div className={`collapsible-box collapsible-box--active-within ${open ? 'collapsible-box--open' : 'collapsible-box--closed'}`}> | |||
<div className="collapsible-box__header" onClick={() => setOpen(!open)} role='button'> | |||
<div className="collapsible-box__header" onClick={() => setOpen(!open)} role='button' data-test-id="collapse-box-button"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-test-id is called collapse
, but in code is doing toggling, not collapsing - adjust the name to match implementation.
@@ -47,6 +47,8 @@ export function TopicFolderActions({folder, toggleFolderPopover, folderPopover, | |||
toggle(e); | |||
action.callback(); | |||
}} | |||
data-test-id="action-folder" | |||
data-test-value={`${action.name}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use interpolation where it's not needed
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; | |||
|
|||
export function TopicItem({topic, isActive, onClick, newItems}: any) { | |||
return ( | |||
<li className="topic-list__item"> | |||
<li className="topic-list__item" data-test-id={`topic-list-item-${topic.label}`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use dynamic data-test-id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last changes are fine. The only thing remaining is to see if you can move some stuff into helpers.
NHUB-405