From 8cc8b777d060b7f5847928a3165e18a1d7c098a9 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 25 Nov 2020 11:32:46 -0800 Subject: [PATCH] docs: fix auth example (#4528) We should wait for selector instead of asserting it. --- docs/examples/authentication.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/authentication.js b/docs/examples/authentication.js index 95886f56e7..7001b9695c 100644 --- a/docs/examples/authentication.js +++ b/docs/examples/authentication.js @@ -5,7 +5,7 @@ const assert = require('assert'); * In this script, we will login on GitHub.com through Chromium, * and reuse the login cookies state inside WebKit. This recipe can be * used to speed up tests by logging in once and reusing login state. - * + * * Steps summary * 1. Login on GitHub.com in Chromium * 2. Export cookies from Chromium browser context @@ -34,7 +34,7 @@ const account = { login: '', password: '' }; // Get cookies from Chromium browser context const cookies = await crContext.cookies(); await crBrowser.close(); - + // Create WebKit browser context and load cookies const wkBrowser = await webkit.launch(); const wkContext = await wkBrowser.newContext(); @@ -50,5 +50,5 @@ const account = { login: '', password: '' }; const verifyIsLoggedIn = async (page) => { await page.click('summary[aria-label="View profile and more"]') - assert(await page.$(`text="Your profile"`)); + assert(await page.waitForSelector(`text="Your profile"`)); }