-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
382 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
}); |
Oops, something went wrong.