From 05b326b91c0e50ab682f103324b768c26a095688 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 30 Oct 2017 14:14:49 +0100 Subject: [PATCH] Add comments --- test/e2e/utils/SortedWindowHandler.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/e2e/utils/SortedWindowHandler.js b/test/e2e/utils/SortedWindowHandler.js index c736547ed..f57856814 100644 --- a/test/e2e/utils/SortedWindowHandler.js +++ b/test/e2e/utils/SortedWindowHandler.js @@ -1,5 +1,15 @@ + +/** + * SortedWindowHandler assists in making e2e tests more robust by returning + * deterministic window handles. An instance must be created before new windows + * are created and windowHandles must be called each time a window was created or + * closed. + */ class SortedWindowHandler { + /** + * Constructor, must be called before new windows were created. + */ constructor(client) { this.client = client; this.client.windowHandles((result) => { @@ -10,6 +20,9 @@ class SortedWindowHandler { }); } + /** + * windowHandles will call given `callback` with an array of window handles. + */ windowHandles(callback) { this.client.windowHandles((result) => { this.handles = this.handles.filter((handle) => result.value.includes(handle));