From 20c9a7a3595c0b5ae06f9c435bfaf932408ed1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brablo=C2=B0?= Date: Fri, 25 Oct 2024 14:28:48 +0200 Subject: [PATCH] add params --- .history/tests/edit.spec_20241025142446.ts | 81 +++++++++++++++++++ .history/tests/edit.spec_20241025142458.ts | 81 +++++++++++++++++++ .history/tests/edit.spec_20241025142807.ts | 81 +++++++++++++++++++ .../tests/newUpload.spec_20241025142641.ts | 45 +++++++++++ .../tests/newUpload.spec_20241025142646.ts | 45 +++++++++++ .../tests/newUpload.spec_20241025142829.ts | 45 +++++++++++ tests/edit.spec.ts | 4 +- tests/newUpload.spec.ts | 4 +- 8 files changed, 382 insertions(+), 4 deletions(-) create mode 100644 .history/tests/edit.spec_20241025142446.ts create mode 100644 .history/tests/edit.spec_20241025142458.ts create mode 100644 .history/tests/edit.spec_20241025142807.ts create mode 100644 .history/tests/newUpload.spec_20241025142641.ts create mode 100644 .history/tests/newUpload.spec_20241025142646.ts create mode 100644 .history/tests/newUpload.spec_20241025142829.ts diff --git a/.history/tests/edit.spec_20241025142446.ts b/.history/tests/edit.spec_20241025142446.ts new file mode 100644 index 0000000..2a1d25f --- /dev/null +++ b/.history/tests/edit.spec_20241025142446.ts @@ -0,0 +1,81 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('Edit record', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + // Setup: Log in, navigate to the upload page, and upload a file + test.beforeEach(async ({ loggedInPage, uploadFileSuccessfully }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + + // Uncomment the following line if you want to upload a file before each test + //await uploadFileSuccessfully(); + }); + + // Teardown: Take a screenshot on failure + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + console.log(`Teardown complete: Screenshot taken for failed test - ${testInfo.title}.`); + } else { + console.log(`Teardown complete: Test ${testInfo.title} passed.`); + } + }); + + test(qase(12, 'Edit Existing Record'), async () => { // Qase test case ID: + //qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + + // Navigate to 'My Dashboard' + await uploadPage.navigateToMyDashboard(); + + // Open detail page of the first record + await uploadPage.firstRecordDetail(); + + // Click 'Edit' button + console.log('Clicking the Edit button...'); + await uploadPage.clickEdit(); + + // Fill in 'Description' + const recordDescription = testData.upload.recordDescription(); + console.log(`Filling in record description: ${recordDescription}`); + await uploadPage.fillDescription(recordDescription); + + // Change 'Resource type' with fallback value + currentlySelectedType = currentlySelectedType || 'defaultType'; + console.log(`Selecting resource type: ${currentlySelectedType}`); + await uploadPage.changeResourceType(currentlySelectedType); + + // Edit the record 'Title' + const recordTitleEdit = testData.upload.recordTitle(); + console.log(`Editing the record title: ${recordTitleEdit}`); + await uploadPage.fillTitle(recordTitleEdit); + + // Click the 'Publish' button + console.log('Clicking the Publish button...'); + await uploadPage.clickPublish(); + + // Confirm the dialog by clicking 'Publish' button + console.log('Confirming the Publish action...'); + await uploadPage.clickPublishOnConfirmation(); + + // Wait for the record verification after editing + console.log('Verifying record existence after edit...'); + const recordExists = await uploadPage.checkRecordExists(); // Check if the record exists + expect(recordExists).toBe(true); // Assert that the record exists + + // Verify the edited values are correct + console.log('Verifying edited record details...'); + const actualDescription = await uploadPage.getRecordDescription(); + const actualTitle = await uploadPage.getRecordTitle(); + + // Assert that the edited description and title are correct + expect(actualDescription).toBe(recordDescription); + expect(actualTitle).toBe(recordTitleEdit); + + console.log(`Record verification completed. Expected: true, Actual: ${recordExists}`); + }); + +}); \ No newline at end of file diff --git a/.history/tests/edit.spec_20241025142458.ts b/.history/tests/edit.spec_20241025142458.ts new file mode 100644 index 0000000..8df6838 --- /dev/null +++ b/.history/tests/edit.spec_20241025142458.ts @@ -0,0 +1,81 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('Edit record', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + // Setup: Log in, navigate to the upload page, and upload a file + test.beforeEach(async ({ loggedInPage, uploadFileSuccessfully }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + + // Uncomment the following line if you want to upload a file before each test + //await uploadFileSuccessfully(); + }); + + // Teardown: Take a screenshot on failure + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + console.log(`Teardown complete: Screenshot taken for failed test - ${testInfo.title}.`); + } else { + console.log(`Teardown complete: Test ${testInfo.title} passed.`); + } + }); + + test(qase(12, 'Edit Existing Record'), async () => { // Qase test case ID: + qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + + // Navigate to 'My Dashboard' + await uploadPage.navigateToMyDashboard(); + + // Open detail page of the first record + await uploadPage.firstRecordDetail(); + + // Click 'Edit' button + console.log('Clicking the Edit button...'); + await uploadPage.clickEdit(); + + // Fill in 'Description' + const recordDescription = testData.upload.recordDescription(); + console.log(`Filling in record description: ${recordDescription}`); + await uploadPage.fillDescription(recordDescription); + + // Change 'Resource type' with fallback value + currentlySelectedType = currentlySelectedType || 'defaultType'; + console.log(`Selecting resource type: ${currentlySelectedType}`); + await uploadPage.changeResourceType(currentlySelectedType); + + // Edit the record 'Title' + const recordTitleEdit = testData.upload.recordTitle(); + console.log(`Editing the record title: ${recordTitleEdit}`); + await uploadPage.fillTitle(recordTitleEdit); + + // Click the 'Publish' button + console.log('Clicking the Publish button...'); + await uploadPage.clickPublish(); + + // Confirm the dialog by clicking 'Publish' button + console.log('Confirming the Publish action...'); + await uploadPage.clickPublishOnConfirmation(); + + // Wait for the record verification after editing + console.log('Verifying record existence after edit...'); + const recordExists = await uploadPage.checkRecordExists(); // Check if the record exists + expect(recordExists).toBe(true); // Assert that the record exists + + // Verify the edited values are correct + console.log('Verifying edited record details...'); + const actualDescription = await uploadPage.getRecordDescription(); + const actualTitle = await uploadPage.getRecordTitle(); + + // Assert that the edited description and title are correct + expect(actualDescription).toBe(recordDescription); + expect(actualTitle).toBe(recordTitleEdit); + + console.log(`Record verification completed. Expected: true, Actual: ${recordExists}`); + }); + +}); \ No newline at end of file diff --git a/.history/tests/edit.spec_20241025142807.ts b/.history/tests/edit.spec_20241025142807.ts new file mode 100644 index 0000000..4ec8442 --- /dev/null +++ b/.history/tests/edit.spec_20241025142807.ts @@ -0,0 +1,81 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('Edit record', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + // Setup: Log in, navigate to the upload page, and upload a file + test.beforeEach(async ({ loggedInPage, uploadFileSuccessfully }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + + // Uncomment the following line if you want to upload a file before each test + //await uploadFileSuccessfully(); + }); + + // Teardown: Take a screenshot on failure + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + console.log(`Teardown complete: Screenshot taken for failed test - ${testInfo.title}.`); + } else { + console.log(`Teardown complete: Test ${testInfo.title} passed.`); + } + }); + + test(qase(12, 'Edit Existing Record'), async () => { // Qase test case ID: + qase.fields({ severity: 'major', priority: 'high' }); // Qase test case values for severity and priority + + // Navigate to 'My Dashboard' + await uploadPage.navigateToMyDashboard(); + + // Open detail page of the first record + await uploadPage.firstRecordDetail(); + + // Click 'Edit' button + console.log('Clicking the Edit button...'); + await uploadPage.clickEdit(); + + // Fill in 'Description' + const recordDescription = testData.upload.recordDescription(); + console.log(`Filling in record description: ${recordDescription}`); + await uploadPage.fillDescription(recordDescription); + + // Change 'Resource type' with fallback value + currentlySelectedType = currentlySelectedType || 'defaultType'; + console.log(`Selecting resource type: ${currentlySelectedType}`); + await uploadPage.changeResourceType(currentlySelectedType); + + // Edit the record 'Title' + const recordTitleEdit = testData.upload.recordTitle(); + console.log(`Editing the record title: ${recordTitleEdit}`); + await uploadPage.fillTitle(recordTitleEdit); + + // Click the 'Publish' button + console.log('Clicking the Publish button...'); + await uploadPage.clickPublish(); + + // Confirm the dialog by clicking 'Publish' button + console.log('Confirming the Publish action...'); + await uploadPage.clickPublishOnConfirmation(); + + // Wait for the record verification after editing + console.log('Verifying record existence after edit...'); + const recordExists = await uploadPage.checkRecordExists(); // Check if the record exists + expect(recordExists).toBe(true); // Assert that the record exists + + // Verify the edited values are correct + console.log('Verifying edited record details...'); + const actualDescription = await uploadPage.getRecordDescription(); + const actualTitle = await uploadPage.getRecordTitle(); + + // Assert that the edited description and title are correct + expect(actualDescription).toBe(recordDescription); + expect(actualTitle).toBe(recordTitleEdit); + + console.log(`Record verification completed. Expected: true, Actual: ${recordExists}`); + }); + +}); \ No newline at end of file diff --git a/.history/tests/newUpload.spec_20241025142641.ts b/.history/tests/newUpload.spec_20241025142641.ts new file mode 100644 index 0000000..0042af7 --- /dev/null +++ b/.history/tests/newUpload.spec_20241025142641.ts @@ -0,0 +1,45 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('New Upload', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + test.beforeEach(async ({ loggedInPage }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + await uploadPage.navigateToUploadSection(); // Navigate to the upload section + }); + + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + } + }); + + test(qase(7, 'Upload a file successfully'), async () => { // Qase test case ID: + // qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + + // Fill in the record details + await uploadPage.fillTitle(testData.upload.recordTitle()); + await uploadPage.fillFamilyName(testData.upload.familyName()); + await uploadPage.selectDOIOption(true); // Adjust this based on your test needs + await uploadPage.selectResourceType(currentlySelectedType); + + // Upload a file + await uploadPage.uploadRandomFile(); + + // Click the Publish button + await uploadPage.clickPublish(); + + // Click the Publish button on the confirmation dialog + await uploadPage.clickPublishOnConfirmation(); + + // Check the title of the new created record in the detail + const recordExists = await uploadPage.checkRecordExists(); + expect(recordExists).toBe(true); // Assert that the record exists + + // await uploadPage.waitForFiveSeconds(); // Waiting 5s during debug + }); +}); \ No newline at end of file diff --git a/.history/tests/newUpload.spec_20241025142646.ts b/.history/tests/newUpload.spec_20241025142646.ts new file mode 100644 index 0000000..82f4c26 --- /dev/null +++ b/.history/tests/newUpload.spec_20241025142646.ts @@ -0,0 +1,45 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('New Upload', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + test.beforeEach(async ({ loggedInPage }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + await uploadPage.navigateToUploadSection(); // Navigate to the upload section + }); + + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + } + }); + + test(qase(7, 'Upload a file successfully'), async () => { // Qase test case ID: + qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + + // Fill in the record details + await uploadPage.fillTitle(testData.upload.recordTitle()); + await uploadPage.fillFamilyName(testData.upload.familyName()); + await uploadPage.selectDOIOption(true); // Adjust this based on your test needs + await uploadPage.selectResourceType(currentlySelectedType); + + // Upload a file + await uploadPage.uploadRandomFile(); + + // Click the Publish button + await uploadPage.clickPublish(); + + // Click the Publish button on the confirmation dialog + await uploadPage.clickPublishOnConfirmation(); + + // Check the title of the new created record in the detail + const recordExists = await uploadPage.checkRecordExists(); + expect(recordExists).toBe(true); // Assert that the record exists + + // await uploadPage.waitForFiveSeconds(); // Waiting 5s during debug + }); +}); \ No newline at end of file diff --git a/.history/tests/newUpload.spec_20241025142829.ts b/.history/tests/newUpload.spec_20241025142829.ts new file mode 100644 index 0000000..410b5b1 --- /dev/null +++ b/.history/tests/newUpload.spec_20241025142829.ts @@ -0,0 +1,45 @@ +import { test, expect } from '../utils/fixtures'; +import { UploadPage } from '../pages/uploadPage'; +import { testData } from '../data/testData'; +import { qase } from 'playwright-qase-reporter'; + +test.describe('New Upload', () => { + let uploadPage: UploadPage; + let currentlySelectedType: string | null = null; // Track the currently selected resource type + + test.beforeEach(async ({ loggedInPage }) => { + uploadPage = new UploadPage(loggedInPage); // Use the logged-in page + await uploadPage.navigateToUploadSection(); // Navigate to the upload section + }); + + test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status === 'failed') { + await page.screenshot({ path: `screenshots/${testInfo.title}.png` }); + } + }); + + test(qase(7, 'Upload a file successfully'), async () => { // Qase test case ID: + qase.fields({ severity: 'major', priority: 'high' }); // Qase test case values for severity and priority + + // Fill in the record details + await uploadPage.fillTitle(testData.upload.recordTitle()); + await uploadPage.fillFamilyName(testData.upload.familyName()); + await uploadPage.selectDOIOption(true); // Adjust this based on your test needs + await uploadPage.selectResourceType(currentlySelectedType); + + // Upload a file + await uploadPage.uploadRandomFile(); + + // Click the Publish button + await uploadPage.clickPublish(); + + // Click the Publish button on the confirmation dialog + await uploadPage.clickPublishOnConfirmation(); + + // Check the title of the new created record in the detail + const recordExists = await uploadPage.checkRecordExists(); + expect(recordExists).toBe(true); // Assert that the record exists + + // await uploadPage.waitForFiveSeconds(); // Waiting 5s during debug + }); +}); \ No newline at end of file diff --git a/tests/edit.spec.ts b/tests/edit.spec.ts index eb218a6..4ec8442 100644 --- a/tests/edit.spec.ts +++ b/tests/edit.spec.ts @@ -25,8 +25,8 @@ test.describe('Edit record', () => { } }); - test(qase(0, 'Edit Existing Record'), async () => { // Qase test case ID: - //qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + test(qase(12, 'Edit Existing Record'), async () => { // Qase test case ID: + qase.fields({ severity: 'major', priority: 'high' }); // Qase test case values for severity and priority // Navigate to 'My Dashboard' await uploadPage.navigateToMyDashboard(); diff --git a/tests/newUpload.spec.ts b/tests/newUpload.spec.ts index 1a351a9..410b5b1 100644 --- a/tests/newUpload.spec.ts +++ b/tests/newUpload.spec.ts @@ -18,8 +18,8 @@ test.describe('New Upload', () => { } }); - test(qase(0, 'Upload a file successfully'), async () => { // Qase test case ID: - // qase.fields({ 'severity': 'major', 'priority': 'high' }); // Qase test case values for severity and priority + test(qase(7, 'Upload a file successfully'), async () => { // Qase test case ID: + qase.fields({ severity: 'major', priority: 'high' }); // Qase test case values for severity and priority // Fill in the record details await uploadPage.fillTitle(testData.upload.recordTitle());