Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Fixes #13345 : UI Automation: Write an automated test using Cypress for "Selected options with long usernames are not cut off in the RHS" #4594

Merged
merged 18 commits into from
Jan 28, 2020

Conversation

M-ZubairAhmed
Copy link
Member

@M-ZubairAhmed M-ZubairAhmed commented Dec 27, 2019

Summary

Test to check if long usernames are truncated in options in rhs

Ticket Link

Fixes : mattermost/mattermost#13345
Jira : https://mattermost.atlassian.net/browse/MM-21038

@jasonblais jasonblais added the Work in Progress Not yet ready for review label Dec 28, 2019
@M-ZubairAhmed
Copy link
Member Author

M-ZubairAhmed commented Dec 28, 2019

This PR is blocked until issue addressed raised here mattermost/mattermost#13345 (comment) is addressed

@saturninoabril
Copy link
Member

@M-ZubairAhmed The long username is permissible on server but has limitation on client only. I'd suggest to continue with the original test requirement with my comment on how to create new user with long username.

@M-ZubairAhmed
Copy link
Member Author

This PR is blocked until team discussion for how does long username should look like

@saturninoabril
Copy link
Member

https://mattermost.atlassian.net/browse/MM-21467 - ticket filed on expected behavior of truncated and not cut-off.

@mattermod
Copy link
Contributor

This issue has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @hanzei

@M-ZubairAhmed
Copy link
Member Author

Closing this until the issue above is solved

@saturninoabril
Copy link
Member

@M-ZubairAhmed fyi, selected long username is now truncated. Fixed by #4671

@M-ZubairAhmed M-ZubairAhmed reopened this Jan 21, 2020
@M-ZubairAhmed M-ZubairAhmed changed the title [WIP] Fixes #13345 : UI Automation: Write an automated test using Cypress for "Selected options with long usernames are not cut off in the RHS" Fixes #13345 : UI Automation: Write an automated test using Cypress for "Selected options with long usernames are not cut off in the RHS" Jan 22, 2020
@hanzei hanzei added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester and removed Lifecycle/1:stale Work in Progress Not yet ready for review labels Jan 25, 2020
@M-ZubairAhmed
Copy link
Member Author

oh i am taking about Note: This test requires webhook server running. Initiatenpm run start:webhook to start.

Copy link
Contributor

@josephbaylon josephbaylon left a comment

Choose a reason for hiding this comment

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

@M-ZubairAhmed When I have the webhook turned on I get this different failure consistently
Screen Shot 2020-01-27 at 10 23 50 PM

@josephbaylon
Copy link
Contributor

@saturninoabril Are you able to run this test fine? If so, I'll defer to your results

@M-ZubairAhmed
Copy link
Member Author

@josephbaylon do you mind sharing the complete screen shot ?

@josephbaylon
Copy link
Contributor

@M-ZubairAhmed Here's what I've observed. If I run it by itself, the test passes but if I run it with the other tests in the file, it fails. For some reason, when run with other tests, the webhook post for user options doesn't get posted. I tried adding a timeout but still the same. Maybe you could run the whole test and see if you get the same behavior.

Screen Shot 2020-01-27 at 11 55 04 PM

@M-ZubairAhmed
Copy link
Member Author

@josephbaylon oh yes i can see that now, it looks like there is some issue with the webhook. Do you and @saturninoabril know how this can be solved ?

@saturninoabril
Copy link
Member

For some reason, all tests passed on me the first time I reviewed this and now seeing the same failing test as yours. I'll take a look.

@M-ZubairAhmed
Copy link
Member Author

thank you @saturninoabril

@saturninoabril
Copy link
Member

I'm seeing invalid session log on server. It may be due to cy.createNewUser that sign out then sign in sysadmin. For long term fix, we might need to revisit cy.createNewUser. Short fix for this PR is to move cy.createNewUser at before hook.

...
let longUsername;

describe('Interactive Menu', () => {
    before(() => {
        // Set required ServiceSettings
        const newSettings = {
            ServiceSettings: {
                AllowedUntrustedInternalConnections: 'localhost',
                EnablePostUsernameOverride: true,
                EnablePostIconOverride: true,
            },
        };
        cy.apiUpdateConfig(newSettings);

        cy.apiLogin('sysadmin').visit('/ad-1');
        longUsername = `name-of-64-abcdefghijklmnopqrstuvwxyz-123456789-${Date.now()}`;
        cy.getCurrentTeamId().then((teamId) => {
            // # Create a new user with 64 chars length
            cy.createNewUser({username: longUsername}, [teamId]);
        });

        // # Login as sysadmin and ensure that teammate name display setting is set to default 'username'
        cy.apiLogin('sysadmin');
        ...

@M-ZubairAhmed
Copy link
Member Author

thank you @saturninoabril for swiftly identifying the bug, I will send the update.
In future please refer the issue for the fix to me, i will be happy to help

@M-ZubairAhmed
Copy link
Member Author

Hi, i fixed the test as per Saturnino's comment

package-lock.json Outdated Show resolved Hide resolved
Copy link
Contributor

@josephbaylon josephbaylon left a comment

Choose a reason for hiding this comment

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

LGTM. Works for me now.

@josephbaylon josephbaylon added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Jan 28, 2020
@josephbaylon
Copy link
Contributor

@saturninoabril I'm not sure what's happening with the untagged-build failure.. says upload-s3 - Unauthorized Do you know how to resolve this?

@saturninoabril
Copy link
Member

If no outstanding issue on CI, we may try updating the branch and see if it passed. Else, we may ask help from Build team.

@saturninoabril
Copy link
Member

/update-branch

@saturninoabril saturninoabril added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Jan 28, 2020
@saturninoabril saturninoabril merged commit 215eedd into mattermost:master Jan 28, 2020
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Jan 28, 2020
@M-ZubairAhmed M-ZubairAhmed deleted the MM-21038 branch January 29, 2020 03:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation QA Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write an automated test using Cypress for "Selected options with long usernames are not cut off in the RHS"
8 participants