Skip to content

Commit c0c5d70

Browse files
Create variable management without edit and delete the edited variable #8
1 parent 7274038 commit c0c5d70

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

tests/RPM/variables.spec.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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 { checkVariables, createVariable, findVariable, deleteVariable, editVariable } = require('./utils/variableFunctions');
8+
9+
10+
// Annotate entire file as serial.
11+
test.describe.configure({ mode: 'serial' });
12+
13+
test.describe('Variable', () => {
14+
// Declare page outside of the test hooks so it's accessible by all tests.
15+
let page: Page;
16+
17+
test.beforeAll(async ({ browser }) => {
18+
page = await browser.newPage(); // Create new page
19+
await login(page); // Login
20+
await page.goto(`${host}/rpm/variabletemplate/`); // Go to variable page
21+
});
22+
23+
test.afterAll(async () => {
24+
await page.close(); // Close the page after all tests
25+
});
26+
27+
// Unique name for the Variable
28+
test.slow();
29+
test.describe('Iterations for fields validation', () => {
30+
const variableIterate = `test_iterate-${+Date.now()}`;
31+
// test('Check title ', async () => {
32+
// //Check with title name
33+
// await checkTitle(page, 'Variable', '.w-full >> .table.table-compact', 'h1.h1');
34+
// });
35+
36+
test('Check with name field , description', async () => {
37+
await checkVariables(page, variableIterate, "Test Variable")
38+
});
39+
40+
test('Check with name field , description and unit', async () => {
41+
await checkVariables(page, variableIterate, "Test Variable", "none")
42+
});
43+
44+
test('Check with name field , description and, data type', async () => {
45+
await checkVariables(page, variableIterate, "Test Variable", "", "bool",)
46+
});
47+
48+
test('Check with name field , description, data type, unit and missing value ', async () => {
49+
await checkVariables(page, variableIterate, "Test Variable", "none", "bool", "Test Missing Name", "", "", "", "")
50+
await findVariable(page, variableIterate)
51+
test.slow();
52+
await deleteVariable(page)
53+
});
54+
55+
test.slow();
56+
test('Check with name field , description, data type, unit, missing value and missing value description ', async () => {
57+
await checkVariables(page, variableIterate, "Test Variable", "none", "bool", "Test Missing Name", "Test missing value des", "", "", "")
58+
await findVariable(page, variableIterate)
59+
test.slow();
60+
await deleteVariable(page)
61+
});
62+
63+
test.slow();
64+
test('Check with name field , description, data type, unit, missing value , missing value description and meanings ', async () => {
65+
66+
await checkVariables(page, variableIterate, "Test Variable", "none", "bool", "Test Missing Name", "Test missing value des", "occurrenceID", "", "")
67+
await findVariable(page, variableIterate)
68+
test.slow();
69+
await deleteVariable(page)
70+
});
71+
72+
test.slow();
73+
test('Check with name field , description, data type, unit, missing value , missing value description, meanings and constraint ', async () => {
74+
await checkVariables(page, variableIterate, "Test Variable", "none", "bool", "Test Missing Name", "Test missing value des", "occurrenceID", "Test Constraint", "")
75+
await findVariable(page, variableIterate)
76+
test.slow();
77+
await deleteVariable(page)
78+
});
79+
80+
test.slow();
81+
test('Check with name field , description, data type, unit, meanings and constraint and approved ', async () => {
82+
await checkVariables(page, variableIterate, "Test Variable", "none", "bool", "", "", "occurrenceID", "Test Constraint", "Approved")
83+
await findVariable(page, variableIterate)
84+
test.slow();
85+
await deleteVariable(page)
86+
});
87+
88+
});
89+
90+
test.describe('Create new variable', () => {
91+
const variable = `test_new-${+Date.now()}`;
92+
// test('should match the expected title', async () => {
93+
// await checkTitle(page, 'Variables', '.w-full >> .table.table-compact', 'h1.h1');
94+
// });
95+
96+
test('Create variable', async () => {
97+
await createVariable(page, variable);
98+
});
99+
100+
test('Find the new variable in the table', async () => {
101+
await findVariable(page, variable)
102+
});
103+
104+
test('Delete new variable', async () => {
105+
await deleteVariable(page);
106+
});
107+
108+
});
109+
110+
test.describe('Edit new variable', () => {
111+
const variable = `test_edit-${+Date.now()}`;
112+
// test('should match the expected title', async () => {
113+
// await checkTitle(page, 'Variables', '.w-full >> .table.table-compact', 'h1.h1');
114+
// });
115+
116+
test('Create variable', async () => {
117+
await createVariable(page, variable);
118+
});
119+
120+
test('Find the new variable in the table', async () => {
121+
await findVariable(page, variable)
122+
});
123+
124+
// test('Edit variable', async () => {
125+
// test.slow();
126+
// await editVariable(page, variable);
127+
// });
128+
});
129+
});
130+

0 commit comments

Comments
 (0)