adding the new pages
This commit is contained in:
parent
73b6671798
commit
393fdfddd5
2 changed files with 997 additions and 174 deletions
|
|
@ -49,17 +49,60 @@ describe('Supplier Portal Onboarding & Active Dashboard Tests', () => {
|
|||
const emailInput = screen.getByLabelText(/Business Email \*/i)
|
||||
const phoneInput = screen.getByLabelText(/Mobile Number \*/i)
|
||||
const passInput = screen.getByLabelText(/Create Password \*/i)
|
||||
const taxInput = screen.getByLabelText(/GSTIN \/ Tax ID \*/i)
|
||||
|
||||
fireEvent.change(emailInput, { target: { value: 'seller@example.com' } })
|
||||
fireEvent.change(phoneInput, { target: { value: '9876543210' } })
|
||||
fireEvent.change(passInput, { target: { value: 'password123' } })
|
||||
fireEvent.change(taxInput, { target: { value: '29AAAAA1111A1Z1' } })
|
||||
|
||||
const alertMock = vi.spyOn(window, 'alert').mockImplementation(() => {})
|
||||
|
||||
const registerBtn = screen.getByRole('button', { name: /Register Business/i })
|
||||
fireEvent.click(registerBtn)
|
||||
|
||||
expect(screen.getByText('Step 2 of 3: Business Details')).toBeInTheDocument()
|
||||
// Step 1: Contact Verification
|
||||
expect(screen.getByText(/Step 1 of 3: Contact Verification/i)).toBeInTheDocument()
|
||||
|
||||
const sendWhatsappBtn = screen.getByText(/Send WhatsApp OTP/i)
|
||||
fireEvent.click(sendWhatsappBtn)
|
||||
|
||||
const whatsappCodeInput = screen.getByPlaceholderText(/Enter 123456/i)
|
||||
fireEvent.change(whatsappCodeInput, { target: { value: '123456' } })
|
||||
const verifyWhatsappBtn = screen.getByRole('button', { name: /Verify Code/i })
|
||||
fireEvent.click(verifyWhatsappBtn)
|
||||
|
||||
const sendEmailBtn = screen.getByText(/Send Email OTP/i)
|
||||
fireEvent.click(sendEmailBtn)
|
||||
|
||||
// There are now multiple placeholder elements with "Enter 123456". Let's fetch the visible inputs.
|
||||
const codeInputs = screen.getAllByPlaceholderText(/Enter 123456/i)
|
||||
fireEvent.change(codeInputs[codeInputs.length - 1], { target: { value: '123456' } })
|
||||
const verifyButtons = screen.getAllByRole('button', { name: /Verify Code/i })
|
||||
fireEvent.click(verifyButtons[verifyButtons.length - 1])
|
||||
|
||||
const nextStep1Btn = screen.getByRole('button', { name: /Next Step: Identity Verification/i })
|
||||
fireEvent.click(nextStep1Btn)
|
||||
|
||||
// Step 2: Tax & Identity Verification
|
||||
expect(screen.getByText(/Step 2 of 3: Tax & Identity Verification/i)).toBeInTheDocument()
|
||||
|
||||
const taxInput = screen.getByLabelText(/GSTIN Number \*/i)
|
||||
fireEvent.change(taxInput, { target: { value: '29AAAAA1111A1Z1' } })
|
||||
const verifyGstinBtn = screen.getByRole('button', { name: /Verify GSTIN/i })
|
||||
fireEvent.click(verifyGstinBtn)
|
||||
|
||||
// Upload files
|
||||
const aadharInput = screen.getByLabelText(/Aadhaar Card Upload \*/i)
|
||||
const panInput = screen.getByLabelText(/PAN Card Upload \*/i)
|
||||
|
||||
// Trigger file changes
|
||||
fireEvent.change(aadharInput, { target: { files: [{ name: 'aadhar_card.pdf' }] } })
|
||||
fireEvent.change(panInput, { target: { files: [{ name: 'pan_card.pdf' }] } })
|
||||
|
||||
const nextStep2Btn = screen.getByRole('button', { name: /Next Step: Store & Location/i })
|
||||
fireEvent.click(nextStep2Btn)
|
||||
|
||||
// Step 3: Store Details & Location Map
|
||||
expect(screen.getByText(/Step 3 of 3: Store & Pickup Location/i)).toBeInTheDocument()
|
||||
|
||||
const storeNameInput = screen.getByLabelText(/Store Display Name \*/i)
|
||||
fireEvent.change(storeNameInput, { target: { value: 'Crafty Store' } })
|
||||
|
|
@ -67,22 +110,41 @@ describe('Supplier Portal Onboarding & Active Dashboard Tests', () => {
|
|||
const bioText = screen.getByLabelText(/About Your Craft \/ Business \*/i)
|
||||
fireEvent.change(bioText, { target: { value: 'Handmade pottery.' } })
|
||||
|
||||
const streetInput = screen.getByPlaceholderText('Street Address')
|
||||
const cityInput = screen.getByPlaceholderText('City')
|
||||
const stateInput = screen.getByPlaceholderText('State')
|
||||
const pincodeInput = screen.getByPlaceholderText('Pincode')
|
||||
const streetInput = screen.getByLabelText(/Location in Text \(Address\) \*/i)
|
||||
const cityInput = screen.getByLabelText(/City \*/i)
|
||||
const pincodeInput = screen.getByLabelText(/Pincode \*/i)
|
||||
|
||||
fireEvent.change(streetInput, { target: { value: '123 Loom Lane' } })
|
||||
fireEvent.change(cityInput, { target: { value: 'Handloom City' } })
|
||||
fireEvent.change(stateInput, { target: { value: 'Karnataka' } })
|
||||
fireEvent.change(pincodeInput, { target: { value: '560001' } })
|
||||
|
||||
const saveBtn = screen.getByRole('button', { name: /Save & Continue/i })
|
||||
fireEvent.click(saveBtn)
|
||||
const submitBtn = screen.getByRole('button', { name: /Submit Supplier Profile/i })
|
||||
fireEvent.click(submitBtn)
|
||||
|
||||
// Redirects directly to Dashboard Page
|
||||
// Welcome Page & Setup Tour
|
||||
expect(screen.getByText(/Welcome to Global Artisans Hub!/i)).toBeInTheDocument()
|
||||
|
||||
// Complete tour steps
|
||||
const startTourBtn = screen.getByRole('button', { name: /Start Tour/i })
|
||||
fireEvent.click(startTourBtn)
|
||||
|
||||
const next1 = screen.getByRole('button', { name: /Next: Order Management/i })
|
||||
fireEvent.click(next1)
|
||||
|
||||
const next2 = screen.getByRole('button', { name: /Next: Barcode Generation/i })
|
||||
fireEvent.click(next2)
|
||||
|
||||
const next3 = screen.getByRole('button', { name: /Next: Earnings & Wallet/i })
|
||||
fireEvent.click(next3)
|
||||
|
||||
const finishBtn = screen.getByRole('button', { name: /Launch Dashboard 🚀/i })
|
||||
fireEvent.click(finishBtn)
|
||||
|
||||
// Redirects to Dashboard Page
|
||||
expect(screen.getByText('Performance Analytics')).toBeInTheDocument()
|
||||
expect(screen.getByText(/Total Sales Volume/i)).toBeInTheDocument()
|
||||
|
||||
alertMock.mockRestore()
|
||||
})
|
||||
|
||||
it('logs in successfully and navigates dashboard tools', () => {
|
||||
|
|
|
|||
1085
src/App.tsx
1085
src/App.tsx
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue