Skip to content

Domain selection when enabling travel for workspaces with admins from multiple domains #55300

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

Merged
merged 73 commits into from
Jan 27, 2025

Conversation

cristipaval
Copy link
Contributor

@cristipaval cristipaval commented Jan 15, 2025

HOLD on https://github.com/Expensify/Auth/pull/13841
HOLD on https://github.com/Expensify/Web-Expensify/pull/45210

Explanation of Change

Fixed Issues

$ #55377
PROPOSAL:

Tests

Workspace with admins having public domain emails

  1. Have an account with a public domain login (eg. [email protected]) that is a workspace admin
  2. If the workspace has more admins, make sure they all have public-domain emails
  3. Select the Book travel option from the Global Create menu
  4. On the Book Travel page, click on the Book Travel button
  5. Verify that you land on the page informing that you need a private domain
Screenshot 2025-01-24 at 15 01 04

Workspace with admins having the same private domain emails

  1. Have a workspace with 1 or more admins with logins from the same private domains that never used Travel before
  2. Sign in with one of the admins account
  3. Go to the Travel page and click the Book Travel button
  4. Verify that you are asked to Accept the Terms and Conditions
  5. Accept the conditions and then verify that you can open Travel in a different tab

Workspace with admins having different private domain emails

  1. Have a workspace with 2 or more admins with logins from different private domains that never used Travel before
  2. Sign in with one of the admins account
  3. Go to the Travel page and click the Book Travel button
  4. Verify that you are asked to choose from the admins' domains
Screenshot 2025-01-24 at 15 02 40
  1. Verify that you are asked to Accept the Terms and Conditions
  2. Accept the conditions and then verify that you can open Travel in a different tab

Workspace with admins having private unclaimed domain emails

  1. Sign up with a new user with a private domain
  2. In the same session, while the email isn't validated go to book travel
  3. Verify that you are asked to accept the terms and conditions
  4. Accept them and verify that you land on the page saying that you don't have permission to enable Travel for the domain
Screenshot 2025-01-24 at 16 38 43
  • Verify that no errors appear in the JS console

Offline tests

The same as tests, but when Offline, the Continue button should be disabled when accepting the Terms and Conditions. The user should also see the offline status at the bottom of the screen.
Screenshot 2025-01-24 at 16 59 12

QA Steps

Same as the Tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videos

Android: Native Screenshot 2025-01-24 at 16 38 43 Screenshot 2025-01-24 at 15 02 40 Screenshot 2025-01-24 at 15 01 04
Android: mWeb Chrome Screenshot 2025-01-23 at 18 56 12 Screenshot 2025-01-23 at 21 31 28 Screenshot 2025-01-23 at 21 32 14
iOS: Native Screenshot 2025-01-24 at 14 13 36 Screenshot 2025-01-24 at 14 02 35 Screenshot 2025-01-24 at 00 09 15
iOS: mWeb Safari Screenshot 2025-01-23 at 22 18 57 Screenshot 2025-01-23 at 22 17 36 Screenshot 2025-01-23 at 22 20 52
MacOS: Chrome / Safari Screenshot 2025-01-20 at 23 11 46 Screenshot 2025-01-20 at 23 10 13 Screenshot 2025-01-20 at 23 02 32
MacOS: Desktop Screenshot 2025-01-23 at 18 32 04 Screenshot 2025-01-23 at 18 32 26 Screenshot 2025-01-23 at 18 30 24

@cristipaval cristipaval self-assigned this Jan 15, 2025
@ZhenjaHorbach
Copy link
Contributor

I can help with this PR !

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Jan 24, 2025

A very specific bug when we reload a page with a domain in address bar

2025-01-24.23.43.43.mov

To fix this we need to update routes so that they don't end to a domain

App/src/ROUTES.ts

Lines 1485 to 1488 in 176266d

TRAVEL_TCS: {
route: 'travel/terms/:domain',
getRoute: (domain: string, backTo?: string) => getUrlWithBackToParam(`travel/terms/${domain}`, backTo),
},

