Skip to content

Commit 898504d

Browse files
FTR: Enable w3c for chromedriver (#62542)
* enable w3c for chrome * update maps tests * update maps tests * update common_page * Revert "update maps tests" This reverts commit 31f43fd. * revert changes to maps tests * undo after removal * update expect range to pass on Windows, unskip tests for Firefox * print out value for discover brushing test * log first timestamp Co-authored-by: Elastic Machine <[email protected]>
1 parent b7d0557 commit 898504d

File tree

4 files changed

+21
-60
lines changed

4 files changed

+21
-60
lines changed

test/functional/apps/discover/_discover.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default function({ getService, getPageObjects }) {
4444
});
4545

4646
describe('query', function() {
47-
this.tags(['skipFirefox']);
4847
const queryName1 = 'Query # 1';
4948

5049
it('should show correct time range string by timepicker', async function() {
@@ -100,9 +99,10 @@ export default function({ getService, getPageObjects }) {
10099
const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
101100
expect(Math.round(newDurationHours)).to.be(25);
102101
const rowData = await PageObjects.discover.getDocTableField(1);
102+
log.debug(`The first timestamp value in doc table: ${rowData}`);
103103
expect(Date.parse(rowData)).to.be.within(
104-
Date.parse('Sep 20, 2015 @ 22:00:00.000'),
105-
Date.parse('Sep 20, 2015 @ 23:30:00.000')
104+
Date.parse('Sep 20, 2015 @ 21:30:00.000'),
105+
Date.parse('Sep 20, 2015 @ 23:00:00.000')
106106
);
107107
});
108108

test/functional/page_objects/common_page.ts

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -43,42 +43,10 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
4343
appConfig: {};
4444
ensureCurrentUrl: boolean;
4545
shouldLoginIfPrompted: boolean;
46-
shouldAcceptAlert: boolean;
4746
useActualUrl: boolean;
4847
}
4948

5049
class CommonPage {
51-
/**
52-
* Navigates the browser window to provided URL
53-
* @param url URL
54-
* @param shouldAcceptAlert pass 'true' if browser alert should be accepted
55-
*/
56-
private static async navigateToUrlAndHandleAlert(url: string, shouldAcceptAlert: boolean) {
57-
log.debug('Navigate to: ' + url);
58-
try {
59-
await browser.get(url);
60-
} catch (navigationError) {
61-
log.debug('Error navigating to url');
62-
const alert = await browser.getAlert();
63-
if (alert && alert.accept) {
64-
if (shouldAcceptAlert) {
65-
log.debug('Should accept alert');
66-
try {
67-
await alert.accept();
68-
} catch (alertException) {
69-
log.debug('Error accepting alert');
70-
throw alertException;
71-
}
72-
} else {
73-
log.debug('Will not accept alert');
74-
throw navigationError;
75-
}
76-
} else {
77-
throw navigationError;
78-
}
79-
}
80-
}
81-
8250
/**
8351
* Returns Kibana host URL
8452
*/
@@ -127,21 +95,19 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
12795
}
12896

12997
private async navigate(navigateProps: NavigateProps) {
130-
const {
131-
appConfig,
132-
ensureCurrentUrl,
133-
shouldLoginIfPrompted,
134-
shouldAcceptAlert,
135-
useActualUrl,
136-
} = navigateProps;
98+
const { appConfig, ensureCurrentUrl, shouldLoginIfPrompted, useActualUrl } = navigateProps;
13799
const appUrl = getUrl.noAuth(config.get('servers.kibana'), appConfig);
138100

139101
await retry.try(async () => {
140102
if (useActualUrl) {
141103
log.debug(`navigateToActualUrl ${appUrl}`);
142104
await browser.get(appUrl);
143105
} else {
144-
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
106+
log.debug(`navigateToUrl ${appUrl}`);
107+
await browser.get(appUrl);
108+
// accept alert if it pops up
109+
const alert = await browser.getAlert();
110+
await alert?.accept();
145111
}
146112

147113
const currentUrl = shouldLoginIfPrompted
@@ -167,7 +133,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
167133
basePath = '',
168134
ensureCurrentUrl = true,
169135
shouldLoginIfPrompted = true,
170-
shouldAcceptAlert = true,
171136
useActualUrl = false,
172137
} = {}
173138
) {
@@ -180,7 +145,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
180145
appConfig,
181146
ensureCurrentUrl,
182147
shouldLoginIfPrompted,
183-
shouldAcceptAlert,
184148
useActualUrl,
185149
});
186150
}
@@ -200,7 +164,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
200164
basePath = '',
201165
ensureCurrentUrl = true,
202166
shouldLoginIfPrompted = true,
203-
shouldAcceptAlert = true,
204167
useActualUrl = true,
205168
} = {}
206169
) {
@@ -214,7 +177,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
214177
appConfig,
215178
ensureCurrentUrl,
216179
shouldLoginIfPrompted,
217-
shouldAcceptAlert,
218180
useActualUrl,
219181
});
220182
}
@@ -228,18 +190,12 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
228190
async navigateToActualUrl(
229191
appName: string,
230192
hash?: string,
231-
{
232-
basePath = '',
233-
ensureCurrentUrl = true,
234-
shouldLoginIfPrompted = true,
235-
shouldAcceptAlert = true,
236-
} = {}
193+
{ basePath = '', ensureCurrentUrl = true, shouldLoginIfPrompted = true } = {}
237194
) {
238195
await this.navigateToUrl(appName, hash, {
239196
basePath,
240197
ensureCurrentUrl,
241198
shouldLoginIfPrompted,
242-
shouldAcceptAlert,
243199
useActualUrl: true,
244200
});
245201
}
@@ -252,7 +208,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
252208

