Framework: Playwright
Language: TypeScript
IDE: VSCode
1. Create a GitLab account and add an SSH key:
-
Register on GitLab
-
Create an SSH Key on Your Machine.
macOS:ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
a. Replace "your_email@example.com" with your email address.
-
Press Enter to save the key in the default location.
-
Enter a passphrase if required (or press Enter to skip).
-
Verify the key creation:
ls ~/.ssh
-
Add the SSH key to the agent:
ssh-add ~/.ssh/id_rsa
-
View the public key:
cat ~/.ssh/id_rsa.pub
-
Copy the entire output.
-
-
For Windows:
a. Open Git Bash and run the commands as described for macOS.
2. Add the SSH Key to GitLab
-
Log in to your GitLab account.
-
Navigate to Preferences > SSH Keys.
-
Click the Add new key.
-
Paste your copied SSH public key and click Add key.
3. Install Node.js
-
Download and install Node.js from the official website.
-
Verify the installation by running the following commands:
node -v npm -v
4. Download and set up VSCode:
-
Download VSCode from the official website.
-
Install VSCode on your machine.
-
Create a folder to store the project files.
-
Open VSCode and select the created folder.
-
Verify you’re in the correct folder by running:
ls
-
Initialize a Node.js project in the terminal:
npm init
5. Initialize Git and Clone a Project from GitLab
-
Initialize Git in the project folder:
git init
-
Clone the project repository:
git@gitlab.cheitgroup.com:talent/tests/end-2-end.git
-
Install all project dependencies:
npm install
-
If Playwright is not installed, run:
npm init playwright@latest
-
If errors occur, force installation with:
npm init playwright@latest --force
6. Main Git commands:
|
Command |
Description |
|---|---|
|
git checkout [branchName] |
Switch to a specific branch. |
|
git checkout -b [branchName] |
Create a new branch and switch to it. |
|
git status |
Check the status of tracked and untracked files in the repository. |
|
git branch |
List all branches and highlight the current branch. |
|
git add . |
Stage all changes (modified, new, and deleted files) for the next commit. |
|
git add [fileName.ts] |
Stage a specific file for the next commit. |
|
git commit -m "message" |
Create a new commit with a descriptive message. |
|
git push |
Push committed changes to the remote repository (e.g., GitLab). |
|
git pull |
Fetch and merge changes from the remote repository into your current branch. |
|
git rebase [branchName] |
Reapply commits from your branch on top of the specified branch. |
7. Git flow:
(master)
│
git status
│
▼
git checkout -b feature-branch // create & switch to feature-branch
│
│ (Make your changes)
│ git add .
│ git commit -m "BranchName Your Comment"
│ git push -u origin feature-branch
▼
git checkout master
│
git pull // update local master from remote
│
git merge feature-branch // merge happens in GitLab (MR)
│
git pull // fetch any remote changes post-merge
│
▼
(master updated)
Leave a Reply
You must be logged in to post a comment.