Disable old test

This commit is contained in:
Nantawat Sukrisunt 2024-11-03 19:57:39 +07:00
parent 3bc6159618
commit 6158bbac14
4 changed files with 198 additions and 198 deletions

View File

@ -1,107 +1,107 @@
import { test, expect, Page } from '@playwright/test'; // import { test, expect, Page } from '@playwright/test';
//
test.use({ // test.use({
storageState: './storageState.json', // storageState: './storageState.json',
}); // });
//
test('Investment process test', async ({ page }) => { // test('Investment process test', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/'); // await page.goto('http://127.0.0.1:3000/');
//
// Navigate to the investment page // // Navigate to the investment page
// await page.getByRole('link', { name: 'Card image NVDA Founded in' }).click(); // // await page.getByRole('link', { name: 'Card image NVDA Founded in' }).click();
await page.click('a[href="/invest"]'); // await page.click('a[href="/invest"]');
await page.getByRole('button', { name: 'Invest in NVIDIA' }).click(); // await page.getByRole('button', { name: 'Invest in NVIDIA' }).click();
//
// Fill investment amount // // Fill investment amount
await fillInvestmentAmount(page, '10000'); // await fillInvestmentAmount(page, '10000');
//
// Fill card information // // Fill card information
await fillCardInformation(page, { // await fillCardInformation(page, {
name: 'Dummy', // name: 'Dummy',
city: 'Bangkok', // city: 'Bangkok',
cardNumber: '4111 1111 1111 1111', // cardNumber: '4111 1111 1111 1111',
expirationMonth: 'August', // expirationMonth: 'August',
expirationYear: '2032', // expirationYear: '2032',
cvc: '111', // cvc: '111',
}); // });
//
// Accept terms // // Accept terms
await acceptTerms(page, [ // await acceptTerms(page, [
'Minimum Investment', // 'Minimum Investment',
'Investment Horizon', // 'Investment Horizon',
'Fees', // 'Fees',
'Returns', // 'Returns',
]); // ]);
//
// Click Invest button and confirm // // Click Invest button and confirm
await page.getByRole('button', { name: 'Invest' }).click(); // await page.getByRole('button', { name: 'Invest' }).click();
await page.getByRole('button', { name: 'Confirm' }).click(); // await page.getByRole('button', { name: 'Confirm' }).click();
//
// Ensure error message is displayed when not all terms are accepted // // Ensure error message is displayed when not all terms are accepted
await ensureErrorMessageDisplayed(page, 'Please accept all terms'); // await ensureErrorMessageDisplayed(page, 'Please accept all terms');
//
// Close the error dialog // // Close the error dialog
await closeErrorDialog(page); // await closeErrorDialog(page);
//
// Accept remaining terms // // Accept remaining terms
await acceptTerms(page, [ // await acceptTerms(page, [
'Risk Disclosure', // 'Risk Disclosure',
'Withdrawal Policy', // 'Withdrawal Policy',
]); // ]);
//
// Click Invest button and confirm again // // Click Invest button and confirm again
await page.getByRole('button', { name: 'Invest' }).click(); // await page.getByRole('button', { name: 'Invest' }).click();
await page.getByRole('button', { name: 'Confirm' }).click(); // await page.getByRole('button', { name: 'Confirm' }).click();
//
// Ensure that success toast is displayed when investment is successful // // Ensure that success toast is displayed when investment is successful
await expect( // await expect(
page.locator('div[role="status"][aria-live="polite"]').filter({ hasText: /^You successfully invested!$/ }) // page.locator('div[role="status"][aria-live="polite"]').filter({ hasText: /^You successfully invested!$/ })
).toBeVisible(); // ).toBeVisible();
//
// Helper functions // // Helper functions
async function fillInvestmentAmount(page: Page, amount: string): Promise<void> { // async function fillInvestmentAmount(page: Page, amount: string): Promise<void> {
await page.getByPlaceholder('min $').click(); // await page.getByPlaceholder('min $').click();
await page.getByPlaceholder('min $').fill(amount); // await page.getByPlaceholder('min $').fill(amount);
} // }
//
interface CardInfo { // interface CardInfo {
name: string; // name: string;
city: string; // city: string;
cardNumber: string; // cardNumber: string;
expirationMonth: string; // expirationMonth: string;
expirationYear: string; // expirationYear: string;
cvc: string; // cvc: string;
} // }
//
async function fillCardInformation( // async function fillCardInformation(
page: Page, // page: Page,
{ name, city, cardNumber, expirationMonth, expirationYear, cvc }: CardInfo // { name, city, cardNumber, expirationMonth, expirationYear, cvc }: CardInfo
): Promise<void> { // ): Promise<void> {
await page.getByPlaceholder('First Last').click(); // await page.getByPlaceholder('First Last').click();
await page.getByPlaceholder('First Last').fill(name); // await page.getByPlaceholder('First Last').fill(name);
await page.getByLabel('City').click(); // await page.getByLabel('City').click();
await page.getByLabel('City').fill(city); // await page.getByLabel('City').fill(city);
await page.getByLabel('Card number').click(); // await page.getByLabel('Card number').click();
await page.getByLabel('Card number').fill(cardNumber); // await page.getByLabel('Card number').fill(cardNumber);
await page.getByLabel('Month').click(); // await page.getByLabel('Month').click();
await page.getByText(expirationMonth).click(); // await page.getByText(expirationMonth).click();
await page.getByLabel('Year').click(); // await page.getByLabel('Year').click();
await page.getByLabel(expirationYear).click(); // await page.getByLabel(expirationYear).click();
await page.getByPlaceholder('CVC').click(); // await page.getByPlaceholder('CVC').click();
await page.getByPlaceholder('CVC').fill(cvc); // await page.getByPlaceholder('CVC').fill(cvc);
} // }
//
async function acceptTerms(page: Page, terms: string[]): Promise<void> { // async function acceptTerms(page: Page, terms: string[]): Promise<void> {
for (const term of terms) { // for (const term of terms) {
await page.getByRole('row', { name: new RegExp(term) }).getByRole('checkbox').check(); // await page.getByRole('row', { name: new RegExp(term) }).getByRole('checkbox').check();
} // }
} // }
//
async function ensureErrorMessageDisplayed(page: Page, message: string): Promise<void> { // async function ensureErrorMessageDisplayed(page: Page, message: string): Promise<void> {
await expect(page.getByText(message)).toBeVisible(); // await expect(page.getByText(message)).toBeVisible();
} // }
//
async function closeErrorDialog(page: Page): Promise<void> { // async function closeErrorDialog(page: Page): Promise<void> {
await page.getByRole('button', { name: 'Close' }).first().click(); // await page.getByRole('button', { name: 'Close' }).first().click();
} // }
}); // });

View File

@ -1,23 +1,23 @@
import { test, expect } from "@playwright/test"; // import { test, expect } from "@playwright/test";
//
test.use({ // test.use({
storageState: "./storageState.json", // storageState: "./storageState.json",
}); // });
//
test("Test search businesses", async ({ page }) => { // test("Test search businesses", async ({ page }) => {
await page.goto("http://127.0.0.1:3000/"); // await page.goto("http://127.0.0.1:3000/");
await page.getByLabel("Main").getByRole("img").click(); // await page.getByLabel("Main").getByRole("img").click();
//
const businessInput = page.getByPlaceholder("Enter business name..."); // const businessInput = page.getByPlaceholder("Enter business name...");
await expect(businessInput).toBeVisible(); // await expect(businessInput).toBeVisible();
await businessInput.fill("neon"); // await businessInput.fill("Project Blackwell");
await businessInput.press("Enter"); // await businessInput.press("Enter");
//
const heading = page.getByRole("heading", { name: "Neon Solution, A dummy company" }); // const heading = page.getByRole("heading", { name: "Project Blackwell" });
await expect(heading).toBeVisible(); // await expect(heading).toBeVisible();
await heading.click(); // await heading.click();
//
const fundSection = page.locator("div").filter({ hasText: /^Neon Raising Fund$/ }); // const fundSection = page.locator("div").filter({ hasText: /^Project Blackwell$/ });
await expect(fundSection).toBeVisible(); // await expect(fundSection).toBeVisible();
await fundSection.click(); // await fundSection.click();
}); // });

View File

@ -1,26 +1,26 @@
import { test, expect } from '@playwright/test'; // import { test, expect } from '@playwright/test';
test.use({ // test.use({
storageState: './storageState.json' // storageState: './storageState.json'
}); // });
//
test('Test dashboard visibility', async ({ page }) => { // test('Test dashboard visibility', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/dashboard'); // await page.goto('http://127.0.0.1:3000/dashboard');
//
const dashboardHeading = page.locator('h2', { hasText: 'Dashboard' }); // const dashboardHeading = page.locator('h2', { hasText: 'Dashboard' });
await expect(dashboardHeading).toBeVisible(); // await expect(dashboardHeading).toBeVisible();
//
const profileViewHeading = page.locator('h3', { hasText: 'Profile Views' }); // const profileViewHeading = page.locator('h3', { hasText: 'Profile Views' });
await expect(profileViewHeading).toBeVisible(); // await expect(profileViewHeading).toBeVisible();
//
const totalFollowerHeading = page.locator('h3', { hasText: 'Total Followers' }); // const totalFollowerHeading = page.locator('h3', { hasText: 'Total Followers' });
await expect(totalFollowerHeading).toBeVisible(); // await expect(totalFollowerHeading).toBeVisible();
//
const fundsRaisedHeading = page.locator('h3', { hasText: 'Total Funds Raised' }); // const fundsRaisedHeading = page.locator('h3', { hasText: 'Total Funds Raised' });
await expect(fundsRaisedHeading).toBeVisible(); // await expect(fundsRaisedHeading).toBeVisible();
//
const overviewHeading = page.locator('h3', { hasText: 'Overview' }); // const overviewHeading = page.locator('h3', { hasText: 'Overview' });
await expect(overviewHeading).toBeVisible(); // await expect(overviewHeading).toBeVisible();
//
const recentFundHeading = page.locator('h3', { hasText: 'Recent Funds' }); // const recentFundHeading = page.locator('h3', { hasText: 'Recent Funds' });
await expect(recentFundHeading).toBeVisible(); // await expect(recentFundHeading).toBeVisible();
}); // });

View File

@ -1,42 +1,42 @@
import { test, expect } from '@playwright/test'; // import { test, expect } from '@playwright/test';
//
test.use({ // test.use({
storageState: './storageState.json' // storageState: './storageState.json'
}); // });
//
test('Test filter with tags', async ({ page }) => { // test('Test filter with tags', async ({ page }) => {
await page.goto('http://127.0.0.1:3000/'); // await page.goto('http://127.0.0.1:3000/');
//
// Start Investing // // Start Investing
await page.getByRole('button', { name: 'Start Investing' }).click(); // await page.getByRole('button', { name: 'Start Investing' }).click();
//
// Filter by AI tag // // Filter by AI tag
await page.locator('button').filter({ hasText: 'Tags' }).click(); // await page.locator('button').filter({ hasText: 'Tags' }).click();
await page.getByLabel('AI', { exact: true }).click(); // await page.getByLabel('AI', { exact: true }).click();
const aiTag = page.locator('span#tag', { hasText: 'AI' }); // const aiTag = page.locator('span#tag', { hasText: 'AI' });
await expect(aiTag).toBeVisible(); // await expect(aiTag).toBeVisible();
//
// Filter by Technology tag // // Filter by Technology tag
await page.locator('button').filter({ hasText: 'AI' }).click(); // await page.locator('button').filter({ hasText: 'AI' }).click();
await page.getByLabel('Technology').click(); // await page.getByLabel('Technology').click();
const techTag = page.locator('span#tag', { hasText: 'Technology' }); // const techTag = page.locator('span#tag', { hasText: 'Technology' });
await expect(techTag).toBeVisible(); // await expect(techTag).toBeVisible();
//
// Filter by Consumer Electronics tag // // Filter by Consumer Electronics tag
await page.locator('button').filter({ hasText: 'Technology' }).click(); // await page.locator('button').filter({ hasText: 'Technology' }).click();
await page.getByLabel('Consumer Electronics').click(); // await page.getByLabel('Consumer Electronics').click();
const consumerElectronicsTag = page.locator('span#tag', { hasText: 'Consumer Electronics' }); // const consumerElectronicsTag = page.locator('span#tag', { hasText: 'Consumer Electronics' });
await expect(consumerElectronicsTag).toBeVisible(); // await expect(consumerElectronicsTag).toBeVisible();
//
// Filter by Software tag // // Filter by Software tag
await page.locator('button').filter({ hasText: 'Consumer Electronics' }).click(); // await page.locator('button').filter({ hasText: 'Consumer Electronics' }).click();
await page.getByLabel('Software').click(); // await page.getByLabel('Software').click();
const softwareTag = page.locator('span#tag', { hasText: 'Software' }); // const softwareTag = page.locator('span#tag', { hasText: 'Software' });
await expect(softwareTag).toBeVisible(); // await expect(softwareTag).toBeVisible();
//
// Filter by Internet tag // // Filter by Internet tag
await page.locator('button').filter({ hasText: 'Software' }).click(); // await page.locator('button').filter({ hasText: 'Software' }).click();
await page.getByLabel('Internet').click(); // await page.getByLabel('Internet').click();
const internetTag = page.locator('span#tag', { hasText: 'Internet' }); // const internetTag = page.locator('span#tag', { hasText: 'Internet' });
await expect(internetTag).toBeVisible(); // await expect(internetTag).toBeVisible();
}); // });