kawqa-gad-playwright's Issues
[GitHub Project] enable 1) branch auto-deletion 2) feature-branch merge auto-prevention
โ๏ธ Description
Enable 3 below settings in our GitHub Project:
(1) branch auto-deletion after branch is merged -> info and solution below:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches
- Go to Settings > General: section "Pull Requests"
- select
Automatically delete head branches
(2) prevention from merging feature-branch if there are:
(2.1) outstanding changes on main -> info and solution below:
- Go to Settings > General: section "Pull Requests"
- select
Always suggest updating pull request branches
(2.2) any unresolved conversations -> info and solution below:
- Go to Settings > Branches
- Check the field:
Require conversation resolution before merging
(3) prevention from merging directly to main w/out raising PR - info and solution below:
- https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-* branches/about-protected-branches#require-pull-request-reviews-before-merging
- https://eliteionic.com/tutorials/requiring-pull-requests-and-reviews-in-your-git-workflow/#enforcing-pull-requests
- Go to Settings > Branches
- Click Add rule on Branch protection rules
- Add
main
as the Branch name pattern - Require pull request reviews before merging
-Required approving reviews: 1
๐ง Why We Need This
To prevent issues/bugs :)
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[Test support] create a new user via faker lib
โ๏ธ Description
Create a new user via faker.js library, and get logged in as this new user
๐ง Why We Need This
Faker.js is a great help when it comes to generating test data
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[Tests support] add Given/When/Then to tests for better readability
โ๏ธ Description
Add Given/When/Then to tests for better readability.
๐ง Why We Need This
Given/When/Then - same as Arrange/Act/Assert pattern gives a test much better readability.
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
Create initial basic project structure
Current Challenge
Currently, there's no project structure, just: Playwright, Typescript installed.
Proposed Solution
The initial proposed project structure is as follows:
directory | description/responsibility |
---|---|
src/api | all API related code - helpers, actions etc |
src/e2e | all UI related code - PageObjects (components, pages), helpers, actions etc |
fixtures/api | API related fixtures |
fixtures/e2e | UI related fixtures |
tests/api | all API tests |
tests/e2e | all UI tests |
It can and most probably will be extended in the future
Fix broken POST tests for GAD Version: v2.5.3
โ๏ธ Description
After updating to version: v2.5.3 of GAD POST tests are broken
๐ Expected Behavior
Working tests
๐ Current Behavior
Two tests broken:
POST articles tests โบ Returns 401 Unauthorized after sending article JSON with missing userId
POST articles tests โบ Returns 201 Created after creating article
๐ Steps to Reproduce
๐ท Screenshots or Additional Information
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
Patch/articles - change of test 200 OK
โ๏ธ Description
We use the constant value of article id = 1 in the test. This leads to failing the test in some cases.
๐ Expected Behavior
We should not use the constant value of article id in the test.
The article must belong to the user who performs patch request on it.
๐ Current Behavior
Using constant value of article id leads to failing the test in some cases.
๐ Steps to Reproduce
๐ท Screenshots or Additional Information
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
[DOCS] Prepare decision log
Branch naming standards
Challenge
It'd be great if we would use the same branch naming convention throughout the project, like it's done in real-life scenarios.
Proposed Solution
Use husky
library and npm package validate-branch-name
to create pre-commit hook that would require changing branch name to the one that's following expected naming convention - reference:
-
my research output on naming convention: https://gist.github.com/bugITwhisperer/fd83cc503f671d6a32a56ec036592f10 && https://www.notion.so/kawqa-z-automatu/Branch-Commit-naming-convention-925310b1a04f469d917e88a9ead0b02f
-
how-to implement solution: https://www.git-tower.com/blog/git-hooks-husky/#1-validating-branch-names
Given user created feature-branch name `tests-new-test-added`
When user tries to commit their changes
Then there's an error msg displayed: `Branch name validation failed! Please rename your current feature-branch`
And changes won't go through
Add tech.debt.log.md (placeholder)
โ๏ธ Description
๐ง Why We Need This
๐ Proposed Solution
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[Test Architecture] add "test data" folder that would store variables
as per discussion here: #39 (comment)
HEAD /articles/{id} - tests
Tests for HEAD /articles/{id} endpoint
[Config][Bug?] Explore existing Husky hook with git ammend
This is a low priority, but I want to have it written down somewhere.
I was working on branch with correct name (tests/ISSUE-21_add_post_articles_test) and I wanted to edit message for one of the commits.
I was blocked by Husky validation even though the commit was previously accepted and I was on the same branch.
Scope of the issue:
- test git amend with our Husky config
- if bug confirmed, look for solution or at least create a new issue for it.
[CI/CD Pipeline] Use secrets to store sensitive information: BASE_URL, USER_EMAIL, USER_PASSWORD in workflow
โ๏ธ Description
Currently, the sensitive information such as app's URL and test user's credentials are directly visible in the workflow file instead of being protected. As discussed in our last meeting, it'd be best to use secrets to protect those.
๐ง Why We Need This
Using secrets in CI/CD pipeline is a good practice, because it:
- does not rely on data that's directly hardcoded lowering the risk of exposure,
- ensures tests are being executed securely,
- makes them available/accessible to the selected group of users only -> meaning us, members of the KawQA-z-automatu initiative! :)
๐ Proposed Solution
TBA
โ Issue reporting checklist
- [x ] I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
PATCH/comments -tests
Tests for PATCH / comments endpoint
[Documentation] README fix
update README.md file
replace somewhat confusing step:
copy application main URL as value of BASE_URL variable in .env file
with the below one:
copy ".env-template" file and change its name to .env
[GitHub Project] Configure adding labels to issue based on its type
โ๏ธ Description
Idea from one of our meetings: there are 3 types of issues and some of labels could be assigned automatically
https://docs.github.com/en/actions/managing-issues-and-pull-requests/adding-labels-to-issues
๐ง Why We Need This
To automate adding labels
๐ Proposed Solution
Explore on possibilities, discuss with the team and implement
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
Fix broken link in README
โ๏ธ Description
Link to contributing.md in README is currently broken
๐ง Why We Need This
Because README is our main page and we want it to be perfect ;)
๐ Proposed Correction or Addition
Add correct link
โ Documentation fix checklist
- I created a descriptive title for this documentation fix
- I checked that a similar documentation issue hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I assigned the documentation fix or added appropriate labels
Add "login-and-get-token" helper function
Add "login-and-get-token" helper function
PATCH /articles/{id}
Tests for PATCH /articles/{id} endpoint
POST / comments - tests
Tests for POST / comments endpoint
GET /articles/{id} - tests
Tests for GET /articles/{id} endpoint
[Test support] add enum with status codes that are currently in use
Challenge
We have identified a repetition in our code where variables are used to store the expected status codes for assertions.
Solution
Since we decided not to use any external library that would include the list of status codes, having an enum with a list of status code currently used will come in handy.
[Discussion/Group Decision] API checks prioritization
Challenge
Currently, we don't have any priorities as to which endpoints automate first - what is our overall testing strategy?
- API checks prioritization and strategy - to be discussed during KawQA-z-automatu meeting on
Monday, 30th of Oct 2023Monday, 27th of Nov ;)
Update Login/Patch/Get tests with correct version
โ๏ธ Description
After PR #37 we have some problems to resolve. Some files were returned to their versions from 11 Nov
๐ Expected Behavior
Updated version of files. Currently problems were observed for:
create-token.helper (fixed by PR #39 )
login test
patch test
get test
Other files changed by PR #37 should be analyzed
๐ Current Behavior
login test and patch test are expecting old version of helper and cannot be run
๐ Steps to Reproduce
Pull main branch and try to run tests mentioned above
๐ท Screenshots or Additional Information
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
[CONFIG] Update imports to use absolute paths instead of relative paths
Challenge
Currently, we use relative paths in our project. That means we have to use ..
to navigate to a given place, e.g.:
import { testUser } from "../../src/fixtures/api/auth";
Solution
We could switch to absolute paths in TypeScript! Instead of the above import, we would see:
import { testUser } from "@fixtures/api/auth";
Just a quick visual explanation of the difference between those two:
absolute path
= C:\_Training\_discordQAgroup\_github_gad_repos\kawqa-gad-playwright\tests\api\login.spec.ts
relative path
= tests\api\login.spec.ts
Why should we do it?
Well, with absolute paths we would:
- achieve better readability of our code, and
- managing imports (of libraries or helper functions, enums etc.) would be much easier to do
References:
- https://playwrightsolutions.com/the-definitive-guide-to-api-test-automation-with-playwright-part-7-creating-helper-functions-for-common-tasks/
- https://towardsthecloud.com/set-absolute-path-typescript
- https://medium.com/geekculture/making-life-easier-with-absolute-imports-react-in-javascript-and-typescript-bbdab8a8a3a1
- https://medium.com/nerd-for-tech/using-config-to-define-absolute-paths-in-cypress-a6a4f490f6a4
Fix POST article test after adding validation for date
โ๏ธ Description
In release 2.5.4 validation for date was added and one of tests is failing
https://github.com/jaktestowac/gad-gui-api-demo/releases/tag/v2.5.4
๐ Expected Behavior
๐ Current Behavior
๐ Steps to Reproduce
๐ท Screenshots or Additional Information
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
[CI/CD] Investigate failing tests
โ๏ธ Description
Current automatic checks while pushing/creating pull requests are failing due to 2 tests:
POST articles
POST comments
๐ Expected Behavior
There should be no issue with automatic checks
๐ Current Behavior
Example failure: https://github.com/kat-kan/kawqa-gad-playwright/actions/runs/8364416857/job/22899713219?pr=81
๐ Steps to Reproduce
๐ท Screenshots or Additional Information
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
[Project Config] install ESLint lib for static code analysis
โ๏ธ Description
Install ESLint library to help with enforcing consistent coding practices
๐ง Why We Need This
Alongside the already installed Prettier lib, it will be a great tool for static code analysis that finds any code issues
๐ Proposed Solution
- install
ESlint
lib as per description from jaktestowac course - install prettier plugin for sorting imports:
prettier-plugin-sort-imports
as per description from jaktestowac course
lessons 03 && 04:
https://jaktestowac.pl/lesson/pw2s01l03/
https://jaktestowac.pl/lesson/pw2s01l04/
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
PATCH /articles - add more tests
Continuation of: #24
Scope of changes:
-
add a comment to 200 OK test -> that explains the required criteria under which the test passes
-
add test: 401Unauthorized -> when invalid token is sent in headers
-
add test: 400 Bad Request -> when malformed json is used
-
add test: 422 Unprocessable Entity -> when keys are missing and values are too long
-
add types to all of the variables
DELETE /articles/{id} - tests
Tests for DELETE /articles/{id} endpoint
Playwright - init config
Description
- git init - initialization of git required
- Playwright init - test framework default config required
PATCH/ comments - add more test cases
Completing patch-comments tests with other possible API answers for this endpoint, listed in the GAD application documentation.
โ๏ธ Description
-add test: 401Unauthorized -> when invalid token is sent in headers
-add test: 400 Bad Request -> when malformed json is used
-add test: 422 Unprocessable Entity -> when keys are missing and values are too long
-add test 404 Comment not found
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
GET /articles endpoint - tests
Tests for GET /articles endpoint
Github workflow standards && project standards to be established
Challenge
Currently, we don't have any rules established regarding GitHub workflow standards, and project standards.
GitHub workflow standards
- Contributor standards file, so called 'Contribution Guidelines' describing:
- how to start working/contributing to the project
- issue raising process
- PR approval/code review process incl. PR merging & branch deletion
- Project settings - Issue's description && Pull Request's description
- issue template with description guidelines -> #15
- pull request template with description guidelines -> #16
Project standards
- file: README.md
Project's README that includes:
- repository/project main goals
- list of project contributors
- how-to work with repository: installation prerequisites; installation steps; how to run tests โ #4
- redirections to internal: CONTRIBUTION, DECISION_LOG files, and what the files contain - short description
- redirections to 2 other repositories in which test cases are used, and how they will be used there - short description: https://github.com/kat-kan/kawqa-gad-docs, https://github.com/kat-kan/kawqa-gad-postman
- file: DECISION_LOG.md
Decision log which will cover:
- preparing decision log
- short explanation why Playwright was selected for writing automation API checks
- decision regarding project structure
- coding standards, incl. tools for static code analysis #9
- branches naming convention #8
- commits naming convention
-
file: CHANGELOG.md (do we need this? - currently no)
Change log with the list of main commits that introduced important changes. Not sure if we need this or not. -
file: LICENSE.md (do we need this? - no)
Info on the license we use. Not sure if we need this or not.
if there are any other items that we should cover, let's add them to the list :) and let's discuss those either here or on our Discord's channel after making some research, and providing a short summary of our findings on our notion page
[GitHub Project] auto-trigger tests run on CI before merging changes to the base branch (`main`)
โ๏ธ Description
Auto-trigger test-runner job on Github Actions CI before merging changes to the base branch (main).
๐ง Why We Need This
We will ensure that our changes do not result in breaking tests.
๐ Proposed Solution
as per description in jaktestowac course:
https://jaktestowac.pl/course/ciagla-integracja-i-testy-automatyczne-z-playwright-i-github-actions/
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[CI/CD] Investigate and fix conflicting dependency
โ๏ธ Description
There's some sort of conflict with eslint libraries on CI:
https://github.com/kat-kan/kawqa-gad-playwright/actions/runs/7963281922/job/21738522791
Also, @Justyna-KO and @kat-kan experience the same issue on their side when running the linter locally.
On my side the issue is not reproducible.
๐ Expected Behavior
There should be no issue with running pipeline on CI.
๐ Current Behavior
There is an issue with running pipeline. During the dependencies installation step there is a following error printed:
npm ERR! Conflicting peer dependency: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR! peer @typescript-eslint/parser@"^7.0.0" from @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR! dev @typescript-eslint/eslint-plugin@"^7.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
โ Problem report checklist
- I created a descriptive title for this problem report
- I checked that a similar issue hasn't been reported yet
- I assigned the problem report or added appropriate labels
Add tests for GET/article-labels/articles
โ๏ธ Description
This is pretty self-explanatory, add tests for successful and unsuccessful getting of article labels
๐ง Why We Need This
๐ Proposed Solution
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[GitHub Project] Add ISSUE template
Add an issue template in the project so we can have a consistent way of describing our issues.
Add GET comments test
โ๏ธ Description
Add tests for GET/comments
๐ง Why We Need This
NA
๐ Proposed Solution
NA
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[CONFIG] [LIB] add Winston logger lib to the project
As per suggestion in one of the PR threads here, if we want to have logging actions in the project, it makes sense to install Winston library for that: https://www.kimsereylam.com/typescript/2021/12/03/winston-logger-with-typescript.html
References:
POST /articles endpoint
Tests for POST /articles endpoint
[DOCS] Prepare Contribution Guidelines
[Project Config] add Prettier and ESLint to Husky pre-commit file
โ๏ธ Description
To make better use of the Prettier and ESLint tools, both should be run pre-commit leveraging the Husky library
๐ง Why We Need This
Instead of remembering to run Prettier and the ESLint before each commit, we can automate this process. It saves time and is an enormous help in enforcing consistent coding practices :)
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
[DOCS] - Add explanations to README.md and CONTRIBUTING.md
โ๏ธ Description
I propose adding some explanations for less obvious parts of the README and CONTRIBUTING documents
๐ง Why We Need This
As a relatively new user of Playwright, I'd like to know why e.g. vscode-icons is recommended as an optional plugin to install. Also, some steps in contributing guidelines are not clear to me.
Of course, I can do all the edits, but I would need some explanations.
๐ Proposed Correction or Addition
Contributing.md:
- Add an explanation of the "with-deps chromium" option. I don't understand, why I should add this command. If it is decided to skip testing on Firefox and Webkit, please add this information, too.
- Explain what e-mail and password are needed in the
.env
file and how to obtain the data (for users starting work in GAD)
Readme.md:
- Explain what every plugin does (if it is not obvious) or why it is recommended in the project. A nice and short explanation is in the case of Thunder Client -
for making quick API requests within VS Code
. Some of the plugins are obvious to me, but some (e.g. vscode-icons) are not.
It would be useful to write some troubleshooting (e.g. as the last part of Readme.md) - what to do if in the initial test run you got a lot of 401 etc.
โ Documentation fix checklist
- I created a descriptive title for this documentation fix
- I checked that a similar documentation issue hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I assigned the documentation fix or added appropriate labels
POST /login - tests
Challenge
Write tests for Login endpoint
Solution
- add
dotenv
library - following the best practices, it's worth to use dotenv library so that login credentials are not "visible" in the code, but kept locally - remove unnecessary comments from the pw config file, update the
playwright.config.ts
- add scripts to
package.json
, so that we can use our personalized commands for running tests
[GitHub Project] Add short project description
PUT /articles/{id} - tests
Tests for PUT /articles/{id} endpoint
[Helper function] extend helper with admin data
Continuation of: #27
Scope of changes:
src\fixtures\api\auth.ts
: add admin usersrc\helpers\api\create-token.helper.tscreate-token.helper.ts
: modify helper methods to accommodate a new user - admin
[GitHub Project] Add PR template
Add a PR template to the project so we can have a consistent way of describing our Pull Requests.
[Project Config: env fix] optimize setup so that baseURL does not have to be defined in each test file
โ๏ธ Description
The current project setup requires defining it and storing in a variable in each single test file. However, it's a good practice to have baseURL declared only in 1 place and use throughout the project. :)
๐ง Why We Need This
- for maintenance reasons -> it will be easier to maintain the project if we have to adjust the baseURL in 1 place instead of changing it in every single test file; especially since we're planning to run the tests on CI which will make the whole setup a whole lot of easier
- to make the project consistent with the DRY principle
โ Issue reporting checklist
- I created a descriptive title for this issue
- I checked that it hasn't been reported yet
- I assigned the issue or added
help-wanted
label - I added appropriate labels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.