1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
Commit Graph

22 Commits

Author SHA1 Message Date
Tymoteusz Czech
de7b95a691
fix: e2e cypress create flag delay (#8968) 2024-12-12 13:43:01 +01:00
Tymoteusz Czech
828ecf8d63
fix: migrations e2e test (#8965)
Onboarding changed e2e test that should run before migration.
2024-12-12 11:19:03 +01:00
Nuno Góis
b4fde58fa0
chore: flag overview page redesign - environments (#8683)
https://linear.app/unleash/issue/2-2826/enabling-environment-via-feature-flag-environment-section-header

https://linear.app/unleash/issue/2-2825/feature-flag-list-bottom-left-to-be-a-nav-section

Follow-up to: https://github.com/Unleash/unleash/pull/8663

Implements most of the remaining work for our flag overview page
redesign.

Most of the code you see is a straight copy/paste from our older
existing components, with the slight improvement here and there.

Includes some improvements to our vertical tabs component to suit our
use case.
Also updates the Demo flow accordingly. I did some manual tests and it
seems to work decently in both scenarios, whether `flagOverviewRedesign`
is enabled or not. The demo needs some love but that's a story for a
different PR and a different time.

Once again, due to the duplicate file pattern, we should remember to
clean this up if we decide to remove the flag.

<img width="1086" alt="image"
src="https://github.com/user-attachments/assets/0c375e34-cbb5-4ac4-a764-39a36b6c6781">
2024-11-08 09:56:46 +00:00
Nuno Góis
eb01b44e69
test: skip vercel toolbar in e2e tests (#8273)
Some e2e Cypress tests were failing due to the Vercel live feedback
toolbar covering interactive elements, preventing test actions from
completing:
https://github.com/Unleash/unleash/actions/runs/11048512034/job/30692949711#step:4:136

This PR addresses the issue by disabling the Vercel toolbar specifically
during Cypress tests. This is done by setting the
`x-vercel-skip-toolbar` header, which Vercel provides to prevent the
toolbar from interfering with automated tests. You can find more
information about this feature in the Vercel documentation: [Disable
Toolbar for
Automation](https://vercel.com/docs/workflow-collaboration/vercel-toolbar/managing-toolbar#disable-toolbar-for-automation).

Specific type declarations were needed due to
https://github.com/cypress-io/cypress/issues/19564
2024-09-26 12:53:31 +01:00
Gastón Fournier
acecffd93f
fix: force languages in cypress browser for tests (#8049)
To fix this we had to create a free trial account on cypress and enable
the recording of the test. That way we found out the issue was with a
locale:
![image
(38)](https://github.com/user-attachments/assets/db2fad23-6fec-47c0-8c6f-a93f3e4e4c4c)

Probably, this works well locally because our local machines do have a
default locale, but probably we don't have one when running in CI, and
millify library is causing the tests to fail specifically at this line:
363911c4a1/frontend/src/component/common/AvatarGroup/AvatarGroup.tsx (L89)
(validated
[here](https://github.com/Unleash/unleash/pull/8040/files#diff-afc857890da2221bd34feed0ff45dd7745ff32fb0b27055214cbe69896d5311dL89)).

Unfortunately, upgrading millify didn't help, but downgrading to v5
(which doesn't support locales), solve the issue at the cost of not
having the up-to-date library:
https://github.com/Unleash/unleash/pull/8048

I believe the issue is related to this locale `c` reported here:
https://github.com/cypress-io/cypress/issues/7890#issuecomment-2105991364
because only after overriding the languages this worked
2024-09-03 10:06:58 +00:00
gitar-bot[bot]
977f969b80
[Gitar] Cleaning up stale flag: improveCreateFlagFlow with value true (#7895)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2024-08-15 15:53:36 +03:00
Thomas Heartman
eb7208025f
chore: create shared dialog form template (#7663)
This PR extracts the dialog form that we created for the new project
form into a shared component in the `common` folder.

Most of the code has been lifted and shifted, but there's been some
minor adjustments along the way. The main file is
`frontend/src/component/common/DialogFormTemplate/DialogFormTemplate.tsx`.
Everything else is just cleanup.
2024-07-25 13:41:09 +02:00
Thomas Heartman
215608c4b2
chore: make feature.spec and segements.spec more resilient (#7289)
This PR attempts to make the feature.spec and segements.spec test suites
more reliable. They have been flaking out a lot recently, and this will
hopefully make them less flaky.

The way of handling it is a little different for each test suite.

## feature.spec

Some of the failures we're seeing for the feature/feauture.spec test
suite are due to uncaught resize observer issues (possibly triggered by
the banners).

We can ignore these errors as they don't impact functionality, only
rendering, and are likely to resolve themselves quickly in real-world
scenarios.

On the other hand, it might also ignore actual errors, so I'm not a 100%
on this. Would love some input.

However, MDN has some info on [observation
errors](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors):

> As long as the error event does not fire indefinitely, resize observer
will settle and produce a stable, likely correct, layout. However,
visitors may see a flash of broken layout, as a sequence of changes
expected to happen in a single frame is instead happening over multiple
frames.

Based on that, I think this is a pretty safe error to ignore. 

I'm unsure whether catching this exception is only set in the `after`
cleanup or whether it pollutes the cy object for all tests, but I think
it's fine either way. But if you have ideas, I'd love to hear them.

## segments.spec

The issue here appears to be that when we first input the segment's name
in the form, it takes a little time for the UI to become ready, so the
first characters of the string are cut off.

This is a known [issue that the cypress team are
aware](https://github.com/cypress-io/cypress/issues/3817), but that
isn't likely to get fixed any time soon because no one can give them a
reproducible example.

You can see the effect of this on segments that haven't been cleaned up
in the preview:

![image](https://github.com/Unleash/unleash/assets/17786332/1db59906-a2ee-4149-869b-81f2245b4399)

To work around it, we add a 500ms wait before we start filling out the
form. Yes, adding [waits in your tests is an
antipattern](https://docs.cypress.io/guides/references/best-practices#Unnecessary-Waiting),
but it's the easiest way around in this case.

We *could* investigate and find a way not to need that, but that would
likely be a much larger project. This appears to mitigate the issue
immediately, so is at least a pretty good temporary fix in my opinion.
We also already do this in other tests, so there is a precedent for it.
2024-06-07 08:37:53 +02:00
Mateusz Kwasniewski
08e05141f3
chore: remove e2e tests for legacy env variants (#7071) 2024-05-17 10:55:22 +02:00
Gastón Fournier
9f3648dc81
chore: test migration backward compatibility (#5492)
## About the changes
This PR will validate that our current migrations are backward
compatible with the latest stable release of Unleash.
It will do so by starting a database, applying the latest migrations,
and then starting a docker container with the last stable unleash
release and running UI tests against it.

There's a risk that the current version of UI tests will not work with
the previous version of our UI. Because of that we copied the previous
version of cypress tests
(https://github.com/Unleash/unleash/tree/5.6/frontend/cypress) into oss
folder and removed the ones that are enterprise only. We can discuss a
better way of doing this to avoid having to maintain this folder always
in sync with the previous version of Unleash

This action will only run when there are changes in migrations or to
cypress tests.
2023-11-30 18:20:13 +01:00
Fredrik Strand Oseberg
c0369b739e
refactor: isolate tests (#5433)
This PR fixes a race condition between e2e tests where bulk archiving
all toggles in the default project would delete toggles used for the
features e2e tests.

It does by isolating the features.spec and overview.spec to their
respective projects, so that they always operate on isolated data.

### Future enhancements: 

I'm not particularly fond of passing the projectName through to all the
helper methods. It complicates the tests more than it should. I would
like to be able to set the project once per test and have all the helper
methods be aware of the context. Something like this should work:

```
before(() => {
   cy.wrap('projectId').as('project');
})
```

And in the helpers: 

```
export const createFeature_API = (
    featureName: string,
    options?: Partial<Cypress.RequestOptions>,
): Chainable<any> => {
    return cy.get('@project').then((project) => {
        projectName = project || 'default';
        return cy.request({
            url: `${baseUrl}/api/admin/projects/${projectName}/features`,
            method: 'POST',
            body: {
                name: `${featureName}`,
                description: 'hello-world',
                type: 'release',
                impressionData: false,
            },
            ...options,
        });
    });
};
```
2023-11-27 13:55:44 +01:00
Nuno Góis
4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00
andreas-unleash
5cbbd6f798
chore: remove strategyImprovements flag (#4043)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Remove strategy improvements flag 
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-1048](https://linear.app/unleash/issue/1-1048/remove-strategyimprovements-flag)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-06-28 11:38:21 +03:00
Nuno Góis
edefa6fc7e
test: add interactive demo guide e2e test (#3656)
This PR revamps e2e tests, while adding a new one for the interactive
demo guide:
 - Bumps Cypress from `9.7.0` to `12.11.0`;
 - Bumps Cypress GH action from `v2` to `v5`;
 - Makes any adjustments needed;
 - Fixes a lot of issues identified with existing tests;
- Adds new `demo.spec.ts` e2e test that covers the entire demo guide
flow;

**Note:** Currently does not include `demo.spec.ts` in the GH action, as
it
[fails](https://github.com/Unleash/unleash/actions/runs/4896839575/jobs/8744137231?pr=3656)
on step 2.13 (last step of "user-specific" topic). It runs perfectly
fine locally, though.

Might be placebo, but in general tests seem less flaky now and they may
even be faster (especially when not adding the `demo` one, which would
always take a long time).
2023-05-08 09:16:18 +01:00
Christopher Kolstad
d7b1d1c9ce
fix: Updated cypress API usage to stop using deprecated API (#3636) 2023-04-27 08:49:55 +00:00
andreas-unleash
99c555bf59
chore: refactor Cypress tests (#3445)
Adds proper typescript support.
Created reusable commands
Added README for cypress test
Refactored tests
Fixed bugs as I found them.
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-04 11:46:28 +03:00
andreas-unleash
068c55a925
Feat/notifications cypress (#3244)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-743](https://linear.app/unleash/issue/1-743/add-cypress-test-for-notifications-happy-path)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-08 12:47:42 +02:00
andreas-unleash
1eb0116e11
Fix/last viewed project (#2530)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

Fix using projectId on redirect.

Fix: only redirect to project(s) on app load


## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-28 16:10:40 +02:00
olav
b2a77a13f8 chore: update cypress (#1170) 2022-08-01 11:50:59 +02:00
Tymoteusz Czech
a11cb72d99 Persistent table query (#999)
* feat: persistent table query

* project overview sort query

* refactor: api methods as hook callbacks

* persitent columns in project overview

* enable new project overview

* fix: refactor feature state change in overview

* add type to sort

* update e2e tests

now takes 10% less time with use of cypress session

* prevent sort reset on features list

* fix feature toggle list loading

* fix: update column state saving

* update local storage hook test
2022-05-25 08:14:22 +00:00
olav
19b16ed600 refactor: fix flaky Cypress tests (#746)
* refactor: normalize spec names

* refactor: make ESLint ignore dir

* refactor: port specs to TS

* refactor: wait for login redirects to finish

* refactor: remove static wait timers

* refactor: match any env name in interceptors

* refactor: move config vars to the top

* refactor: use longer IDs to avoid collisions

* refactor: misc cleanup

* refactor: disable screenshots and videos

* refactor: disable prod guard in tests

* refactor: wait for inputs before typing
2022-02-25 10:21:28 +01:00
Fredrik Strand Oseberg
87414c1c9c feat: e2e tests and mobile views (#348)
* fix: add sidebar button

* fix: set absolute positioned sidebar button

* feat: test setup

* fix: add tests for adding strategy

* fix: add delete  strategy test

* feat: add workflow

* feat: add vercel token

* fix: update project id

* fix: increase sleep

* fix: sleep

* fix: vercel

* fix: typo

* fix: vercel preview url action

* fix: yml formatting

* fix: steps

* fix: format

* fix: runs on

* fix: team id

* fix: teamid

* fix: add workflow

* fix: remove unused import

* fix: add token

* fix: add configuration

* fix: set env variables

* fix: use with

* feat: main navigation routes

* feat: mobile views

* fix: change spec name

* fix: update cypress project id

* fix: add record key

* fix: button positioning

* feat: permissions

* fix: custom strategy

* fix: remove unused action yml

* fix: update yarn lock

* fix: keys

* fix: remove videos and screenshots

* fix: add cyrpess folders to gitignore

* fix: env variable
2021-09-30 11:44:30 +02:00