-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbasic-generation.spec.js
More file actions
35 lines (29 loc) · 1.61 KB
/
Copy pathbasic-generation.spec.js
File metadata and controls
35 lines (29 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { test } = require('@playwright/test');
const { openApp, expectNoPageErrors, expect } = require('../../abstractions/helpers/scenario-helpers');
const { assertNoCommonErrorPatterns } = require('../../abstractions/helpers/output-quality-helpers');
test.describe('7. Test Data Generation', () => {
test('Basic Test Data Generation', async ({ page }) => {
const { appPage, pageErrors } = await openApp(page);
await appPage.testDataPanel.expand();
await appPage.testDataPanel.expectExpanded();
const beforeSchema = await appPage.testDataPanel.getSchemaRowCount();
await appPage.testDataPanel.addSchemaRow();
await expect.poll(async () => appPage.testDataPanel.getSchemaRowCount()).toBe(beforeSchema + 1);
const schemaRowIndex = beforeSchema;
await appPage.testDataPanel.setSchemaCell(schemaRowIndex, 'columnName', 'First Name');
await appPage.testDataPanel.setSchemaTypeValue(schemaRowIndex, 'person.firstName');
await appPage.testDataPanel.setGenerateCount(5);
await appPage.testDataPanel.clickGenerate();
await expect.poll(async () => appPage.gridEditor.renderer.countRows()).toBe(5);
await expect.poll(async () => appPage.gridEditor.header.getColumnNames()).toContain('First Name');
await appPage.gridEditor.expectTotalRows(5);
const values = await appPage.gridEditor.renderer.getColumnTextsByName('First Name');
expect(values).toHaveLength(5);
assertNoCommonErrorPatterns(values);
for (const value of values) {
expect(value).toMatch(/[A-Za-z]/);
expect(value.trim().length).toBeGreaterThanOrEqual(2);
}
expectNoPageErrors(pageErrors);
});
});