Update to

    TRAVEL_TCS: {
        route: 'travel/terms/:domain/select',
        getRoute: (domain: string, backTo?: string) => getUrlWithBackToParam(`travel/terms/${domain}/select`, backTo),
    },

App/src/ROUTES.ts

Lines 1500 to 1503 in 176266d

TRAVEL_DOMAIN_PERMISSION_INFO: {
route: 'travel/domain-permission-info/:domain',
getRoute: (domain?: string, backTo?: string) => getUrlWithBackToParam(`travel/domain-permission-info/${domain}`, backTo),
},

Update to

    TRAVEL_DOMAIN_PERMISSION_INFO: {
        route: 'travel/domain-permission-info/:domain/info',
        getRoute: (domain?: string, backTo?: string) => getUrlWithBackToParam(`travel/domain-permission-info/${encodeURIComponent(domain ?? '')}/info`, backTo),
    },

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Jan 24, 2025

I'm not sure if this is a bug, but I think that when we click "Got it," RHP should close, and we shouldn't return to the previous screen

2025-01-24.23.44.48.mov

Also we have issues related with bottom padding on ios

For example on choose a domain screen and on other random screens we have correct bottom padding
ios-5

Снимок экрана 2025-01-26 в 11 01 03 Снимок экрана 2025-01-26 в 11 01 19 Снимок экрана 2025-01-26 в 11 02 23

But on other travel screens we don't have padding

ios ios-2 ios-3

Actually for android this issue is more critical

Снимок экрана 2025-01-26 в 12 42 36

To fix paddings we need remove some lines related to includeSafeAreaPaddingBottom

includeSafeAreaPaddingBottom={false}

includeSafeAreaPaddingBottom={false}

includeSafeAreaPaddingBottom={false}

includeSafeAreaPaddingBottom={false}

@dannymcclain
Copy link
Contributor

I'm not sure if this is a bug, but I think that when we click "Got it," RHP should close, and we shouldn't return to the previous screen

Yeah I agree. As far as I understand, the user won't really be able to do anything here—so we should just close the entire RHP.

@cristipaval
Copy link
Contributor Author

Thanks @ZhenjaHorbach and @dannymcclain! Really valuable feedback. The PR is ready again for review

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Jan 27, 2025

@cristipaval
Everything works good!
The only thing I noticed
That we need to additionally update styles on TravelTerms screen and remove SafeAreaConsumer that are no longer needed

Since we have small discrepancy

2025-01-27.18.55.14.mov

<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.ph5, safeAreaPaddingBottomStyle.paddingBottom ? safeAreaPaddingBottomStyle : styles.pb5]}>

Update to

<ScrollView contentContainerStyle={[styles.flexGrow1, styles.ph5, styles.pb5]}>

@ZhenjaHorbach
Copy link
Contributor

LGTM !

@melvin-bot melvin-bot bot requested a review from nkuoch January 27, 2025 20:13
Copy link

melvin-bot bot commented Jan 27, 2025

@nkuoch Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@cristipaval cristipaval requested a review from tgolen January 27, 2025 20:15
@tgolen tgolen merged commit e0da849 into main Jan 27, 2025
17 checks passed
@tgolen tgolen deleted the cristi_domainSelection-when-provisionTravel branch January 27, 2025 21:19
@cristipaval
Copy link
Contributor Author

Thank you all for reviewing ❤️

@nkuoch, we merged this one because the deadline for travel is the end of this week, and we want this one in production by then 🤞

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.90-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

@kavimuru
Copy link

kavimuru commented Jan 28, 2025

@cristipaval we see this when log in to gmail account Workspace with admins having public domain emails

image

@kavimuru
Copy link

We don't see the "book a travel" option both in different domain and unvalidated private domain

private.unclaimed.mp4
dif.private.domain.mp4

Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.90-6 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 success ✅

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.

7 participants