Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added video upload test #2

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ui_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: run playwright
id: tests
run: TESTPARAM='${{ secrets.TESTING_MAIL_PASSWORD }}' npx playwright test --project=firefox --workers=4
run: TESTPARAM='${{ secrets.TESTING_MAIL_PASSWORD }}' npx playwright test --project=firefox --workers=5
continue-on-error: true

# add playwright test report artifact to pipeline
Expand Down
19 changes: 19 additions & 0 deletions .pwcodegen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {
await page.goto('https://yral.com/');
await page.goto('https://yral.com/hot-or-not/3o3gd-uqaaa-aaaal-qecyq-cai/1');
await page.getByRole('link').nth(2).click();
await page.getByRole('navigation').getByRole('link').nth(2).click();
await page.getByRole('link').nth(2).press('Control+Shift+I');
await page.getByText('Upload Click to upload or').click();
await page.getByLabel('NSFW').press('Control+Shift+I');
await page.getByText('Upload Click to upload or').click({
button: 'right'
});
await page.goto('https://yral.com/upload');
await page.getByText('Click to upload or drag and drop Video File (Max 60s)').click();
await page.locator('body').setInputFiles('test4.mp4');
await page.locator('video').click();
await page.locator('video').setInputFiles('test4.mp4');
});
1 change: 1 addition & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const { defineConfig, devices } = require('@playwright/test');
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
timeout: 50000,
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
Expand Down
Binary file removed test1.mp4
Binary file not shown.
Binary file added test4.mp4
Binary file not shown.
115 changes: 42 additions & 73 deletions tests/example.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,98 +140,67 @@ test.describe('New test', () => {
}
});

// test('TEST UPLOAD FLOW', async ({page}) => {
test('TEST UPLOAD FLOW', async ({page}) => {

// // login from wallet: using headfull mode
// console.log('Uploading test');

// await page.waitForTimeout(2000);
// login from wallet: using headfull mode
console.log('Uploading test');

// await page.getByRole('navigation').getByRole('link').nth(2).click();
await page.waitForTimeout(2000);

// await page.setInputFiles('#dropzone-file', './test3.mp4');
await page.getByRole('navigation').getByRole('link').nth(2).click();

// // TODO
// // //endpoint to fetch the response
// // const response = await fetch('https://yral.com/api/stream_to_offchain_agent11958048345285885967');
// // console.log(response);
// // const responseData = await response.json();

// // console.log(responseData);
// // // Perform assertions based on the API response
// // expect(responseData.status).toBe(200);
await page.setInputFiles('#dropzone-file', './test4.mp4');

// await page.getByPlaceholder('Write your description here..').click();
// await page.getByPlaceholder('Write your description here..').fill('Monica Dance video');
// await page.getByPlaceholder('#hashtag1,#hashtag2,#hashtag3').click();
// await page.getByPlaceholder('#hashtag1,#hashtag2,#hashtag3').fill('#try');
// TODO
// //endpoint to fetch the response
// const response = await fetch('https://yral.com/api/stream_to_offchain_agent11958048345285885967');
// console.log(response);
// // const responseData = await response.json();

// // const button =
// // await button.click('button[data-api-trigger="true"]');
// console.log(response.status);
// // Perform assertions based on the API response
// // expect(response.status).toBe(200);

// await page.getByRole('button', { name: 'Upload Video' }).click();

// console.log('Uploading .. .. ..');
await page.getByPlaceholder('Write your description here..').click();
await page.getByPlaceholder('Write your description here..').fill('Dance video');
await page.getByPlaceholder('#hashtag1,#hashtag2,#hashtag3').click();
await page.getByPlaceholder('#hashtag1,#hashtag2,#hashtag3').fill('#try');

// //wait for upload to complete, Continue Browsing button to appear
// // await page.waitForSelector('button[name="Continue Browsing"]', { state: 'visible' });
// const button =
// await button.click('button[data-api-trigger="true"]');

// // Wait for the button with the name 'Continue Browsing' to become clickable
// await page.waitForFunction(() => {
// const button = document.querySelector('button[name="Continue Browsing"]');
// return button && !button.disabled;
// });
await page.getByRole('button', { name: 'Upload Video' }).click();

// // await page.waitForTimeout(20000);

// // await getByRole('button', { name: 'Continue Browsing' }).click();
// // // await page.pause();

// console.log('Uploaded succesfully');

// // await button.click('button[data-api-trigger="true"]');
console.log('Uploading .. .. ..');

// await page.getByRole('navigation').getByRole('link').first().click();
// await page.waitForTimeout(5000);
// await page.waitForTimeout(20000);
await page.waitForSelector('text=Publishing', {
state: 'visible'
});

// });
// console.log('Publishing .. .. ..');

// //test like functionality
// test('Test like', async ({page}) => {

// // login from wallet: using headfull mode
// // try {
// console.log('test like');

// await page.waitForTimeout(1000);

// let likes_locator = page.locator('.flex > div:nth-child(2) > .flex > .text-sm').first();
// let total_likes = await likes_locator.textContent();
// console.log("total likes: ", total_likes );

// await page.waitForTimeout(15000);
// Wait for the button to become enabled
const continueButton = page.getByRole('button', { name: 'Continue Browsing' });
await continueButton.waitFor({ state: 'attached' }); // Key line

// Click the enabled button
await continueButton.click();

// await expect(page.locator('button').first()).toBeVisible();
// console.log('like button visible');
//wait for upload to complete, Continue Browsing button to appear
// await page.waitForSelector('button[name="Continue Browsing"]', { state: 'visible' });
// await getByRole('button', { name: 'Continue Browsing' }).click();
// await page.pause();

// //click like button
// await page.locator('button').first().click();
// // await page.locator('body > main > div.h-full.w-full.overflow-hidden.overflow-y-auto > div > div:nth-child(2) > div > div.flex.flex-row.flex-nowrap.justify-between.items-end.pb-16.px-2.md\:px-6.w-full.text-white.absolute.bottom-0.left-0.bg-transparent.z-\[4\] > div.flex.flex-col.gap-6.items-end.w-3\/12.text-4xl > div > button > svg > path').click();
// await page.waitForTimeout(2000);
console.log('Uploaded succesfully');

// let new_likes_locator = page.locator('.flex > div:nth-child(2) > .flex > .text-sm').first();
// let updated_likes = await new_likes_locator.textContent();
// console.log("updated total likes: ", updated_likes );
// await button.click('button[data-api-trigger="true"]');

// expect(parseInt(updated_likes)).toBe(parseInt(total_likes) + 1);
// // let new_like_count = expect(page.getByRole('main'));
// // console.log("new like count: ", new_like_count );
await page.getByRole('navigation').getByRole('link').first().click();
// await page.waitForTimeout(5000);

// // await expect(page.getByRole('main')).toContainText(like_count + 1);
});

// // } catch (error) {
// // console.error("error in login");
// // }
// });

});
Loading