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

Selection scraper created and integrated to project #6732

Merged
merged 8 commits into from
Jan 3, 2022
Merged

Selection scraper created and integrated to project #6732

merged 8 commits into from
Jan 3, 2022

Conversation

kursat
Copy link
Contributor

@kursat kursat commented Dec 13, 2021

Details

Fixed Issues

$ #5142

Tests & QA Steps

Android / IOS

  1. Send some messages contains markdown.
  2. Copy with context menu.
  3. Ensure copied message is same with sent message.

Web / Mobile Web / Desktop

  1. Send some messages contains markdown.
  2. Copy with context menu.
  3. Copy all message by selecting with mouse.
  4. Copy single line of message by selecting with mouse/double clicking.
  5. Copy a word of message by selecting with mouse/double clicking.
  6. Copy multiple line of message by selecting with mouse.
  7. Copy by selecting multiple messages with single/multiple lines. (This will not work as intended until another bug is fixed)
  8. Ensure copied message is same with sent message.

Markdowns to Test

  1. Code Block
  2. Inline Code Block
  3. Email
  4. Link
  5. Italic
  6. Bold
  7. Strikethrough
  8. Quote
  9. New line

Test String I've Used

    This is `code`
    ```
    this is block code
    ```
    Mail to: [Expensify]([email protected])
    Link: [Expensify](https://www.expensify.com)
    _italic_

    *bold*
    ~strikethrough~
    > Quote

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

I'll upload IOS and Desktop videos ASAP.

Web

5142-web.mp4

Mobile Web

5142-mobile-web.mp4

Desktop

5142-desktop.mp4

iOS

5142-ios.mp4

Android

5142-android.mp4

@kursat kursat marked this pull request as ready for review December 13, 2021 15:37
@kursat kursat requested a review from a team as a code owner December 13, 2021 15:37
@botify botify requested a review from thienlnam December 13, 2021 15:37
@MelvinBot MelvinBot removed the request for review from a team December 13, 2021 15:37
Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Looks solid! Just a few formatting comments

const tagAttribute = 'data-testid';

/**
* Reads html of selection. If there is no Selection API returns empty string.
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no selection, the API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant if browser doesn't support Selection API, Is it OK if I update it like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @thienlnam, I've updated all comments, can you recheck, if they are OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that update is good 👍 (just missing one more comment I left unresolved)

Comment on lines +33 to +35
} else {
node = range.commonAncestorContainer.parentNode.closest(`[${tagAttribute}]`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

When is this the case? / What does this else indicate

Copy link
Contributor

Choose a reason for hiding this comment

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

Still looking for this comment, on why the parentNode would have the closest tag attribute instead of the current node

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Comments look good, missing one comment and also looks like you have a large change with your package-lock.json that should be removed

Comment on lines +33 to +35
} else {
node = range.commonAncestorContainer.parentNode.closest(`[${tagAttribute}]`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Still looking for this comment, on why the parentNode would have the closest tag attribute instead of the current node

@kursat
Copy link
Contributor Author

kursat commented Dec 20, 2021

Hey @thienlnam, sorry for the package-lock.json file, I removed it but now all tests are failing. Is this normal? Also added the comment you requested along with a bugfix for Chrome.

@kursat kursat requested a review from thienlnam December 22, 2021 19:29
@thienlnam
Copy link
Contributor

Sorry I should have clarified, package-lock.json file should be included but for some reason your package-lock.json diff seemed to be way too large to just include the new changes for packages you installed.

The tests are failing since you added new packages in package.json but the package-lock.json doesn't have them.

Could you try doing an npm install and then adding those changes again?

@kursat
Copy link
Contributor Author

kursat commented Dec 24, 2021

@thienlnam, I updated package-lock.json file. Can you check please?

It looks like using newer version of node.js or npm causes big changes on package-lock.json file.

kursat@kursat-laptop:~$ node -v
v14.18.1
kursat@kursat-laptop:~$ npm -v
8.2.0
kursat@kursat-laptop:~/WebstormProjects/upwork/ExpensifyApp$ npm i
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...

Can we add an engines section to package.json file to prevent other contributors to face the same problem?

@thienlnam
Copy link
Contributor

Yup that looks much better, thanks!

Can we add an engines section to package.json file to prevent other contributors to face the same problem?

This is definitely something we can explore - feel free to propose the issue in the #expensify-open-source slack channel and then we can get the ball rolling from there

@thienlnam thienlnam merged commit 4151943 into Expensify:main Jan 3, 2022
@OSBotify
Copy link
Contributor

OSBotify commented Jan 4, 2022

🚀 Deployed to staging by @thienlnam in version: 1.1.24-19 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 failure ❌
🕸 web 🕸 failure ❌

@OSBotify
Copy link
Contributor

OSBotify commented Jan 4, 2022

🚀 Deployed to production by @francoisl in version: 1.1.24-19 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 failure ❌
🕸 web 🕸 failure ❌

@parasharrajat
Copy link
Member

A check contributed to the creation of invalid HTML tags when test-id attribute contains spaces. #29921. I am unable add the comment on the line.

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.

4 participants