253209
async navigateToApp(
254210
appName: string,
255-
{ basePath = '', shouldLoginIfPrompted = true, shouldAcceptAlert = true, hash = '' } = {}
211+
{ basePath = '', shouldLoginIfPrompted = true, hash = '' } = {}
256212
) {
257213
let appUrl: string;
258214
if (config.has(['apps', appName])) {
@@ -274,7 +230,11 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
274230
await retry.tryForTime(defaultTryTimeout * 2, async () => {
275231
let lastUrl = await retry.try(async () => {
276232
// since we're using hash URLs, always reload first to force re-render
277-
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
233+
log.debug('navigate to: ' + appUrl);
234+
await browser.get(appUrl);
235+
// accept alert if it pops up
236+
const alert = await browser.getAlert();
237+
await alert?.accept();
278238
await this.sleep(700);
279239
log.debug('returned from get, calling refresh');
280240
await browser.refresh();

test/functional/page_objects/discover_page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
138138

139139
await browser
140140
.getActions()
141-
.move({ x: 200, y: 20, origin: el._webElement })
141+
.move({ x: 0, y: 20, origin: el._webElement })
142142
.click()
143143
.perform();
144144
}
@@ -147,8 +147,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
147147
const el = await elasticChart.getCanvas();
148148

149149
await browser.dragAndDrop(
150-
{ location: el, offset: { x: 200, y: 20 } },
151-
{ location: el, offset: { x: 400, y: 30 } }
150+
{ location: el, offset: { x: -300, y: 20 } },
151+
{ location: el, offset: { x: -100, y: 30 } }
152152
);
153153
}
154154

test/functional/services/remote/webdriver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ async function attemptToCreateCommand(
107107
chromeOptions.push('headless', 'disable-gpu', 'remote-debugging-port=9222');
108108
}
109109
chromeCapabilities.set('goog:chromeOptions', {
110-
w3c: false,
110+
w3c: true,
111111
args: chromeOptions,
112112
});
113+
chromeCapabilities.set('unexpectedAlertBehaviour', 'accept');
113114
chromeCapabilities.set('goog:loggingPrefs', { browser: 'ALL' });
114115

115116
const session = await new Builder()

0 commit comments

Comments
 (0)