Skip to content

Commit 18dbecd

Browse files
Creating test cases for external links management #9
1 parent 02603d1 commit 18dbecd

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

tests/RPM/externalLinks.spec.ts

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 { checkExternalLink, createExternalLink, findExternalLink, deleteExternalLink, editExternalLink, findEditedExternalLink } = require('./utils/externalLinkFunctions');
8+
9+
// Annotate entire file as serial.
10+
test.describe.configure({ mode: 'serial' });
11+
12+
test.describe('External Links', () => {
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`); // Go to External Link Manager page
20+
});
21+
22+
test.afterAll(async () => {
23+
await page.close(); // Close the page after all tests
24+
});
25+
26+
// Unique name for the External Link
27+
test.describe('Iterations for fields validation', () => {
28+
const linkIterate = `test_iterate-${+Date.now()}`;
29+
// test('Check title ', async () => {
30+
// //Check with title name
31+
// await checkTitle(page, 'External Link', '.w-full >> .table.table-compact', 'h1.h1');
32+
// });
33+
34+
test.slow
35+
test('Check with name field and has type', async () => {
36+
await checkExternalLink(page, linkIterate, "link", "", "")
37+
});
38+
39+
test('Check with name field, has type and prefix', async () => {
40+
await checkExternalLink(page, linkIterate, "link", "dwc", "")
41+
});
42+
43+
test('Check with name field and has URI', async () => {
44+
await checkExternalLink(page, linkIterate, "", "", "[email protected]")
45+
await findExternalLink(page, linkIterate)
46+
await deleteExternalLink(page, linkIterate)
47+
});
48+
49+
});
50+
51+
test.describe('Create new External Link', () => {
52+
const externalLink = `test_new-${+Date.now()}`;
53+
// test('should match the expected title', async () => {
54+
// await checkTitle(page, 'External Link', '.w-full >> .table.table-compact', 'h1.h1');
55+
// });
56+
57+
test('Create External Link', async () => {
58+
await createExternalLink(page, externalLink);
59+
});
60+
61+
test('Find the new External Link in the table', async () => {
62+
await findExternalLink(page, externalLink);
63+
});
64+
65+
test('Delete new External Link', async () => {
66+
await deleteExternalLink(page);
67+
});
68+
69+
});
70+
test.describe('Edit new External Link', () => {
71+
const externalLink = `test_edit-${+Date.now()}`;
72+
// test('should match the expected title', async () => {
73+
// await checkTitle(page, 'External Link', '.w-full >> .table.table-compact', 'h1.h1');
74+
// });
75+
76+
test('Create External Link', async () => {
77+
await createExternalLink(page, externalLink);
78+
});
79+
80+
test('Find the new External Link in the table', async () => {
81+
await findExternalLink(page, externalLink);
82+
});
83+
84+
test.slow()
85+
test('Edit description External Link', async () => {
86+
test.slow();
87+
await editExternalLink(page, externalLink);
88+
});
89+
test.slow()
90+
test('Find the edited External Link in the table', async () => {
91+
await findEditedExternalLink(page, externalLink);
92+
});
93+
test.slow()
94+
test('Delete new External Link', async () => {
95+
await deleteExternalLink(page);
96+
});
97+
98+
});
99+
});
100+

0 commit comments

Comments
 (0)