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

fix(action): fixing RTL display bugs by replacing getElementDir and RTL CSS classes with CSS logical properties #3140

Merged
merged 25 commits into from
Oct 15, 2021

Conversation

eriklharper
Copy link
Contributor

@eriklharper eriklharper commented Sep 29, 2021

Related Issue: #2019

Summary

This PR replaces getElementDir and RTL CSS classes with CSS Logical Properties in calcite-action, which allows Screener to effectively capture the RTL states of this component since a re-render is no longer required when programmatically changing the HTML page direction. This adds 45 new Screener snapshots that capture a full set of visual states using the Screener Steps API and new utilities.

How this works

This PR uses screener-storybook to test for visual changes to storybook stories and introduces the use of the screener storybook Steps to test for interaction changes within calcite-action.

The Steps API allows you to interact or call methods before taking a snapshot of the story.

This will allow us to replace all the RTL and Dark theme stories by calling a method to change to RTL or Dark theme in the same story and take a snapshot.

For example, instead of setting a knob to open a component, we can click the component's button to open it.

This PR:

Uses screener-storybook steps: https://screener.io/v2/docs/test-interactions within storybook to take screenshots after interactions as well as changes for dark theme and RTL.

  • Replaces dark and RTL stories for the Popover and Tooltip with Screener steps
  • Introduces a storybook helper to setup tests for a story
  • Exposes a couple strings of JS scripts for toggling theme and setting knobs on a screener run

The plan

  • Do this for all other storybook stories.
  • Replace all "Dark" theme and "RTL" stories with screener steps
  • Remove any stories where content doesn't change
  • Use screener interactions (click/hover) where applicable instead of separate stories or setting knob values.

Proposed plan for testing

  • In order to test the changes, you have to look at the screener build.
  • You should see new screenshots with the name of the snapshots that are provided in the steps code.

Resources

Screener-runner executeScript types: https://github.com/screener-io/screener-runner/blob/ad615d12691c52ac13d069df960f204725486cfd/src/steps.js

Acceptance Criteria

  • Setup a comprehensive set of snapshots for calcite-action
  • Create an isolated Screener test of calcite-action before the Screener steps are added
  • Create an isolated Screener test of calcite-action with all possible prop permutations. UPDATE: this won't be possible because of a call stack size exceeded exception once the number of chained methods reaches a certain point.
  • Compare the two Screener runs above to see how much the time differs.

BEFORE: (15 seconds)

image

AFTER: (using 45 new snapshots for calcite-action + the rest of the existing storybook snapshots)

image

@github-actions github-actions bot added this to the Sprint 9/27 – 10/8 milestone Sep 29, 2021
@github-actions github-actions bot added the testing Issues related to automated or manual testing. label Sep 29, 2021
@eriklharper eriklharper marked this pull request as ready for review October 14, 2021 21:55
@eriklharper eriklharper requested a review from a team as a code owner October 14, 2021 21:55
@eriklharper eriklharper requested a review from jcfranco October 14, 2021 21:55
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

The code changes look good @eriklharper.

I wonder if we should change the PR to be a type of refactor instead of test?

Ideally, it could maybe be 3 different PRs

  • refactor(action): Use css logical properties.
  • test(action): Use screener steps.
  • fix(action): Appearance should only be clear or solid.

Does that sound right?

Otherwise, those changes are lost if it just uses "test".

@eriklharper
Copy link
Contributor Author

The code changes look good @eriklharper.

I wonder if we should change the PR to be a type of refactor instead of test?

Ideally, it could maybe be 3 different PRs

  • refactor(action): Use css logical properties.
  • test(action): Use screener steps.
  • fix(action): Appearance should only be clear or solid.

Does that sound right?

Otherwise, those changes are lost if it just uses "test".

How about to keep things simple, I rename the PR title to fix(action): deprecate rtl classes and remove unsupported outline appearance that way the important part is communicated in the release notes. Is there any use for test() commit labels to anyone else outside of Core?

@driskull
Copy link
Member

How about to keep things simple, I rename the PR title to fix(action): deprecate rtl classes and remove unsupported outline appearance that way the important part is communicated in the release notes. Is there any use for test() commit labels to anyone else outside of Core?

Sounds reasonable to me. 👍 Unless anyone else has any objections.

@eriklharper eriklharper changed the title test(action): refactor story to use Screener steps fix(action): deprecate rtl css classes and removing unsupported outline appearance Oct 14, 2021
@eriklharper eriklharper changed the title fix(action): deprecate rtl css classes and removing unsupported outline appearance fix(action): replace getElementDir and RTL CSS classes with CSS logical properties and removing unsupported "outline" appearance Oct 14, 2021
@jcfranco
Copy link
Member

jcfranco commented Oct 14, 2021

Unless the outline appearance changes are related to the RTL class removal, which I believe they are not, they should be split into separate PRs.

