Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.6] FTR: Enable w3c for chromedriver (#62542) #63182

Merged
merged 4 commits into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default function({ getService, getPageObjects }) {
});

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

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

Expand Down
39 changes: 6 additions & 33 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
const defaultFindTimeout = config.get('timeouts.find');

class CommonPage {
/**
* Navigates the browser window to provided URL
* @param url URL
* @param shouldAcceptAlert pass 'true' if browser alert should be accepted
*/
private static async navigateToUrlAndHandleAlert(url: string, shouldAcceptAlert: boolean) {
log.debug('Navigate to: ' + url);
try {
await browser.get(url);
} catch (navigationError) {
log.debug('Error navigating to url');
const alert = await browser.getAlert();
if (alert && alert.accept) {
if (shouldAcceptAlert) {
log.debug('Should accept alert');
try {
await alert.accept();
} catch (alertException) {
log.debug('Error accepting alert');
throw alertException;
}
} else {
log.debug('Will not accept alert');
throw navigationError;
}
} else {
throw navigationError;
}
}
}

/**
* Returns Kibana host URL
*/
Expand Down Expand Up @@ -144,7 +113,9 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
log.debug(`navigateToActualUrl ${appUrl}`);
await browser.get(appUrl);
} else {
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
await browser.get(appUrl);
const alert = await browser.getAlert();
await alert?.accept();
}

const currentUrl = shouldLoginIfPrompted
Expand Down Expand Up @@ -212,7 +183,9 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
await retry.tryForTime(defaultTryTimeout * 2, async () => {
let lastUrl = await retry.try(async () => {
// since we're using hash URLs, always reload first to force re-render
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
await browser.get(appUrl);
const alert = await browser.getAlert();
await alert?.accept();
await this.sleep(700);
log.debug('returned from get, calling refresh');
await browser.refresh();
Expand Down
6 changes: 3 additions & 3 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider

await browser
.getActions()
.move({ x: 200, y: 20, origin: el._webElement })
.move({ x: 0, y: 20, origin: el._webElement })
.click()
.perform();
}
Expand All @@ -140,8 +140,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
const el = await elasticChart.getCanvas();

await browser.dragAndDrop(
{ location: el, offset: { x: 200, y: 20 } },
{ location: el, offset: { x: 400, y: 30 } }
{ location: el, offset: { x: -300, y: 20 } },
{ location: el, offset: { x: -100, y: 30 } }
);
}

Expand Down
3 changes: 2 additions & 1 deletion test/functional/services/remote/webdriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ async function attemptToCreateCommand(
chromeOptions.push('headless', 'disable-gpu', 'remote-debugging-port=9222');
}
chromeCapabilities.set('goog:chromeOptions', {
w3c: false,
w3c: true,
args: chromeOptions,
});
chromeCapabilities.set('unexpectedAlertBehaviour', 'accept');
chromeCapabilities.set('goog:loggingPrefs', { browser: 'ALL' });

const session = await new Builder()
Expand Down