Skip to content

Conversation

@OS-pedrolourenco
Copy link
Contributor

Issue number: internal


What is the current behavior?

Tab button does not have a shape property.

What is the new behavior?

  • Adds support for the shape property in tab button.
  • Adds styles for the "soft", "round" and "rectangular" shapes in the ionic theme
  • Defaults the shape to "round" for the ionic theme
  • Adds an e2e test for shape with screenshots of all shapes

Does this introduce a breaking change?

  • Yes
  • No

Other information

@OS-pedrolourenco OS-pedrolourenco requested a review from a team as a code owner December 2, 2024 18:25
@vercel
Copy link

vercel bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2024 4:04pm

import { configs, test } from '@utils/test/playwright';
import type { E2EPage, E2EPageOptions, ScreenshotFn } from '@utils/test/playwright';

class TabButtonFixture {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was a fixture created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file was created based on toast/test/shape/toast.e2e.ts which also has a fixture and it made sense for me to have one here in order to access the same page and elements on every test.

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

Please make sure that tests are passing before requesting reviews.

/**
* This behavior does not vary across directions.
*/
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ config, screenshot, title }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

All the screenshots are wrong. They do not match the HTML test page. Please fix.

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 have since fixed those screenshots. However, the basic tab-bar tests were also failing. On the one hand, it makes sense since the default button corners have changed. On the other hand, I do not understand how the border color could have changed:
image
Perhaps it's related to design tokens?

Copy link
Contributor Author

@OS-pedrolourenco OS-pedrolourenco Dec 4, 2024

Choose a reason for hiding this comment

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

I also just noticed that the snapshots for the "darwin" OS for the tab-button are wrong but somehow the tests pass locally and on the PR checks 😕

Copy link
Contributor

Choose a reason for hiding this comment

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

darwin snapshots are from tests that were run on your local computer. Those snapshots may vary based on the computer, for example snapshots on a Windows device will most likely not be the same as a Mac device. So they're not considered the true source and are not allowed to be pushed to the repro.

In order to make sure snapshots are always being generated correctly to the same environment as the CI, we run the tests within Docker: npm run test.e2e.docker. You'll know that the snapshots are correct when they have the linux keyword within the file.

Make sure you are using that command to run the tests. You can also use npm run test.e2e.docker.update-snapshots to update the true snapshots locally.

In order to fix this PR, I suggest running:

  1. npm run test.e2e.docker tab-bar tab-button. This command will run all the tests that have the keywords tab-bar or tab-bar.
  2. Review the failing tests: npx playwright show-report
  3. It's extremely important that you understand why the tests are failing. They should only be failing for ionic theme and anything related to the tab button radius.
  4. If you feel confident, then update the snapshots: npm run test.e2e.docker.update-snapshots tab-button tab-bar. You might not need to update both components so adjust the command as needed.

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 see! That makes a more sense! Thanks for the context!
I noticed yesterday or the day before that I was running snapshot tests incorrectly and started using Docker like you mentioned. What I wasn't aware was that those "darwin" files were leftovers from running the tests incorrectly. I will remove them then.

By the way, did you get a chance to look at my first comment regarding the unexpected change in border color for the tab-button?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did, that's why I said to make sure you review the failing tests. I'm not seeing a change of color. The tests are failing for another reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I said before, the remaining tab-bar tests are failing due to the default border corners now being different. But, besides that, I also find it odd that the border color for the tab-button in the image I sent here has also changed to a different shade of blue. As such, I am raising a flag before updating the snapshots that might be incorrect.

Copy link
Contributor Author

@OS-pedrolourenco OS-pedrolourenco Dec 5, 2024

Choose a reason for hiding this comment

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

After looking into it a bit more I can indeed confirm that the color change was caused by the change in design tokens here. Thus, I conclude that, in general, snapshot tests do not check for color changes since these tests did not break with Bernardo's PR. I will then proceed with updating the snapshots.

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

Snapshots are still wrong. Tests are still failing.

Copy link
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM

@OS-pedrolourenco OS-pedrolourenco merged commit 861b4bf into next Dec 6, 2024
46 checks passed
@OS-pedrolourenco OS-pedrolourenco deleted the ROU-11374 branch December 6, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants