Skip to content

Commit

Permalink
add params
Browse files Browse the repository at this point in the history
  • Loading branch information
brablcp committed Oct 25, 2024
1 parent 510544f commit 20c9a7a
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 4 deletions.
81 changes: 81 additions & 0 deletions .history/tests/edit.spec_20241025142446.ts
Original file line number Diff line number Diff line change
@@ -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}`);
});

});
81 changes: 81 additions & 0 deletions .history/tests/edit.spec_20241025142458.ts
Original file line number Diff line number Diff line change
@@ -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}`);
});

});
81 changes: 81 additions & 0 deletions .history/tests/edit.spec_20241025142807.ts
Original file line number Diff line number Diff line change
@@ -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}`);
});

});
45 changes: 45 additions & 0 deletions .history/tests/newUpload.spec_20241025142641.ts
Original file line number Diff line number Diff line change
@@ -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
});
});
45 changes: 45 additions & 0 deletions .history/tests/newUpload.spec_20241025142646.ts
Original file line number Diff line number Diff line change
@@ -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
});
});
45 changes: 45 additions & 0 deletions .history/tests/newUpload.spec_20241025142829.ts
Original file line number Diff line number Diff line change
@@ -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
});
});
Loading

0 comments on commit 20c9a7a

Please sign in to comment.