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

[tests-only][full-ci] Get collaborator role using either button or span selector #7064

Closed
wants to merge 1 commit into from

Conversation

saw-jan
Copy link
Member

@saw-jan saw-jan commented May 27, 2022

Description

The collaborator role can either be a dropdown or a plain text according to the share permissions. In this PR, I have refactored the getCollaboratorsList function to get the collaborator role either from a span or a button element.

Also, added the code that gets the permissions from a dropdown inside a try-catch block and returned empty permission if there is no dropdown elements.

Related Issue

Changes made in #7015
Closes #7047

Motivation and Context

How Has This Been Tested?

  • local

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@saw-jan saw-jan self-assigned this May 27, 2022
@saw-jan saw-jan changed the title [tests-only][full-ci] Get collaborator role using both either button or span selectors [tests-only][full-ci] Get collaborator role using either button or span selectors May 27, 2022
@saw-jan saw-jan changed the title [tests-only][full-ci] Get collaborator role using either button or span selectors [tests-only][full-ci] Get collaborator role using either button or span selector May 27, 2022
Comment on lines +327 to +340
let currentSharePermissions = {}
try {
await collaboratorDialog.expandShareRoleDropdown(collaborator)
await this.selectRole('Custom permissions')
// read the permissions from the checkboxes
currentSharePermissions = await this.getSharePermissions()

// Hide role select dropdown
await this.moveToElement('@customPermissionsDrop', -9, 0)
await this.api.mouseButtonClick()
await this.waitForElementNotPresent('@customPermissionsDrop', 1000)
} catch (e) {
console.info('Collaborator Role is not editable!')
}
Copy link
Member Author

@saw-jan saw-jan May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is this #7063 issue on the web, I am less confident about this change.

And we don't have a test to check that after resharing with read-only permission, the collaborator role is listed as plain text. Tests won't catch the bug (#7063) in the future if this gets implemented.

Also, I am not sure whether the role should be listed as plain text or a drop-down after resharing with read-only permission.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we can work out why this different behavior happens!

@saw-jan do you see the problem manually? (Is it possible to observe both behaviors when slowly using the web UI manually?) (I want to rule out the chance that there is some transient display of UI elements which the automated test sometimes "sees" but for real users maybe the correct UI elements end up being displayed after a "flicker" of the incorrect UI elements)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the issue can be reproduced manually. Steps to reproduce are listed here #7063

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't like to have this kind of workarounds in the test.
We had a similar discussion for the e2e tests in https://confluence.owncloud.com/pages/viewpage.action?pageId=28807613

what to do with bugs discovered by e2e tests?

  • create an issue
  • if possible run the journey without the step that fails
  • if not then don't merge the test-PR that demonstrate the bug till the bug is fixed

We might want to make an exception here, because its not a failing test but a flaky one, but then we have to make super-sure that the workaround will be taken out when the bug is fixed

@kulmann what do you think?

currentSharePermissions = await this.getSharePermissions()

// Hide role select dropdown
await this.moveToElement('@customPermissionsDrop', -9, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get away without that position arguments? I know that has been there before (and even adjusted in between from -7 to -9).
We should get rid of it because

  1. it will always give us problems in the case of a slight change
  2. magic numbers are bad in the first place
    but it could be done in a separate PR

// Hide role select dropdown
await this.moveToElement('@customPermissionsDrop', -9, 0)
await this.api.mouseButtonClick()
await this.waitForElementNotPresent('@customPermissionsDrop', 1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to get rid of the fix timeout, this is a main thing why tests are becoming flacky AND slow. We might waste time here or maybe tomorrow 1000 will not be enough.
I know this was there before, so the refactoring could happen in an other PR

Comment on lines +327 to +340
let currentSharePermissions = {}
try {
await collaboratorDialog.expandShareRoleDropdown(collaborator)
await this.selectRole('Custom permissions')
// read the permissions from the checkboxes
currentSharePermissions = await this.getSharePermissions()

// Hide role select dropdown
await this.moveToElement('@customPermissionsDrop', -9, 0)
await this.api.mouseButtonClick()
await this.waitForElementNotPresent('@customPermissionsDrop', 1000)
} catch (e) {
console.info('Collaborator Role is not editable!')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't like to have this kind of workarounds in the test.
We had a similar discussion for the e2e tests in https://confluence.owncloud.com/pages/viewpage.action?pageId=28807613

what to do with bugs discovered by e2e tests?

  • create an issue
  • if possible run the journey without the step that fails
  • if not then don't merge the test-PR that demonstrate the bug till the bug is fixed

We might want to make an exception here, because its not a failing test but a flaky one, but then we have to make super-sure that the workaround will be taken out when the bug is fixed

@kulmann what do you think?

@saw-jan saw-jan force-pushed the collaborator-role-selector branch from f1cfd10 to f28e192 Compare May 31, 2022 09:11
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@fschade
Copy link
Contributor

fschade commented May 31, 2022

@saw-jan, thanks for the PR, the linked bug is already in our Beta board, lets see when this will be fixed, from my side i would love to see it fixed inside web which then would make this pr obsolete.

cc.: @phil-davis

@phil-davis
Copy link
Contributor

I moved this to "blocked" and removed review requests. We will see this week if the underlying problem with the web code can be fixed.

@saw-jan
Copy link
Member Author

saw-jan commented Aug 2, 2022

The main issue has been fixed in the source code: #7063
Closing this PR

@saw-jan saw-jan closed this Aug 2, 2022
@saw-jan saw-jan deleted the collaborator-role-selector branch May 11, 2023 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webUIResharing2/reshareUsers.feature:29 fails in nightly
4 participants