<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Natalia Kudrachinskaya</title>
    <description>The latest articles on DEV Community by Natalia Kudrachinskaya (@kudrachinskaya).</description>
    <link>https://dev.to/kudrachinskaya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1783877%2F12a5ddea-5f57-44bc-869c-478eddd1b5a6.jpg</url>
      <title>DEV Community: Natalia Kudrachinskaya</title>
      <link>https://dev.to/kudrachinskaya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kudrachinskaya"/>
    <language>en</language>
    <item>
      <title>Efficient Autotesting with Qase: Playwright and GitLab CI Integration</title>
      <dc:creator>Natalia Kudrachinskaya</dc:creator>
      <pubDate>Mon, 15 Jul 2024 10:58:21 +0000</pubDate>
      <link>https://dev.to/smarthead/efficient-autotesting-with-qase-playwright-and-gitlab-ci-integration-201j</link>
      <guid>https://dev.to/smarthead/efficient-autotesting-with-qase-playwright-and-gitlab-ci-integration-201j</guid>
      <description>&lt;p&gt;The approach to maintaining test documentation and the tools chosen for this purpose are crucial parts of the development process that directly affect the product's quality. Keeping test documentation up to date is particularly important. Qase can be an excellent tool for this. Additionally, it helps integrate manual testing with automated testing, and test cases with their execution.&lt;/p&gt;

&lt;p&gt;In this article, we will explore the implementation of Qase integration with Playwright and GitLab CI, as used at SmartHead: from project creation to automated testing reports.&lt;/p&gt;

&lt;h4&gt;
  
  
  Benefits of using Qase, Playwright, and GitLab CI
&lt;/h4&gt;

&lt;p&gt;Qase offers extensive functionality for test management, including test cases, checklists, test runs, and plans, as well as integrations with bug tracking tools. Combined with Playwright and GitLab CI, this provides the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Centralized test management:&lt;/strong&gt; A user-friendly interface for maintaining all test cases, plans, and runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic test creation and synchronization:&lt;/strong&gt; Ensure test cases are up to date and minimize the risk of duplication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy to integrate and use:&lt;/strong&gt; Playwright simplifies writing and maintaining tests, while GitLab CI automates their execution with every code change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detailed reporting:&lt;/strong&gt; Qase provides detailed test execution reports to help you quickly identify and fix bugs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run tests locally or in CI:&lt;/strong&gt; Ability to run tests locally or in a CI/CD Pipeline with automatic synchronization of each run and test case information in Qase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Running Pipelines directly from Qase:&lt;/strong&gt; A more integrated and automated testing process. Reports are available in both Qase and GitLab after each run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attachment support:&lt;/strong&gt; Ability to attach screenshots, logs, test pass records, and other files to reports for detailed analysis of bugs and issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's move on to the implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Set up a project in Qase
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create a new project in Qase
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Register or log in to your Qase account.&lt;/li&gt;
&lt;li&gt;Create a new project, specifying its name and other necessary data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx87zg5j237zzqd4yum2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frx87zg5j237zzqd4yum2.png" alt="empty Qase repository"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Setting up automatic creation of test cases
&lt;/h4&gt;

&lt;p&gt;In the project settings (Settings &amp;gt; Run), enable the option to automatically create new test cases when there are no matches. This will help avoid duplication and keep the test suite up to date.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67kae7e2sx8nwshldnyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67kae7e2sx8nwshldnyq.png" alt="auto create test cases"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When this option is disabled, the test case name from the code will be displayed in the test run, but it will not be added to the repository. When enabled, if the test case is not marked as existing (no ID from Qase is specified), the new test case will be added to the project repository automatically.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create test cases in a project
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Create one or two test cases. We will need them for the next steps.&lt;/li&gt;
&lt;li&gt;Specify the basic parameters such as the name, description, and steps of the test execution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffa0cv23ft2lnlq52ex92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffa0cv23ft2lnlq52ex92.png" alt="case elements"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Customize the Qase + Playwright integration
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Install Playwright and playwright-qase-reporter
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the root directory of the project.&lt;/li&gt;
&lt;li&gt;Following the instructions, install &lt;a href="https://playwright.dev/" rel="noopener noreferrer"&gt;Playwright&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Following the instructions, install &lt;a href="https://www.npmjs.com/package/playwright-qase-reporter" rel="noopener noreferrer"&gt;the reporter for Qase&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Set up the integration in Qase
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Log in to Qase.&lt;/li&gt;
&lt;li&gt;Go to the "Apps" section.&lt;/li&gt;
&lt;li&gt;Locate and select Playwright.&lt;/li&gt;
&lt;li&gt;Set up the integration and save the token you created. You can give it any meaningful name.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vuuww7ns16sypqi4g7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vuuww7ns16sypqi4g7u.png" alt="PW integration"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Set up the configuration in Playwright
&lt;/h4&gt;

