|
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | +import type { Page } from '@playwright/test'; |
| 3 | +const { checkTitle } = require('./utils/uniqueFunction'); |
| 4 | + |
| 5 | +const { createNewtabularData,uploadfiles, markingVariableData,EnterTitleandDesc,AssignDataTypeDisplayPattern,markPrimaryandSave,validatePrimaryandSucessSymbols,submitData} = require('./utils/tabularDataFunctions'); |
| 6 | + |
| 7 | +import { login, host } from '../shared'; |
| 8 | + |
| 9 | +// Annotate entire file as serial. |
| 10 | +test.describe.configure({ mode: 'serial' }); |
| 11 | + |
| 12 | +test.describe('Data Types', () => { |
| 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 | + // test.setTimeout(120_000) |
| 18 | + page = await browser.newPage(); // Create new page |
| 19 | + await login(page); // Login |
| 20 | + await page.goto(`${host}/dcm/create/`); // Go to create dataset page |
| 21 | + }); |
| 22 | + |
| 23 | + test.afterAll(async () => { |
| 24 | + await page.close(); // Close the page after all tests |
| 25 | + }); |
| 26 | + test.slow(); |
| 27 | + test('Title', async () => { |
| 28 | + // Check the title of the breadcrumb |
| 29 | + const title = page.locator('.breadcrumb > :nth-child(3)'); |
| 30 | + await page.waitForSelector('.breadcrumb > :nth-child(3)'); |
| 31 | + await expect(title).toBeVisible(); |
| 32 | + }); |
| 33 | + |
| 34 | + |
| 35 | + test.describe('Creating a data set with tabular data', () => { |
| 36 | + |
| 37 | + const tabularTitle = `test-${Math.floor(performance.now())}`; |
| 38 | + |
| 39 | + test('Check with title and title description field ', async () => { |
| 40 | + await createNewtabularData(page, tabularTitle, 'testDesc'); |
| 41 | + }); |
| 42 | + |
| 43 | + test.slow(); |
| 44 | + |
| 45 | + test('upload the file and select the data structure', async () => { |
| 46 | + await uploadfiles(page); |
| 47 | + }); |
| 48 | + test.slow(); |
| 49 | + |
| 50 | + test('marking the variable and data', async () => { |
| 51 | + await markingVariableData(page); |
| 52 | + }); |
| 53 | + |
| 54 | + |
| 55 | + test('Entering the title and Description for the data strucrture', async () => { |
| 56 | + await EnterTitleandDesc(page,'Alpha'+tabularTitle,'TestDesc'); |
| 57 | + }); |
| 58 | + |
| 59 | + |
| 60 | + test('Assigning the data type (date) and display pattern (dd.MM.yy)', async () => { |
| 61 | + await AssignDataTypeDisplayPattern(page,1,'date','dd.MM.yy'); |
| 62 | + }); |
| 63 | + |
| 64 | + |
| 65 | + test('Assigning the data type (date) and display pattern (dd.MM.yyyy)', async () => { |
| 66 | + await AssignDataTypeDisplayPattern(page,2,'date','dd.MM.yyyy'); |
| 67 | + }); |
| 68 | + |
| 69 | + |
| 70 | + test('Assigning the data type (date) and display pattern (dd/MM/yy)', async () => { |
| 71 | + await AssignDataTypeDisplayPattern(page,3,'date','dd/MM/yy'); |
| 72 | + }); |
| 73 | + |
| 74 | + |
| 75 | + test('Assigning the data type (date) and display pattern (dd/MM/yyyy)', async () => { |
| 76 | + await AssignDataTypeDisplayPattern(page,4,'date','dd/MM/yyyy'); |
| 77 | + }); |
| 78 | + |
| 79 | + |
| 80 | + test('Assigning the data type (date) and display pattern (M/d/yyyy)', async () => { |
| 81 | + await AssignDataTypeDisplayPattern(page,5,'date','M/d/yyyy'); |
| 82 | + }); |
| 83 | + |
| 84 | + |
| 85 | + test('Assigning the data type (datetime) and display pattern (M/d/yyyy h:m)', async () => { |
| 86 | + await AssignDataTypeDisplayPattern(page,6,'datetime','M/d/yyyy h:m'); |
| 87 | + }); |
| 88 | + |
| 89 | + |
| 90 | + test('Assigning the data type (date) and display pattern (MM/dd/yy)', async () => { |
| 91 | + await AssignDataTypeDisplayPattern(page,7,'date','MM/dd/yy'); |
| 92 | + }); |
| 93 | + |
| 94 | + |
| 95 | + test('Assigning the data type (date) and display pattern (MM/dd/yyyy)', async () => { |
| 96 | + await AssignDataTypeDisplayPattern(page,8,'date','MM/dd/yyyy'); |
| 97 | + }); |
| 98 | + |
| 99 | + |
| 100 | + test('Assigning the data type (date) and display pattern (yy-MM-dd)', async () => { |
| 101 | + await AssignDataTypeDisplayPattern(page,9,'date','yy-MM-dd'); |
| 102 | + }); |
| 103 | + |
| 104 | + |
| 105 | + test('Assigning the data type (date) and display pattern (yyyy-dd-MM)', async () => { |
| 106 | + await AssignDataTypeDisplayPattern(page,10,'date','yyyy-dd-MM'); |
| 107 | + }); |
| 108 | + |
| 109 | + |
| 110 | + test('Assigning the data type (date) and display pattern (yyyy-d-M)', async () => { |
| 111 | + await AssignDataTypeDisplayPattern(page,11,'date','yyyy-d-M'); |
| 112 | + }); |
| 113 | + |
| 114 | + |
| 115 | + test('Assigning the data type (date) and display pattern (yyyy-M-d)', async () => { |
| 116 | + await AssignDataTypeDisplayPattern(page,12,'date','yyyy-M-d'); |
| 117 | + }); |
| 118 | + |
| 119 | + |
| 120 | + test('Assigning the data type (date) and display pattern (yyyy-MM-dd)', async () => { |
| 121 | + await AssignDataTypeDisplayPattern(page,13,'date','yyyy-MM-dd'); |
| 122 | + }); |
| 123 | + |
| 124 | + |
| 125 | + test('Assigning the data type (time) and display pattern (HH:mm)', async () => { |
| 126 | + await AssignDataTypeDisplayPattern(page,14,'time','HH:mm'); |
| 127 | + }); |
| 128 | + |
| 129 | + |
| 130 | + test('Assigning the data type (time) and display pattern (hh:mm tt)', async () => { |
| 131 | + await AssignDataTypeDisplayPattern(page,15,'time','hh:mm tt'); |
| 132 | + }); |
| 133 | + |
| 134 | + |
| 135 | + test('Assigning the data type (time) and display pattern (hh:mm:ss)', async () => { |
| 136 | + await AssignDataTypeDisplayPattern(page,16,'time','hh:mm:ss'); |
| 137 | + }); |
| 138 | + |
| 139 | + test('Assigning the data type (time) and display pattern (hh:mm:ss tt)', async () => { |
| 140 | + await AssignDataTypeDisplayPattern(page,17,'time','hh:mm:ss tt'); |
| 141 | + }); |
| 142 | + |
| 143 | + test('Assigning the data type (date) and display pattern (MM)', async () => { |
| 144 | + await AssignDataTypeDisplayPattern(page,18,'date','MM'); |
| 145 | + const setDisplayPattern = page.locator(`:nth-child(18) > #variable-0-container-info > .card .svelte-select > .value-container > #displayPattern`); |
| 146 | + setDisplayPattern.press('ArrowDown'); |
| 147 | + await page.waitForTimeout(500); |
| 148 | + setDisplayPattern.press('Enter'); |
| 149 | + }); |
| 150 | + |
| 151 | + |
| 152 | + test('Assigning the data type (date) and display pattern (yyyy)', async () => { |
| 153 | + await AssignDataTypeDisplayPattern(page,19,'date','yyyy'); |
| 154 | + const setDisplayPattern = page.locator(`:nth-child(19) > #variable-0-container-info > .card .svelte-select > .value-container > #displayPattern`); |
| 155 | + setDisplayPattern.press('ArrowDown'); |
| 156 | + await page.waitForTimeout(500); |
| 157 | + setDisplayPattern.press('Enter'); |
| 158 | + |
| 159 | + }); |
| 160 | + |
| 161 | + test('Marking the 1st as part of primary key and saving it', async () => { |
| 162 | + await markPrimaryandSave(page) |
| 163 | + }); |
| 164 | + |
| 165 | + test('validate the primary key and success symbols are visible', async () => { |
| 166 | + await validatePrimaryandSucessSymbols(page) |
| 167 | + }); |
| 168 | + |
| 169 | + test('Submit the data valdate the validation messages', async () => { |
| 170 | + await submitData(page) |
| 171 | + }); |
| 172 | + |
| 173 | + }); |
| 174 | + |
| 175 | +}); |
0 commit comments