|
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | +import type { Page } from '@playwright/test'; |
| 3 | + |
| 4 | +import { login, host } from '../shared'; |
| 5 | +const { checkTitle } = require('./utils/uniqueFunction'); |
| 6 | + |
| 7 | +const { checkPrefix, createPrefix, findPrefix, deletePrefix, editPrefix, findEditedPrefix } = require('./utils/prefixFunctions'); |
| 8 | + |
| 9 | +// Annotate entire file as serial. |
| 10 | +test.describe.configure({ mode: 'serial' }); |
| 11 | + |
| 12 | +test.describe('Prefix Category', () => { |
| 13 | + // Declare page outside of the test hooks so it's accessible by all tests. |
| 14 | + let page: Page; |
| 15 | + |
| 16 | + test.beforeAll(async ({ browser }) => { |
| 17 | + page = await browser.newPage(); // Create new page |
| 18 | + await login(page); // Login |
| 19 | + await page.goto(`${host}/rpm/externallink/prefixcategory/`); // Go to Prefix Category page |
| 20 | + }); |
| 21 | + |
| 22 | + test.afterAll(async () => { |
| 23 | + await page.close(); // Close the page after all tests |
| 24 | + }); |
| 25 | + |
| 26 | + // Unique name for the Prefix Category |
| 27 | + test.describe('Iterations for fields validation', () => { |
| 28 | + const prefixIterate = `test_iterate-${+Date.now()}`; |
| 29 | + // test('Check title ', async () => { |
| 30 | + // //Check with title name |
| 31 | + // await checkTitle(page, 'Prefix Category', '.w-full >> .table.table-compact', 'h1.h1'); |
| 32 | + // }); |
| 33 | + |
| 34 | + test.slow |
| 35 | + test('Check with only description', async () => { |
| 36 | + await checkPrefix(page,"","Test description") |
| 37 | + }); |
| 38 | + |
| 39 | + test('Check with only prefix name', async () => { |
| 40 | + await checkPrefix(page, prefixIterate, "") |
| 41 | + await findPrefix (page,prefixIterate) |
| 42 | + await deletePrefix(page) |
| 43 | + }); |
| 44 | + |
| 45 | + |
| 46 | + }); |
| 47 | + |
| 48 | + test.describe('Create new Prefix Category', () => { |
| 49 | + const prefix = `test_new-${+Date.now()}`; |
| 50 | + // test('should match the expected title', async () => { |
| 51 | + // await checkTitle(page, 'Prefix Category', '.w-full >> .table.table-compact', 'h1.h1'); |
| 52 | + // }); |
| 53 | + |
| 54 | + test('Create Prefix Category', async () => { |
| 55 | + await createPrefix(page, prefix); |
| 56 | + }); |
| 57 | + |
| 58 | + test('Find the new Prefix in the table', async () => { |
| 59 | + await findPrefix(page, prefix); |
| 60 | + }); |
| 61 | + |
| 62 | + test('Delete new Prefix Category', async () => { |
| 63 | + await deletePrefix(page); |
| 64 | + }); |
| 65 | + |
| 66 | + }); |
| 67 | + test.describe('Edit new Prefix Category', () => { |
| 68 | + const prefix = `test_edit-${+Date.now()}`; |
| 69 | + // test('should match the expected title', async () => { |
| 70 | + // await checkTitle(page, 'Prefix Category', '.w-full >> .table.table-compact', 'h1.h1'); |
| 71 | + // }); |
| 72 | + |
| 73 | + test('Create Prefix Category', async () => { |
| 74 | + await createPrefix(page, prefix); |
| 75 | + }); |
| 76 | + |
| 77 | + test('Find the new Prefix in the table', async () => { |
| 78 | + await findPrefix(page, prefix); |
| 79 | + }); |
| 80 | + |
| 81 | + test.slow() |
| 82 | + test('Edit description Prefix Category', async () => { |
| 83 | + test.slow(); |
| 84 | + await editPrefix(page, prefix); |
| 85 | + }); |
| 86 | + test.slow() |
| 87 | + test('Find the edited Prefix Category in the table', async () => { |
| 88 | + await findEditedPrefix(page, prefix); |
| 89 | + }); |
| 90 | + test.slow() |
| 91 | + test('Delete new Prefix Category', async () => { |
| 92 | + await deletePrefix(page); |
| 93 | + }); |
| 94 | + |
| 95 | + }); |
| 96 | +}); |
| 97 | + |
0 commit comments