Skip to content

Commit 574c4fe

Browse files
committed
Use specific iframe selector to avoid Charlotte AI conflict
The Falcon console now includes a Charlotte AI iframe on every page, causing Playwright's strict mode to fail when using the bare 'iframe' selector. Use iframe[name="portal"] to target the Foundry app iframe specifically.
1 parent eacf342 commit 574c4fe

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

e2e/src/pages/CategoryBlockingPage.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class CategoryBlockingPage extends BasePage {
3636
await this.page.reload({ waitUntil: 'networkidle' });
3737
await this.page.waitForTimeout(3000);
3838
}
39-
await expect(this.page.locator('iframe')).toBeVisible({ timeout: 20000 });
39+
await expect(this.page.locator('iframe[name="portal"]')).toBeVisible({ timeout: 20000 });
4040
iframeVisible = true;
4141
} catch (e) {
4242
this.logger.warn(`Iframe not visible on attempt ${attempt + 1}`);
@@ -48,7 +48,7 @@ export class CategoryBlockingPage extends BasePage {
4848
this.logger.success('App iframe is visible');
4949

5050
// Verify app content loaded
51-
const iframe = this.page.frameLocator('iframe');
51+
const iframe = this.page.frameLocator('iframe[name="portal"]');
5252
const heading = iframe.getByRole('heading', { name: /Category Blocking/i });
5353

5454
await expect(heading).toBeVisible({ timeout: 30000 });
@@ -172,7 +172,7 @@ export class CategoryBlockingPage extends BasePage {
172172
await this.retryPageLoadAfter404();
173173
}
174174

175-
const iframe = this.page.locator('iframe');
175+
const iframe = this.page.locator('iframe[name="portal"]');
176176
await iframe.waitFor({ state: 'visible', timeout: 30000 });
177177
await this.verifyPageLoaded();
178178
return true;
@@ -231,7 +231,7 @@ export class CategoryBlockingPage extends BasePage {
231231
async createCustomCategory(categoryName: string, domains: string): Promise<void> {
232232
return this.withTiming(
233233
async () => {
234-
const iframe = this.page.frameLocator('iframe');
234+
const iframe = this.page.frameLocator('iframe[name="portal"]');
235235

236236
// Click Custom Categories tab
237237
const customCategoriesTab = iframe.locator('sl-tab:has-text("Custom Categories") a').first();

e2e/tests/foundry.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test.describe('Category Blocking App E2E Tests', () => {
4646
await categoryBlockingPage.navigateToInstalledApp();
4747

4848
// Verify iframe is present
49-
const iframe = categoryBlockingPage.page.locator('iframe');
49+
const iframe = categoryBlockingPage.page.locator('iframe[name="portal"]');
5050
await expect(iframe).toBeVisible({ timeout: 15000 });
5151

5252
logger.success('Category Blocking app iframe loaded successfully');
@@ -58,7 +58,7 @@ test.describe('Category Blocking App E2E Tests', () => {
5858
await categoryBlockingPage.navigateToInstalledApp();
5959

6060
// Get the iframe
61-
const iframe = page.frameLocator('iframe');
61+
const iframe = page.frameLocator('iframe[name="portal"]');
6262

6363
// Wait for and verify main heading is visible
6464
const heading = iframe.locator('h1:has-text("Category Blocking")');
@@ -78,7 +78,7 @@ test.describe('Category Blocking App E2E Tests', () => {
7878
test('should verify all navigation tabs are present', async ({ page }) => {
7979
await categoryBlockingPage.navigateToInstalledApp();
8080

81-
const iframe = page.frameLocator('iframe');
81+
const iframe = page.frameLocator('iframe[name="portal"]');
8282

8383
// Wait for navigation to be present
8484
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -107,7 +107,7 @@ test.describe('Category Blocking App E2E Tests', () => {
107107
test('should click Custom Categories tab and verify navigation', async ({ page }) => {
108108
await categoryBlockingPage.navigateToInstalledApp();
109109

110-
const iframe = page.frameLocator('iframe');
110+
const iframe = page.frameLocator('iframe[name="portal"]');
111111

112112
// Wait for app to load
113113
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -126,7 +126,7 @@ test.describe('Category Blocking App E2E Tests', () => {
126126
test('should click Domain Analytics tab and verify navigation', async ({ page }) => {
127127
await categoryBlockingPage.navigateToInstalledApp();
128128

129-
const iframe = page.frameLocator('iframe');
129+
const iframe = page.frameLocator('iframe[name="portal"]');
130130

131131
// Wait for app to load
132132
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -145,7 +145,7 @@ test.describe('Category Blocking App E2E Tests', () => {
145145
test('should click Firewall Rules tab and verify navigation', async ({ page }) => {
146146
await categoryBlockingPage.navigateToInstalledApp();
147147

148-
const iframe = page.frameLocator('iframe');
148+
const iframe = page.frameLocator('iframe[name="portal"]');
149149

150150
// Wait for app to load
151151
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -164,7 +164,7 @@ test.describe('Category Blocking App E2E Tests', () => {
164164
test('should click Relationship Graph tab and verify navigation', async ({ page }) => {
165165
await categoryBlockingPage.navigateToInstalledApp();
166166

167-
const iframe = page.frameLocator('iframe');
167+
const iframe = page.frameLocator('iframe[name="portal"]');
168168

169169
// Wait for app to load
170170
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -183,7 +183,7 @@ test.describe('Category Blocking App E2E Tests', () => {
183183
test('should verify all tabs are clickable in sequence', async ({ page }) => {
184184
await categoryBlockingPage.navigateToInstalledApp();
185185

186-
const iframe = page.frameLocator('iframe');
186+
const iframe = page.frameLocator('iframe[name="portal"]');
187187

188188
// Wait for app to load
189189
await expect(iframe.locator('h1:has-text("Category Blocking")')).toBeVisible({ timeout: 15000 });
@@ -217,11 +217,11 @@ test.describe('Category Blocking App E2E Tests', () => {
217217
await categoryBlockingPage.navigateToInstalledApp();
218218

219219
// Verify iframe is present and visible
220-
const iframe = page.locator('iframe');
220+
const iframe = page.locator('iframe[name="portal"]');
221221
await expect(iframe).toBeVisible({ timeout: 15000 });
222222

223223
// Get the iframe locator for content checks
224-
const iframeContent = page.frameLocator('iframe');
224+
const iframeContent = page.frameLocator('iframe[name="portal"]');
225225

226226
// Verify main content loaded
227227
const heading = iframeContent.locator('h1:has-text("Category Blocking")');

0 commit comments

Comments
 (0)