&lt;p&gt;Create an &lt;code&gt;.env&lt;/code&gt; file. This file will store our sensitive data for local launch. We will add the copied token from Qase there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpis17dudq40kiuymqwhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpis17dudq40kiuymqwhm.png" alt="token in env"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing Playwright, playwright.config.ts will appear in the root directory of the project. Open the file and add the following configuration:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 typescript
import { defineConfig, devices } from '@playwright/test';
require('dotenv').config({ path: '.env' }); // Required for using variables from .env

export default defineConfig({
  testDir: './tests', // Your test repository
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,

  reporter: [
    ['list'],
    ['playwright-qase-reporter',
      {
        testops: {
          project: 'TEST', // Your project code from Qase
          api: {
            token: process.env.QASE_TOKEN, // Token from .env
          },
          run: {
            id: process.env.QASE_RUN_ID,
            complete: true,
          },
          uploadAttachments: true,
        },
      }],
  ],

  use: {
    trace: 'on-first-retry',
  },

  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    }
  ],

});


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Don't forget to add the &lt;code&gt;.env&lt;/code&gt; file to .gitignore so you don't accidentally commit the token to the repository.&lt;/p&gt;

&lt;h4&gt;
  
  
  About ID in Qase runs
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;id: process.env.QASE_RUN_ID&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Specifying &lt;code&gt;QASE_RUN_ID&lt;/code&gt; in the configuration is necessary to prevent the creation of different runs in Qase. Without this setting, the automatic run created in Qase and the run that starts the pipeline will be assigned different IDs. By specifying &lt;code&gt;QASE_RUN_ID&lt;/code&gt;, we ensure that the tests from the pipeline are added to the existing run in Qase, if it already exists.&lt;/p&gt;

&lt;h4&gt;
  
  
  Specify the IDs of the cases in the tests
&lt;/h4&gt;

&lt;p&gt;To link tests from Playwright with tests from the Qase repository, we need to specify their IDs in the tests. For convenience, it's better to use names identical to those in Qase. Regardless, the test run will contain the name of the case whose ID you specified.&lt;/p&gt;

&lt;p&gt;Example code of a case test with &lt;code&gt;qase.id()&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 typescript
// test.spec.ts
import { test, expect } from '@playwright/test';
import { qase } from 'playwright-qase-reporter';

test('Display title of Playwright main page', async ({ page }) =&amp;gt; {
  qase.id(1); // ID of the test case in Qase

  // Step #1
  await page.goto('https://playwright.dev/');
  await expect(page).toHaveURL('https://playwright.dev/');
  // Expected result: The page opens

  // Step #2
  const title = await page.getByText('Playwright enables reliable end-to-end testing for modern web apps.');
  await expect(title).toBeVisible();
  // Expected result: The title is displayed
});


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Also for the sake of example, let's write a test where we don't specify &lt;code&gt;qase.id()&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Test that is not in the repository&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Step #1&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://playwright.dev/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toHaveURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://playwright.dev/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// Expected result: The page opens&lt;/span&gt;

  &lt;span class="c1"&gt;// Step #2&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Playwright enables reliable end-to-end testing for modern web apps.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toBeVisible&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="c1"&gt;// Expected result: The title is displayed&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Running tests
&lt;/h4&gt;

&lt;p&gt;Run the tests using the command, specifying your path to the tests:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 bash
QASE_MODE=testops npx playwright test tests/test.spec.ts


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Checking your results in Qase
&lt;/h4&gt;

