Skip to content

Commit 1a3b34d

Browse files
Add Test cases for upload data structure #19
1 parent e0ee7e1 commit 1a3b34d

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { test, expect } from '@playwright/test';
2+
import type { Page } from '@playwright/test';
3+
const { checkTitle } = require('./utils/uniqueFunction');
4+
5+
const { navDataStructure , uploadDataStructure, findDataStructure, deleteDataStructure, checkAndCloseToast, editDataStructure, findEditedDataStructure, checkUploadDataStructure } = require('./utils/uploadDataStructureFunctions');
6+
7+
import { login, host } from '../shared';
8+
9+
// Annotate entire file as serial.
10+
test.describe.configure({ mode: 'serial' });
11+
12+
test.describe('Upload Data Structure', () => {
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/datastructure`); // Go to Data Structure page
20+
});
21+
22+
test.afterAll(async () => {
23+
await page.close(); // Close the page after all tests
24+
});
25+
26+
test.describe('Iterations for fields validation', () => {
27+
28+
test('Check with Empty CSV', async () => {
29+
await checkUploadDataStructure(page, "isEmpty", "", "", "");
30+
});
31+
32+
test(' 2nd Check with Check with Variables CSV', async () => {
33+
await checkUploadDataStructure(page, "", "hasVariables", "", "");
34+
await navDataStructure (page)
35+
});
36+
37+
test(' 3rd Check with Variables And Unit CSV', async () => {
38+
await checkUploadDataStructure(page, "", "", "hasVariablesAndUnit", "");
39+
await navDataStructure (page)
40+
});
41+
test(' 4th Check with Variables Unit And Missing Values CSV ', async () => {
42+
await checkUploadDataStructure(page, "", "", "", "hasVariablesUnitAndMissingValues");
43+
await navDataStructure (page)
44+
});
45+
46+
});
47+
48+
test.describe('Upload new data structure', () => {
49+
const dataStructure = `test_new-${+Date.now()}`;
50+
// // // test('should match the expected title', async () => {
51+
// // await checkTitle(page, 'Data structure', '.w-full >> .table.table-compact', 'h1.h1');
52+
// // });
53+
54+
55+
test('Upload data structure', async () => {
56+
await uploadDataStructure(page, dataStructure);
57+
});
58+
//test.slow()
59+
test('Find the new uploaded data structure in the table', async () => {
60+
await findDataStructure(page, dataStructure);
61+
});
62+
63+
test('Delete new uploaded data structure', async () => {
64+
await deleteDataStructure(page);
65+
});
66+
67+
test('Check toast', async () => {
68+
await checkAndCloseToast(page);
69+
});
70+
71+
});
72+
73+
test.describe('Edit new uploaded data structure', () => {
74+
const dataStructure = `test_edit-${+Date.now()}`;
75+
76+
test('Upload data structure', async () => {
77+
await uploadDataStructure(page, dataStructure);
78+
});
79+
//test.slow()
80+
test('Find the new uploaded data structure in the table', async () => {
81+
await findDataStructure(page, dataStructure);
82+
});
83+
test('Edit description on uploaded data structure', async () => {
84+
test.slow();
85+
await editDataStructure(page);
86+
});
87+
88+
test('Find the edited uploaded data structure in the table', async () => {
89+
await findEditedDataStructure(page, dataStructure);
90+
});
91+
92+
test('Delete edited uploaded data structure', async () => {
93+
await deleteDataStructure(page);
94+
});
95+
96+
test('Check toast', async () => {
97+
await checkAndCloseToast(page);
98+
});
99+
100+
});
101+
102+
});

0 commit comments

Comments
 (0)