kat-kan / kawqa-gad-playwright

4 stars 1 forks source link

[Issue 108] Add testing unique article title on creating new article #124

Open Slawomir-DKl opened 1 month ago

Slawomir-DKl commented 1 month ago

Resolves #108

Scope of changes:

How to use it:

New helper feature-file.helper.ts

I propose using the new helper function in hook beforeAll and disabling it in hook afterAll. To use the function, pass the request parameter as the context, the name of the flag (to be checked in GAD documentation) and boolean isEnabled (true if you want to enable the flag and false to disable it), e.g.

await enableFeatureFlag(request, 'feature_validate_article_title', true);

Article title generator

At the moment you can:

Faker

First install the faker library:

npm i @faker-js/faker

To use the faker, import it (I suggest importing only EN version to improve test performance):

import {faker } from '@faker-js/faker/locale/en'

Any other comments?

In the generateUniqueArticleTitle function, I used the while loop with if condition. Remarks:

Before submitting Pull Request, I've ensured that:

Slawomir-DKl commented 3 weeks ago

Additionally, I've set the article-labels tests to serial mode to avoid flaky tests - in parallel mode, the "200" test sometimes fails with "404" code, probably due to other tests working concomitantly on the same articles or other resources