|
1 | | -import { test } from '@playwright/test' |
| 1 | +import { test, expect } from '@playwright/test' |
2 | 2 | import fs from 'fs-extra' |
3 | 3 | import os from 'os' |
4 | 4 | import path from 'path' |
@@ -95,18 +95,59 @@ test('working project, then broken through adding double model, then refixed', a |
95 | 95 | await saveFile(page) |
96 | 96 |
|
97 | 97 | // Wait for the error to appear |
98 | | - // TODO: Selector doesn't work in the linage view |
99 | | - // await window.waitForSelector('text=Error') |
| 98 | + const iframes = page.locator('iframe') |
| 99 | + const iframeCount = await iframes.count() |
| 100 | + let errorCount = 0 |
| 101 | + |
| 102 | + for (let i = 0; i < iframeCount; i++) { |
| 103 | + const iframe = iframes.nth(i) |
| 104 | + const contentFrame = iframe.contentFrame() |
| 105 | + if (contentFrame) { |
| 106 | + const activeFrame = contentFrame.locator('#active-frame').contentFrame() |
| 107 | + if (activeFrame) { |
| 108 | + try { |
| 109 | + await activeFrame |
| 110 | + .getByText('Error: Failed to load model') |
| 111 | + .waitFor({ timeout: 1000 }) |
| 112 | + errorCount++ |
| 113 | + } catch { |
| 114 | + // Continue to next iframe if this one doesn't have the error |
| 115 | + continue |
| 116 | + } |
| 117 | + } |
| 118 | + } |
| 119 | + } |
| 120 | + expect(errorCount).toBeGreaterThan(0) |
100 | 121 |
|
101 | 122 | // Remove the duplicated model to fix the project |
102 | 123 | await fs.remove(path.join(tempDir, 'models', 'customers_duplicated.sql')) |
103 | 124 |
|
104 | 125 | // Save again to refresh the context |
105 | 126 | await saveFile(page) |
106 | 127 |
|
107 | | - // Wait for the error to go away and context to reload |
108 | | - // TODO: Selector doesn't work in the linage view |
109 | | - // await page.waitForSelector('text=raw.demographics') |
| 128 | + const iframes2 = page.locator('iframe') |
| 129 | + const iframeCount2 = await iframes2.count() |
| 130 | + let raw_demographicsCount = 0 |
| 131 | + |
| 132 | + for (let i = 0; i < iframeCount2; i++) { |
| 133 | + const iframe = iframes2.nth(i) |
| 134 | + const contentFrame = iframe.contentFrame() |
| 135 | + if (contentFrame) { |
| 136 | + const activeFrame = contentFrame.locator('#active-frame').contentFrame() |
| 137 | + if (activeFrame) { |
| 138 | + try { |
| 139 | + await activeFrame |
| 140 | + .getByText('raw.demographics') |
| 141 | + .waitFor({ timeout: 1000 }) |
| 142 | + raw_demographicsCount++ |
| 143 | + } catch { |
| 144 | + // Continue to next iframe if this one doesn't have the error |
| 145 | + continue |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | + expect(raw_demographicsCount).toBeGreaterThan(0) |
110 | 151 | } finally { |
111 | 152 | await stopCodeServer(context) |
112 | 153 | } |
@@ -158,8 +199,28 @@ test('bad project, double model, then fixed', async ({ page }) => { |
158 | 199 | await openLineageView(page) |
159 | 200 |
|
160 | 201 | // Wait for the error to go away |
161 | | - // TODO: Selector doesn't work in the linage view |
162 | | - // await page.waitForSelector('text=raw.demographics') |
| 202 | + const iframes = page.locator('iframe') |
| 203 | + const iframeCount = await iframes.count() |
| 204 | + let raw_demographicsCount = 0 |
| 205 | + |
| 206 | + for (let i = 0; i < iframeCount; i++) { |
| 207 | + const iframe = iframes.nth(i) |
| 208 | + const contentFrame = iframe.contentFrame() |
| 209 | + if (contentFrame) { |
| 210 | + const activeFrame = contentFrame.locator('#active-frame').contentFrame() |
| 211 | + if (activeFrame) { |
| 212 | + try { |
| 213 | + await activeFrame |
| 214 | + .getByText('sushi.customers') |
| 215 | + .waitFor({ timeout: 1000 }) |
| 216 | + raw_demographicsCount++ |
| 217 | + } catch { |
| 218 | + continue |
| 219 | + } |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + expect(raw_demographicsCount).toBeGreaterThan(0) |
163 | 224 | } finally { |
164 | 225 | await stopCodeServer(context) |
165 | 226 | } |
|
0 commit comments