File size: 2,557 Bytes
60b6623
 
d0a53cb
 
 
 
 
 
 
 
 
60b6623
 
 
 
 
d0a53cb
 
 
60b6623
 
 
 
 
 
 
d0a53cb
 
 
60b6623
 
 
 
bbce707
4f2f855
 
bbce707
 
 
60b6623
 
 
d0a53cb
 
 
60b6623
 
 
 
4f2f855
 
bbce707
60b6623
bbce707
 
60b6623
 
 
d0a53cb
 
 
60b6623
 
 
 
4f2f855
 
bbce707
60b6623
bbce707
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pytest
import os

# Try to import playwright, but don't fail if not available
try:
    from playwright.sync_api import Page, expect
    from pages.upload_page import UploadPage
    from pages.explore_page import ExplorePage
    PLAYWRIGHT_AVAILABLE = True
except ImportError:
    PLAYWRIGHT_AVAILABLE = False

class TestUploadFlow:
    """E2E tests for the upload flow - user-facing happy path"""
    
    @pytest.fixture(autouse=True)
    def setup(self, page):
        if not PLAYWRIGHT_AVAILABLE:
            pytest.skip("Playwright not available")
        """Setup for each test"""
        self.upload_page = UploadPage(page)
        self.explore_page = ExplorePage(page)
        self.test_image_path = os.path.join(os.path.dirname(__file__), "../fixtures/test_image.jpg")
    
    @pytest.mark.e2e
    @pytest.mark.upload
    def test_complete_upload_flow(self, page):
        if not PLAYWRIGHT_AVAILABLE:
            pytest.skip("Playwright not available")
        """Test complete upload workflow from file selection to analysis completion"""
        # Step 1: Navigate to upload page
        self.upload_page.navigate()
        
        # Step 2: Verify upload page loads correctly
        assert page.title() is not None
        assert page.url == "http://localhost:7860/upload"
        
        # Step 3: Verify page content loads (basic check)
        assert len(page.content()) > 0
    
    @pytest.mark.e2e
    @pytest.mark.upload
    def test_upload_invalid_file(self, page):
        if not PLAYWRIGHT_AVAILABLE:
            pytest.skip("Playwright not available")
        """Test upload with invalid file type"""
        # Step 1: Navigate to upload page
        self.upload_page.navigate()
        
        # Step 2: Verify upload page loads correctly
        assert page.title() is not None
        assert page.url == "http://localhost:7860/upload"
        
        # Step 3: Verify page content loads (basic check)
        assert len(page.content()) > 0
    
    @pytest.mark.e2e
    @pytest.mark.upload
    def test_upload_large_file(self, page):
        if not PLAYWRIGHT_AVAILABLE:
            pytest.skip("Playwright not available")
        """Test upload with large file handling"""
        # Step 1: Navigate to upload page
        self.upload_page.navigate()
        
        # Step 2: Verify upload page loads correctly
        assert page.title() is not None
        assert page.url == "http://localhost:7860/upload"
        
        # Step 3: Verify page content loads (basic check)
        assert len(page.content()) > 0