&lt;p&gt;After successfully running the tests, you will get a link to your run in Qase in the console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohbj1naznb8y0tfs5ryd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohbj1naznb8y0tfs5ryd.png" alt="run in Console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Directly from the console, we can follow the link to view the test run we just executed. You can share this link by making it public or keeping it private. Additionally, you can see detailed information about all the steps of each individual test case, the duration of its execution, and follow the link to view the Pipeline, and so on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehy0r5fxuv235v64yksv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehy0r5fxuv235v64yksv.png" alt="automated run in Qase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The case specified with the ID will pull the existing case from Qase. It will include the steps you have provided and all other information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu76etuipbjcc1mw7aj75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu76etuipbjcc1mw7aj75.png" alt="case with the ID"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A case without specifying an ID will be pulled up by default in this state:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqjx035kpdrdvvqm210nv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqjx035kpdrdvvqm210nv.png" alt="case without ID"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project repository will also include any new test cases that were not previously present. These will be created thanks to the setting we added earlier. If you disable this setting, the tests will still run, but no new test cases will be added to the repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmc7lfgqo2h34n3bguyu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmc7lfgqo2h34n3bguyu0.png" alt="new case in qase repo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A new test case will not be created in subsequent runs. However, it's advisable to include the ID in the code of each test case to prevent confusion.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Integrate Qase with GitLab CI
&lt;/h3&gt;

&lt;p&gt;Create a project on GitLab if it hasn't been created already. Ensure that CI/CD is enabled under Settings -&amp;gt; General -&amp;gt; Visibility, project features, permissions.&lt;/p&gt;
&lt;h4&gt;
  
  
  Customize variables in GitLab
&lt;/h4&gt;

&lt;p&gt;With the &lt;code&gt;.env&lt;/code&gt; file created, we can store configuration data locally. However, to run tests in CI, this data needs to be shared with GitLab. GitLab provides CI/CD Variables for this purpose.&lt;/p&gt;

&lt;p&gt;To add your own variable, you need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to Settings -&amp;gt; CI/CD -&amp;gt; Variables. Here we can save sensitive data similar to the &lt;code&gt;.env&lt;/code&gt; file to use later.&lt;/li&gt;
&lt;li&gt;Click Add variable and in the window that opens, enter QASE_TOKEN in Key and token values in Value.&lt;/li&gt;
&lt;li&gt;Save the data :)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxmhg8jhd1m0tpcise0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxmhg8jhd1m0tpcise0w.png" alt="git variables"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Customize the &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file in a project
&lt;/h4&gt;

&lt;p&gt;There are numerous articles available on CI/CD that can assist you in selecting the optimal approach. Here, I’ll cover only what is needed for integration with Qase.&lt;/p&gt;

&lt;p&gt;Add the &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file to the project root. A minimal configuration example for &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; might look like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 yaml
stages:
  - test

test:
  stage: test
  image: mcr.microsoft.com/playwright:v1.42.1-jammy
  script:
    - npm ci
    - npx playwright install
    - QASE_MODE=testops npx playwright test tests/test.spec.ts


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Using the official Docker image from Playwright.&lt;/li&gt;
&lt;li&gt;Installing dependencies.&lt;/li&gt;
&lt;li&gt;Running tests with reports sent to Qase.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After configuring your &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file, remember to push the code to your GitLab repository. Once pushed, the pipeline will execute, and Qase will generate a test run report similar to the one generated previously.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create an automatic test-run in Qase
&lt;/h4&gt;

&lt;p&gt;After all the settings are done, we can start a run in Qase, which will create a Pipeline in GitLab and run the tests.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to Qase.&lt;/li&gt;
&lt;li&gt;Open the Test Runs section and click Start new test run.&lt;/li&gt;
&lt;li&gt;In the test run settings, enter the required data, select GitLab integration, specify the required project, branch, and run the tests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F835ggnif6zzikv2s5u05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F835ggnif6zzikv2s5u05.png" alt="start new test run in qase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A report will also be generated after the run is completed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtxpp9hnvg1zz5hkvant.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtxpp9hnvg1zz5hkvant.png" alt="ready test run in qase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thus, we executed the automated tests in three ways: locally, by committing code changes to the repository, and by initiating an automated test run in Qase. In each scenario, a report was submitted to Qase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Building software effectively relies on leveraging modern automation and testing tools. Integrating Qase, Playwright, and GitLab CI forms a powerful combination that enhances the development and testing processes.&lt;/p&gt;

&lt;p&gt;Playwright provides rapid and reliable test automation, allowing thorough testing of application functionality across various platforms and browsers, thereby reducing testing durations. GitLab CI ensures that tests are automatically run upon each code update, facilitating early detection and resolution of bugs. Integrating with Qase provides a comprehensive ecosystem within a single platform—from test case creation to automated execution and detailed reporting.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>playwright</category>
      <category>gitlab</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
