2024-03-28 19:22:36 +00:00
|
|
|
import { test} from '@playwright/test'
|
|
|
|
import { loginAsAdmin, loginAsUser, testImportDataFile_HappyPath, testImportDataFile_SadPath, test_RequestAndCheckIssuedCredentialByUser, test_ViewAndCheckEnabledCredentialbyUser } from '../src/steps';
|
|
|
|
import { URL_IDHUB, USER1_EMAIL, USER2_EMAIL, USER3_EMAIL } from '../src/constants/env_constants';
|
|
|
|
import { ALERT_FILE_TO_IMPORT_IS_EMPTY, ALERT_FILE_TO_IMPORT_WITHOUT_REQUIRED_COLUMS_EOC, ALERT_FILE_TO_IMPORT_WITH_ALIEN_COLUMS, ALERT_FILE_TO_IMPORT_WITH_REQUIRED_COLUMS_EMPTY_EOC,FILE_TO_IMPORT_EOC, FILE_TO_IMPORT_EOC_EMPTY, FILE_TO_IMPORT_EOC_WITHOUT_REQUIRED_COLUMNS, FILE_TO_IMPORT_EOC_WITH_ALIEN_COLUMNS, FILE_TO_IMPORT_EOC_WITH_REQUIRED_EMPTY, JSON_SCHEMA_EOC, SCHEMA_EOC, SCHEMA_TYPE_EOC } from '../src/constants/constants';
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
/**
|
2024-03-28 19:22:36 +00:00
|
|
|
* Testing Admin->Data Section functionality with the E-Operator Claim Credential (EOP)
|
2024-03-25 11:31:43 +00:00
|
|
|
*/
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test.describe('ADMIN-> DATA -> Import EOP excel files', () => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
await loginAsAdmin(page, URL_IDHUB);
|
|
|
|
})
|
|
|
|
test.afterEach(async ({ page }) => {
|
|
|
|
await page.click('.logout');
|
|
|
|
await page.close();
|
|
|
|
})
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
/**
|
2024-03-25 11:31:43 +00:00
|
|
|
* Load an excel file - Happy Path
|
2024-03-28 19:22:36 +00:00
|
|
|
* Expected behavior:
|
|
|
|
* - the file is loaded, the message: "The file was imported successfully!" is displayed.
|
|
|
|
* - the file appears in the imported files view.
|
2024-03-25 11:31:43 +00:00
|
|
|
*/
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('ADMIN-> DATA -> Import EOC excel file - Happy Path', async ({ page }) => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
const fileToImport = FILE_TO_IMPORT_EOC;
|
|
|
|
const jsonSchema = JSON_SCHEMA_EOC;
|
|
|
|
const schema = SCHEMA_EOC;
|
|
|
|
|
|
|
|
await testImportDataFile_HappyPath(page, fileToImport, jsonSchema, schema);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load an excel file - Sad Path:
|
|
|
|
* Expected behavior: The error message: "The file you try to import is empty"
|
|
|
|
*/
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('ADMIN-> DATA -> Import EOC excel file - Sad path (file well formatted but empty', async ({ page }) => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
const fileToImport = FILE_TO_IMPORT_EOC_EMPTY;
|
|
|
|
const jsonSchema = JSON_SCHEMA_EOC;
|
|
|
|
const schema = SCHEMA_EOC;
|
|
|
|
const unsuccessAlertMessage = ALERT_FILE_TO_IMPORT_IS_EMPTY;
|
|
|
|
|
|
|
|
await testImportDataFile_SadPath(page, fileToImport, jsonSchema, schema, unsuccessAlertMessage);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load an excel file - Sad Path:
|
|
|
|
* Try to load a bad formatted file, without required data.
|
|
|
|
*/
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('ADMIN-> DATA -> Import EOC excel file - Sad path (bad formatted file, without required columns', async ({ page }) => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
const fileToImport = FILE_TO_IMPORT_EOC_WITHOUT_REQUIRED_COLUMNS;
|
|
|
|
const jsonSchema = JSON_SCHEMA_EOC;
|
|
|
|
const schema = SCHEMA_EOC;
|
|
|
|
const unsuccessAlertMessage = ALERT_FILE_TO_IMPORT_WITHOUT_REQUIRED_COLUMS_EOC;
|
|
|
|
|
|
|
|
await testImportDataFile_SadPath(page, fileToImport, jsonSchema, schema, unsuccessAlertMessage);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2024-04-02 19:10:58 +00:00
|
|
|
test.fixme('ADMIN-> DATA -> Import EOC excel file - Sad path (bad formatted file, with alien columns)', async ({ page }) => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
const fileToImport = FILE_TO_IMPORT_EOC_WITH_ALIEN_COLUMNS;
|
|
|
|
const jsonSchema = JSON_SCHEMA_EOC;
|
|
|
|
const schema = SCHEMA_EOC;
|
|
|
|
const unsuccessAlertMessage = ALERT_FILE_TO_IMPORT_WITH_ALIEN_COLUMS;
|
|
|
|
|
|
|
|
await testImportDataFile_SadPath(page, fileToImport, jsonSchema, schema, unsuccessAlertMessage);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('ADMIN-> DATA -> Import EOC excel file - Sad path (file with required columns present but empty)', async ({ page }) => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
const fileToImport = FILE_TO_IMPORT_EOC_WITH_REQUIRED_EMPTY;
|
|
|
|
const jsonSchema = JSON_SCHEMA_EOC;
|
|
|
|
const schema = SCHEMA_EOC;
|
|
|
|
const unsuccessAlertMessage = ALERT_FILE_TO_IMPORT_WITH_REQUIRED_COLUMS_EMPTY_EOC;
|
|
|
|
|
|
|
|
await testImportDataFile_SadPath(page, fileToImport, jsonSchema, schema, unsuccessAlertMessage);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test.describe('USER -> My Credentials - enable and issue credentials', () => {
|
2024-03-25 11:31:43 +00:00
|
|
|
|
|
|
|
test.afterEach(async ({ page }) => { //este se ejecutará despues de cada test
|
|
|
|
await page.click('.logout');
|
|
|
|
await page.close();
|
|
|
|
})
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
/**
|
|
|
|
* PRE-CONDITIONS: the admin has enabled sucessfully a credential in the previous test (DATA -> Import data- HAPPY PATH has been passed sucessfully)
|
2024-03-25 11:31:43 +00:00
|
|
|
* SUMMARY:
|
2024-03-28 19:22:36 +00:00
|
|
|
* - Check if the user can visualize the credentials that has been enabled in "My Credentials"
|
|
|
|
* - Check that the fields displayed in "View" Credential are the expected ones
|
2024-03-25 11:31:43 +00:00
|
|
|
*/
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('USER -> My Credentials -> View EOC enabled Credential for user1', async ({ page }) => {
|
|
|
|
let schemaType = SCHEMA_TYPE_EOC;
|
|
|
|
let user = USER1_EMAIL;
|
|
|
|
|
|
|
|
await loginAsUser(page, user, URL_IDHUB);
|
|
|
|
await test_ViewAndCheckEnabledCredentialbyUser(page, schemaType, user);
|
|
|
|
|
2024-03-25 11:31:43 +00:00
|
|
|
});
|
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
test('USER -> My Credentials -> View EOC enabled Credential for user2', async ({ page }) => {
|
|
|
|
let schemaType = SCHEMA_TYPE_EOC;
|
|
|
|
let user = USER2_EMAIL;
|
|
|
|
|
|
|
|
await loginAsUser(page, user, URL_IDHUB);
|
|
|
|
await test_ViewAndCheckEnabledCredentialbyUser(page, schemaType, user);
|
|
|
|
|
2024-03-25 11:31:43 +00:00
|
|
|
});
|
|
|
|
|
2024-04-02 19:10:58 +00:00
|
|
|
test.fixme('USER -> My Credentials -> Request the issuance of a EOC for user2', async ({ page }) => {
|
2024-03-28 19:22:36 +00:00
|
|
|
|
2024-03-28 21:57:12 +00:00
|
|
|
let schemaType = SCHEMA_TYPE_EOC;
|
|
|
|
let user = USER2_EMAIL;
|
2024-03-28 19:22:36 +00:00
|
|
|
|
|
|
|
await loginAsUser(page, user, URL_IDHUB);
|
|
|
|
|
|
|
|
await test_RequestAndCheckIssuedCredentialByUser(page, schemaType, user);
|
2024-03-25 11:31:43 +00:00
|
|
|
|
2024-03-28 19:22:36 +00:00
|
|
|
});
|
2024-04-02 19:10:58 +00:00
|
|
|
})
|