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

wire - topic e2e test #617

Merged
merged 3 commits into from
Oct 27, 2023
Merged

Conversation

dzonidoo
Copy link
Contributor

NHUB-405

@dzonidoo dzonidoo requested a review from tomaskikutis October 19, 2023 06:59
@petrjasek petrjasek added this to the v2.6 milestone Oct 19, 2023
@@ -95,12 +96,15 @@ export function TopicFolder({
<button
type="button"
className="icon-button icon-button--tertiary"
data-test-id="simple-card-toggle-btn"
Copy link
Member

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}`}
Copy link
Member

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}`}
Copy link
Member

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');
Copy link
Member

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();
Copy link
Member

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

Comment on lines 175 to 187
// 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");
Copy link
Member

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();
Copy link
Member

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();
Copy link
Member

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();
Copy link
Member

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();
Copy link
Member

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

@dzonidoo dzonidoo requested a review from tomaskikutis October 25, 2023 09:23
@@ -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">
Copy link
Member

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}`}
Copy link
Member

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}`}>
Copy link
Member

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

Copy link
Member

@tomaskikutis tomaskikutis left a 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.

@dzonidoo dzonidoo merged commit 9c04a33 into superdesk:develop Oct 27, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants