supplier_central_frontend/cypress/e2e/onboarding.cy.ts
vickytechkey 1bb45cdee0
All checks were successful
Beta CI/CD Pipeline / build-and-test (push) Successful in 44s
Beta CI/CD Pipeline / deploy-beta (push) Successful in 6s
update cypress:run to use headed mode
2026-08-09 11:28:41 +05:30

101 lines
4.6 KiB
TypeScript

describe('Supplier Portal Onboarding & Feature E2E Flow', () => {
it('completes the registration, contact verification, document upload, location pinning, welcome tour, order acceptance, and barcode generation', () => {
// 1. Visit Landing Page
cy.visit('/');
cy.contains('Sell Globally.').should('be.visible');
// 2. Registration Page
cy.contains('Get Started Today').click();
cy.get('input#reg-email').type('test_seller@example.com');
cy.get('input#reg-phone').type('9876543210');
cy.get('input#reg-pass').type('super_secure_pass_123');
cy.get('button').contains('Register Business').click();
// 3. Step 1: Contact Verification
cy.contains('Step 1 of 3: Contact Verification').should('be.visible');
cy.contains('Send WhatsApp OTP').click();
cy.get('input[placeholder="Enter 123456"]').first().type('123456');
cy.contains('Verify Code').first().click();
cy.contains('✓ Mobile & WhatsApp Verified').should('be.visible');
cy.contains('Send Email OTP').click();
cy.get('input[placeholder="Enter 123456"]').last().type('123456');
cy.contains('Verify Code').last().click();
cy.contains('✓ Email Verified').should('be.visible');
cy.contains('Next Step: Identity Verification').click();
// 4. Step 2: Tax & Identity Verification
cy.contains('Step 2 of 3: Tax & Identity Verification').should('be.visible');
cy.get('input#verify-gst').clear().type('29AAAAA1111A1Z1');
cy.contains('Verify GSTIN').click();
cy.contains('GSTIN successfully verified with government registry.').should('be.visible');
// Upload mock Aadhaar & PAN files
cy.get('input#aadhar-upload').selectFile({
contents: Cypress.Buffer.from('mock aadhaar pdf'),
fileName: 'aadhar_card.pdf',
mimeType: 'application/pdf',
}, { force: true });
cy.contains('Selected: aadhar_card.pdf').should('be.visible');
cy.get('input#pan-upload').selectFile({
contents: Cypress.Buffer.from('mock pan pdf'),
fileName: 'pan_card.pdf',
mimeType: 'application/pdf',
}, { force: true });
cy.contains('Selected: pan_card.pdf').should('be.visible');
cy.contains('Next Step: Store & Location').click();
// 5. Step 3: Store & Pickup Location Setup
cy.contains('Step 3 of 3: Store & Pickup Location').should('be.visible');
cy.get('input#store-name').clear().type('Teak Wood Craft Store');
cy.get('textarea#store-bio').clear().type('Teak wood hand-carved home decor elements.');
// Test interactive map coordinate pinning
cy.contains('Store Location on Map *').should('be.visible');
cy.get('span').contains('Click anywhere on the map grid to pin location').parent().click(100, 80);
cy.contains('Coordinates: Lat').should('be.visible');
cy.get('input#location-text').should('not.have.value', '');
cy.get('input#loc-city').clear().type('Bangalore');
cy.get('input#loc-pincode').clear().type('560001');
cy.contains('Submit Supplier Profile').click();
// 6. Setup Welcome Tour Stepper
cy.contains('Welcome to Global Artisans Hub! 🎉').should('be.visible');
cy.contains('Start Tour').click();
cy.contains('📦 Products & Inventory Management').should('be.visible');
cy.contains('Next: Order Management').click();
cy.contains('🚚 Order Acceptance Control').should('be.visible');
cy.contains('Next: Barcode Generation').click();
cy.contains('🏷️ Barcode Identification & Tracking').should('be.visible');
cy.contains('Next: Earnings & Wallet').click();
cy.contains('💼 Wallet & Payout Withdrawals').should('be.visible');
cy.contains('Launch Dashboard 🚀').click();
// 7. Check Active Dashboard Tab
cy.contains('Performance Analytics').should('be.visible');
// 8. Manage Products tab & Bulk template download
cy.contains('Manage Products').click();
cy.contains('Active Inventory').should('be.visible');
cy.contains('📥 Download Sample Excel Template').click();
// 9. Orders Acceptance Flow
cy.contains('Orders & Transit').click();
cy.contains('Active Orders & Payout status').should('be.visible');
cy.contains('Pending Acceptance').should('be.visible');
cy.get('button').contains('Accept').first().click();
cy.contains('Ready to Ship').should('be.visible');
// 10. Barcode Generator
cy.contains('Barcode Generator').click();
cy.contains('Product Barcode Generator').should('be.visible');
cy.get('select#barcode-product').select(1);
cy.contains('Generate Barcode Graphic').click();
cy.contains('Generated Barcode Preview').should('be.visible');
cy.contains('Print Label').should('be.visible');
cy.contains('Download SVG').should('be.visible');
});
});