@eriklharper
Copy link
Contributor Author

Unless the outline appearance changes are related to the RTL class removal, which I believe they are not, they should be split into separate PRs.

The outline appearance changes are actually related to the Screener steps usage, since the snapshot for appearance="outline" is invalid because it doesn't produce the intended result for what constitutes an outline around the button like it does in other components.

@eriklharper eriklharper changed the title fix(action): replace getElementDir and RTL CSS classes with CSS logical properties and removing unsupported "outline" appearance fix(action): replace getElementDir and RTL CSS classes with CSS logical properties Oct 15, 2021
…of github.com:Esri/calcite-components into eriklharper/2019-action-screener-steps
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

LGTM! I just had a couple of questions:

  1. Based on an earlier discussion, we decided that the steps API would be considered for advanced testing scenarios. Does that affect the current state of calcite-action's stories, i.e., should some step scenarios be covered by individual stories?
  2. Can you revisit the PR title to express what an end-user gets as a fix?

@eriklharper eriklharper changed the title fix(action): replace getElementDir and RTL CSS classes with CSS logical properties fix(action): fixing RTL display bugs by replacing getElementDir and RTL CSS classes with CSS logical properties Oct 15, 2021
@eriklharper eriklharper merged commit 6a1c904 into master Oct 15, 2021
@eriklharper eriklharper deleted the eriklharper/2019-action-screener-steps branch October 15, 2021 18:32
@eriklharper
Copy link
Contributor Author

eriklharper commented Oct 15, 2021

LGTM! I just had a couple of questions:

  1. Based on an earlier discussion, we decided that the steps API would be considered for advanced testing scenarios. Does that affect the current state of calcite-action's stories, i.e., should some step scenarios be covered by individual stories?

Probably not necessary since the steps API is so easy to use to produce the kinds of results we want. The only place where I see making more than 1 story necessary is if there's a hurdle with producing the desired visual result outside of what is possible with Storybook and/or the Steps API, or if there's a scenario where we want to visually capture a component when used in combination with another component (like parent-child relationships or inter-dependent visual tests) in addition to snapshotting the component in total isolation.

  1. Can you revisit the PR title to express what an end-user gets as a fix?

Done. Reworded it to say it fixes RTL display bugs, which is more relevant to the end user.

driskull pushed a commit that referenced this pull request Oct 18, 2021
driskull added a commit that referenced this pull request Oct 18, 2021
…ng (#3222)

* fix(link): Setting the href property after init should update rendering. #2153

* connectedCallback back

* build(deps): bump @storybook/addon-docs from 6.3.10 to 6.3.11 (#3221)

Bumps [@storybook/addon-docs](https://github.com/storybookjs/storybook/tree/HEAD/addons/docs) from 6.3.10 to 6.3.11.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.11/addons/docs)

---
updated-dependencies:
- dependency-name: "@storybook/addon-docs"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump eslint-plugin-unicorn from 37.0.0 to 37.0.1 (#3220)

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 37.0.0 to 37.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](sindresorhus/eslint-plugin-unicorn@v37.0.0...v37.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @stencil/sass from 1.4.1 to 1.5.2 (#3219)

Bumps [@stencil/sass](https://github.com/ionic-team/stencil-sass) from 1.4.1 to 1.5.2.
- [Release notes](https://github.com/ionic-team/stencil-sass/releases)
- [Commits](stenciljs/sass@v1.4.1...v1.5.2)

---
updated-dependencies:
- dependency-name: "@stencil/sass"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @storybook/cli from 6.3.10 to 6.3.11 (#3217)

Bumps [@storybook/cli](https://github.com/storybookjs/storybook/tree/HEAD/lib/cli) from 6.3.10 to 6.3.11.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.11/lib/cli)

---
updated-dependencies:
- dependency-name: "@storybook/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: add license preamble for distributable code (#2537)

#947

* build(deps): bump @storybook/addon-a11y from 6.3.10 to 6.3.11 (#3218)

Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/addons/a11y) from 6.3.10 to 6.3.11.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.11/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Driscoll <[email protected]>

* feat(block): add loading status to block header (#3158)

* feat(block): add loading status to block header

* add e2e to verify loading class

* feedback changes

* re-trigger codeQL job

* feedback syntax changes

* 1.0.0-next.287 [skip ci]

* fix(combox-item): adjust height of the item to be consistent respective to its scale size (#3144) (#3197)

* fix(combox-item): adjust height of the item to be consistent respective to its scale size (#3144)

* fix(combobox-item): keep the container styling relative to the scale size

* fix(combobox-item): review pr comment suggestion for styling

* refactor(filter): avoid stateful regexp used for filtering

* 1.0.0-next.288 [skip ci]

* build(deps): bump storybook from 6.3.10 to 6.3.11 (#3233)

Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/lib/cli) from 6.3.10 to 6.3.11.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.11/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @storybook/html from 6.3.10 to 6.3.11 (#3232)

Bumps [@storybook/html](https://github.com/storybookjs/storybook/tree/HEAD/app/html) from 6.3.10 to 6.3.11.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.11/app/html)

---
updated-dependencies:
- dependency-name: "@storybook/html"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(dropdown): close on outside click when disable-close-on-select is true #3136 (#3227)

* fix(dropdown): remove preventDefault and stopPropagation on click event (#3231)

* fix(dropdown): close on outside click when disable-close-on-select is true #3136

* fix(dropdown): remove preventDefault on click event. #1709

* 1.0.0-next.289 [skip ci]

* fix(combobox): add chevron icon at end of input regardless of selecti… (#3143)

* fix(combobox): add chevron icon at end of input regardless of selection mode (#3055)

* fix(combobox): align the chevron icon to be centered vertically on multiple chips select mode (#3055)

* fix(action-bar): get up-to-date master changes

* feat(combobox): add additional story for multiple with preselected inputs

* fix(combobox): make all the combobox height size consistent scale

* 1.0.0-next.290 [skip ci]

* docs(input-time-picker): value is always 24-hour format (#3245)

* build(deps): bump @storybook/cli from 6.3.11 to 6.3.12 (#3251)

Bumps [@storybook/cli](https://github.com/storybookjs/storybook/tree/HEAD/lib/cli) from 6.3.11 to 6.3.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.12/lib/cli)

---
updated-dependencies:
- dependency-name: "@storybook/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump eslint from 8.0.0 to 8.0.1 (#3252)

Bumps [eslint](https://github.com/eslint/eslint) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](eslint/eslint@v8.0.0...v8.0.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @storybook/addon-docs from 6.3.11 to 6.3.12 (#3254)

Bumps [@storybook/addon-docs](https://github.com/storybookjs/storybook/tree/HEAD/addons/docs) from 6.3.11 to 6.3.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.12/addons/docs)

---
updated-dependencies:
- dependency-name: "@storybook/addon-docs"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test(input): Skip unstable test. #3257 (#3258)

* build(deps): bump eslint-plugin-jest from 25.0.5 to 25.2.0 (#3256)

Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 25.0.5 to 25.2.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](jest-community/eslint-plugin-jest@v25.0.5...v25.2.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @storybook/html from 6.3.11 to 6.3.12 (#3255)

Bumps [@storybook/html](https://github.com/storybookjs/storybook/tree/HEAD/app/html) from 6.3.11 to 6.3.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.12/app/html)

---
updated-dependencies:
- dependency-name: "@storybook/html"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump storybook from 6.3.11 to 6.3.12 (#3253)

Bumps [storybook](https://github.com/storybookjs/storybook/tree/HEAD/lib/cli) from 6.3.11 to 6.3.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.12/lib/cli)

---
updated-dependencies:
- dependency-name: storybook
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump ts-jest from 27.0.5 to 27.0.6 (#3259)

Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 27.0.5 to 27.0.6.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](kulshekhar/ts-jest@v27.0.5...v27.0.6)

---
updated-dependencies:
- dependency-name: ts-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @storybook/addon-a11y from 6.3.11 to 6.3.12 (#3260)

Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/addons/a11y) from 6.3.11 to 6.3.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.3.12/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: update component READMEs (#3264)

Co-authored-by: jcfranco <[email protected]>

* fix(action)!: deprecating outline appearance (#3263)

* docs(conventions): fixing grammar errors (#3261)

* fix(action): fixing RTL display bugs by replacing getElementDir and RTL CSS classes with CSS logical properties (#3140)

* refactor: Convert SASS division to multiplication where possible. #3249 (#3268)

* refactor: Convert SASS division to multiplication where possible. #3249

* use calc

* fix negate

* feat(list, list-item): Add setFocus method. #3275

* fix selector

* fix test

* refactor: change onLabelClick to be a class method (#3165)

#3161

* chore(hooks): add pre-push hook to confirm admin-pushes from master (#3273)

* feat(output-targets): add custom-elements output target (#3224)

* chore(action): allow ember-twiddle repro samples (#3244)

* fix(block-section): enable word wrap (#3156)

* fix(block-section): enable text wrap

* revert changes to demo html

* refactor to support safari browser

* readability

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JC Franco <[email protected]>
Co-authored-by: Anveshreddy mekala <[email protected]>
Co-authored-by: Travis CI User <[email protected]>
Co-authored-by: Yona N <[email protected]>
Co-authored-by: Ben Elan <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jcfranco <[email protected]>
Co-authored-by: Erik Harper <[email protected]>
@eriklharper eriklharper added the 3 - installed Issues that have been merged to master branch and are ready for final confirmation. label Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - installed Issues that have been merged to master branch and are ready for final confirmation. testing Issues related to automated or manual testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants