Setting up for QA

Framework: Playwright

Language: TypeScript

IDE: VSCode

1. Create a GitLab account and add an SSH key:

  1. Register on GitLab

  2. 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.

    1. Press Enter to save the key in the default location.

    2. Enter a passphrase if required (or press Enter to skip).

    3. Verify the key creation:

      ls ~/.ssh
    4. Add the SSH key to the agent:

      ssh-add ~/.ssh/id_rsa
    5. View the public key:

      cat ~/.ssh/id_rsa.pub
    6. Copy the entire output.

  3. For Windows:
    a. Open Git Bash and run the commands as described for macOS.

2. Add the SSH Key to GitLab

  1. Log in to your GitLab account.

  2. Navigate to Preferences > SSH Keys.

  3. Click the Add new key.

  4. Paste your copied SSH public key and click Add key.

3. Install Node.js

  1. Download and install Node.js from the official website.

  2. Verify the installation by running the following commands:

    node -v
    npm -v

4. Download and set up VSCode:

  1. Download VSCode from the official website.

  2. Install VSCode on your machine.

  3. Create a folder to store the project files.

  4. Open VSCode and select the created folder.

  5. Verify you’re in the correct folder by running:

    ls
  6. Initialize a Node.js project in the terminal:

    npm init

5. Initialize Git and Clone a Project from GitLab

  1. Initialize Git in the project folder:

    git init
  2. Clone the project repository:

    git@gitlab.cheitgroup.com:talent/tests/end-2-end.git
  3. Install all project dependencies:

    npm install
  4. If Playwright is not installed, run:

    npm init playwright@latest
  5. 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)

Comments

Leave a Reply