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

feat: e2e combined improvements #1998

Merged
merged 48 commits into from
May 22, 2024
Merged

feat: e2e combined improvements #1998

merged 48 commits into from
May 22, 2024

Conversation

dsmmcken
Copy link
Contributor

@dsmmcken dsmmcken commented May 9, 2024

Contains several changes that all touch many snapshots. Combined to reduce snapshot churn.

The primary goal was to address webkit kerning issues caused by: microsoft/playwright#20203

Recommend to review using . vscode mode and initially collapsing all snapshot folders.

  1. Moves e2e test to execute inside docker container so enviroment is consitent between ci and local

    • changes e2e.yml to build a docker container, then uses that for each matrix test
    • dockerfile remove deja vu stuff, environment is now the same and grid.tsx
    • dockercompose adds service that runs the image from CI with matrix config via env variables
    • Fixes dockerfile and compose to actually use the node version installed by nvm (existing code didn't actually use the version installed by nvm, only the commands inside the -i interactive session would)
      • Get rid of interactive mode and make source work
      • Sym link nvm node binaries to clobber the version installed by playwright jammy container
    • Churns snapshots
  2. Removes deprecated ButtonOld

    • removed button old component
    • changes to style guide to no longer display that component
    • removed usage in chart filter overlay
    • renames snapshots to by id instead of index for buttons
    • Churns snapshots
  3. Disable kerning and smoothing in webkit playwright tests:

    • theory is webkit kerning may be non-deterministic, disabling entirely may avoid those diffs
    • adds Playwright.css dynamically imported based of a env VITE_PLAYWRIGHT variable to AppRoot
    • initially tried using built in https://playwright.dev/docs/test-snapshots#stylepath however, results were inconsistent as canvas grids may or may not re-render after playwright appended the styles
    • Updated playwright version to 1.44
    • Churns snapshots
  4. Optimize ThemeColors section in style guide

    • Makes styleguide section load faster
    • Remove all the ContrastColor() which have poor performance and were being done of every swatch. Instead text next to swatch
    • Move slow NormailzeColors() call in tooltip into props so it doesn't run unless tooltip is shown
    • Churns snapshots
  5. Run golden-layout tests in parallel

    • I don't see a reason why these need to be serial, so might be slightly faster in parallel

BREAKING CHANGE: Removed ButtonOld component, use Button instead.

BREAKING CHANGE: Removed ButtonOld Component, use Button instead
@dsmmcken dsmmcken self-assigned this May 9, 2024
@dsmmcken dsmmcken requested a review from bmingles May 9, 2024 18:00
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 46.36%. Comparing base (6cf1240) to head (a733478).
Report is 2 commits behind head on main.

Files Patch % Lines
...ackages/code-studio/src/styleguide/ThemeColors.tsx 0.00% 3 Missing ⚠️
packages/code-studio/src/AppRoot.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1998      +/-   ##
==========================================
- Coverage   46.39%   46.36%   -0.03%     
==========================================
  Files         673      672       -1     
  Lines       38770    38764       -6     
  Branches     9818     9819       +1     
==========================================
- Hits        17988    17974      -14     
- Misses      20729    20737       +8     
  Partials       53       53              
Flag Coverage Δ
unit 46.36% <28.57%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dsmmcken dsmmcken changed the title feat: removed deprecated ButtonOld component removed deprecated ButtonOld component May 13, 2024
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Just marking as needing change so that this doesn't merge until we cut a release/branch for V+.

.github/workflows/e2e.yml Outdated Show resolved Hide resolved
.github/workflows/e2e.yml Outdated Show resolved Hide resolved
.github/workflows/e2e.yml Show resolved Hide resolved
packages/code-studio/src/AppRoot.tsx Outdated Show resolved Hide resolved
tests/docker-scripts/Dockerfile Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattrunyon mattrunyon left a comment

Choose a reason for hiding this comment

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

I only reviewed the CI and docker files

bmingles
bmingles previously approved these changes May 17, 2024
Copy link
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

LGTM

mofojed
mofojed previously approved these changes May 17, 2024
Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

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

Good to merge, added a comment to remove the VITE_PLAYWRIGHT_CSS junk

Comment on lines +9 to +13
// load addional css for playwright docker tests
if (import.meta.env.VITE_PLAYWRIGHT_CSS === '1') {
await import('./Playwright.css');
}

Copy link
Member

Choose a reason for hiding this comment

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

We should follow up to see if we can fix this in Playwright with some sort of global hook to inject CSS to a page as it loads
Maybe we can use https://playwright.dev/docs/api/class-page#page-add-style-tag

Copy link
Contributor

@bmingles bmingles May 20, 2024

Choose a reason for hiding this comment

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

I believe this gets statically replaced and then stripped out at build time if the condition resolves to false, so may not be an issue to leave this here. I did some experimenting, and the code does only seem to be present in the output when VITE_PLAYWRIGHT_CSS=1. It does still appear in the source maps, but this is presumably part of mapping to the original source.

@dsmmcken dsmmcken dismissed stale reviews from mofojed and bmingles via 837112e May 17, 2024 21:54
@bmingles
Copy link
Contributor

@dsmmcken tests pass locally for me now

depends_on:
dhc-server:
condition: service_healthy

web-ui-update-snapshots:
extends:
service: web-ui-tests
entrypoint: 'npm run e2e:update-snapshots -- --config=playwright-ci.config.ts'
entrypoint: '/bin/bash --login -i -c "npm run e2e:update-snapshots -- --config=playwright-ci.config.ts"'
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we can no longer pass in additional args to constrain this command e.g. before I could

npm run e2e:update-ci-snapshots styleguide

or

npm run e2e:update-ci-snapshots -- -g "some test name"

Not sure if this is the culprit, but it doesn't seem to be working anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the culprit. The params just get passed to the entrypoint, so now it's passing those params at the end of the bash command instead of in the npm command.

Might be fixed by adding $@ to the end of the npm command in the quotes

Copy link
Contributor

Choose a reason for hiding this comment

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

I've tried this a few different ways but can't get the $@ args to get included

@@ -19,28 +26,20 @@ RUN fc-list : family;
COPY .nvmrc .

# Set the default shell so the correct node/npm is used after install
# https://stackoverflow.com/a/60137919
# Based on https://stackoverflow.com/a/60137919
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I found away to avoid the interactive shell here:

SHELL ["/bin/bash", "--login", "-c"]
# Nvm appends its config to `.bashrc` if it exists, but the default `.bashrc` 
# bails if not in an interactive shell, which causes `nvm` to never actually get
# configured. To avoid having to use `-i` interactive shell, we overwrite the
# `.bashrc` file with a version that doesn't bail.
# https://github.com/nvm-sh/nvm/issues/1985#issuecomment-813189002
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN echo 'export NVM_DIR="$HOME/.nvm"' > /root/.bashrc
RUN echo 'source "$NVM_DIR/nvm.sh" --install' >> /root/.bashrc
RUN source /root/.bashrc
RUN nvm install

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this would be simpler:

SHELL ["/bin/bash", "--login", "-c"]
# The default `.bashrc` bails on the first line if not in interactive shell. 
# We can just empty it so that the nvm install below will actually run when sourcing 
# `.bashrc`
RUN echo "" > /root/.bashrc
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
RUN source /root/.bashrc && nvm install

@dsmmcken dsmmcken requested review from mofojed and bmingles May 21, 2024 21:17
# Now clobber the default node installed by the playwright
# image so that the commands in docker compose entrypoint will
# also use the correct version of node without running in bash
RUN ln -s $(which node) /usr/local/bin/nodejs
Copy link
Contributor

Choose a reason for hiding this comment

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

Kudos. This simplifies things.

Copy link
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

Tests are passing in CI and locally except for a timeout when I ran everything. Re-running the test in isolation passed, so I think we are good to go.

@dsmmcken dsmmcken merged commit 99fc2f6 into main May 22, 2024
10 checks passed
@dsmmcken dsmmcken deleted the dmckenzie_purge_button_old branch May 22, 2024 17:11
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants