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

test: E2E playwright tests for web app #89

Merged
merged 20 commits into from
Oct 26, 2023
Merged

test: E2E playwright tests for web app #89

merged 20 commits into from
Oct 26, 2023

Conversation

shibbas
Copy link
Contributor

@shibbas shibbas commented Oct 25, 2023

Purpose

Introduces E2E Playwright tests that can be run on either the local dev server or the deployed web app by changing the baseUrl in the playwright.config.

Includes the following tests
image

The tests run against the local server via github action on each pull request
Playwright tests

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code
    npx playwright test Or run the tests in the Test Explorer

Copy link
Contributor

@sinedied sinedied left a comment

Choose a reason for hiding this comment

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

Thanks for this addition!

I have a few questions regarding the approach:

  • why in some case you use a class locator, and sometimes you add a specific ID locator? is that because the class couldn't be used in that case, or maybe because of the shadow DOM?

  • I like the idea of screenshots as part of the test, but I don't think these should be stored as part of the repo as PNG are huge and will quickly make the repo size problematic.
    Maybe we could we keep the screenshots out of the repo for now and store them as a build artifact of the GH workflow?

.github/workflows/playwright.yml Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
.github/workflows/playwright.yml Outdated Show resolved Hide resolved
.github/workflows/playwright.yml Outdated Show resolved Hide resolved
@sinedied
Copy link
Contributor

Also for next time, could you use the conventional commits convention for your commits? see https://www.conventionalcommits.org/
We need to update the contributing guidelines to add this.

Don't bother to fix the one in this PR, we'll squash it to fix the issue.

@shibbas
Copy link
Contributor Author

shibbas commented Oct 25, 2023

Thanks for this addition!

I have a few questions regarding the approach:

  • why in some case you use a class locator, and sometimes you add a specific ID locator? is that because the class couldn't be used in that case, or maybe because of the shadow DOM?

Yes, in some cases the classes had dynamic identifiers or were used for styling multiple buttons. In those cases I explicitly added test IDs. Now i have updated the code so that explicit elements that require action in the UX have test IDs and use those instead of classes there.

  • I like the idea of screenshots as part of the test, but I don't think these should be stored as part of the repo as PNG are huge and will quickly make the repo size problematic.
    Maybe we could we keep the screenshots out of the repo for now and store them as a build artifact of the GH workflow?

The purpose of the screenshots is to test against the layout at a particular point in time - I.e. does the current change layout break anything from the known good version. If we build those artifacts we lose the point in time comparison. I understand on the size issue though. I've removed the screenshots as I have a few equivalent though less accurate assertions in the tests.

@shibbas shibbas changed the title E2E playwright tests for web app test: E2E playwright tests for web app Oct 25, 2023
@sinedied sinedied merged commit 5dad274 into main Oct 26, 2023
6 checks passed
@sinedied sinedied deleted the feature/playwright branch October 26, 2023 16:19
anfibiacreativa pushed a commit that referenced this pull request Oct 30, 2023
* added initial test support for the playwright tests

* add snapshot and thought process test along with default network response

* playwright config update

* ux update

* test screenshot updates

* update tests

* no stream har files

* embed the body in the har files

* stream har file updated

* update the screenshot for response formatting

* add screenshots for firefox and webkit tests

* fix the testid attribute

* remove playwright workflow for now

* add the github action for running local tests and fix a broken test

* only upload artifacts on failure

* ensure playwright browsers are installed in devcontainer

* move the tests to a e2e

* update types

* keep playwright tests separate

* cleanup tests
anfibiacreativa added a commit that referenced this pull request Oct 31, 2023
* chore: update followup questions preliminary

* chore: update styles

* chore: restyle followup questions

* chore: fix parser for follow up questions (before TC)

* chore: fix bug and adapt styles

* chore: add margin to citations

* chore: remove commented regex

* fix: remove unnecessary regex and replace

* chore: update global config

* chore: add question icon

* chore: update styles

* chore: update comments to reflect decisions

* chore: refine cosmetic styles

* chore: replace icons with iconcloud set

* fix: fix minor bug with index replacement

* test: add E2E playwright tests for web app (#89)

* added initial test support for the playwright tests

* add snapshot and thought process test along with default network response

* playwright config update

* ux update

* test screenshot updates

* update tests

* no stream har files

* embed the body in the har files

* stream har file updated

* update the screenshot for response formatting

* add screenshots for firefox and webkit tests

* fix the testid attribute

* remove playwright workflow for now

* add the github action for running local tests and fix a broken test

* only upload artifacts on failure

* ensure playwright browsers are installed in devcontainer

* move the tests to a e2e

* update types

* keep playwright tests separate

* cleanup tests

* docs: update readme with auth info

* test: add load tests  (#93)

* setup env for k6

* test: load tests to package.json

* test: add tests

* test: add load test

* test: granualize metrics

* test: have a standard workload

* test: load 50 users 1 request/sec/user

* test: log the response failures

* test: randomize the iteration interval

* test: adjust the load scenario

* test: doc update

* test: move globals to shared esconfig

* test: add playwright test for ask interaction (#94)

* ci: disable playwright for demo

* ci: revert previous commit and disable from UI

---------

Co-authored-by: shibbas <[email protected]>
anfibiacreativa added a commit that referenced this pull request Oct 31, 2023
* chore: update followup questions preliminary

* chore: update styles

* chore: restyle followup questions

* chore: fix parser for follow up questions (before TC)

* chore: fix bug and adapt styles

* chore: add margin to citations

* chore: remove commented regex

* fix: remove unnecessary regex and replace

* chore: update global config

* chore: add question icon

* chore: update styles

* chore: update comments to reflect decisions

* chore: refine cosmetic styles

* chore: replace icons with iconcloud set

* fix: fix minor bug with index replacement

* test: add E2E playwright tests for web app (#89)

* added initial test support for the playwright tests

* add snapshot and thought process test along with default network response

* playwright config update

* ux update

* test screenshot updates

* update tests

* no stream har files

* embed the body in the har files

* stream har file updated

* update the screenshot for response formatting

* add screenshots for firefox and webkit tests

* fix the testid attribute

* remove playwright workflow for now

* add the github action for running local tests and fix a broken test

* only upload artifacts on failure

* ensure playwright browsers are installed in devcontainer

* move the tests to a e2e

* update types

* keep playwright tests separate

* cleanup tests

* docs: update readme with auth info

* test: add load tests  (#93)

* setup env for k6

* test: load tests to package.json

* test: add tests

* test: add load test

* test: granualize metrics

* test: have a standard workload

* test: load 50 users 1 request/sec/user

* test: log the response failures

* test: randomize the iteration interval

* test: adjust the load scenario

* test: doc update

* test: move globals to shared esconfig

* test: add playwright test for ask interaction (#94)

* ci: disable playwright for demo

* ci: revert previous commit and disable from UI

---------

Co-authored-by: shibbas <[email protected]>
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.

2 participants