Another Questions that popped up: Is there any way to mock out external url calls in playwright?
We do this for the Server already whenever we hit an external api, but i'm thinking of doing this for playwright too. We currently have problems with images hosted on YouTube Servers which seem to be rate limited.
If I execute tests in our test environment with the same image too often, the image won't show up. This fails if the tests are executed one after another too fast, since the images are missing.
The easiest way would record this "external" calls and store the response, so that when replaying the tests the images would show up.
playwright-video
+`@ffmpeg/instller` package should just work out of the box with the playwright docker image?
if('0' == '1'){
qr.addData('This is a demo==================');
}else{
qr.addData(info.text_qr);
}
qr.make();
document.getElementById('image_qr').src = qr.createDataURL(10,0);
jQuery("#loader").hide();
jQuery("#ticketImage").show();
jQuery('#image_qr').show();
});
});
page.waitForFunction
to wait for something that is not ready yet https://playwright.dev/#version=v1.3.0&path=docs%2Fapi.md&q=pagewaitforfunctionpagefunction-arg-options
await page.waitForFunction(() => {
const element = document.querySelector("image_qr");
return element && element.src;
});
@Vesnushki Hi, I haven't used the assertions yet, but the documentation says to use qawolf.assertElementText
const qawolf = require('qawolf');
// ...
qawolf.assertElementText(page, '#container', 'hello');
https://docs.qawolf.com/docs/api/qawolf/assert_element_text#examples
@jperl Kinda had an idea right now: I usually run tests multiple times after creation to check for flakyness.
It's a bit bothersome to run the command 3 times, is there a good way to rerun tests in Jest without invoking it via the cli?
I didn't find anything for Jest, however with a little bash magic it should work: https://serverfault.com/a/273241
Not sure if that's the best way though.
Hi guys I just installed QA wolf and I have this message
npx jest --config="node_modules/qawolf/js-jest.config.json" --rootDir=.qawolf --testTimeout=60000 myTest
FAIL .qawolf/myTest.test.js
● Test suite failed to run
TypeError: Cannot read property 'close' of undefined
13 | afterAll(async () => {
14 | await qawolf.stopVideos();
> 15 | await browser.close();
| ^
16 | });
17 |
18 | test("myTest", async () => {
at Object.<anonymous> (myTest.test.js:15:17)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.185 s
The test is the one of the tutorial
const qawolf = require("qawolf");
let browser;
let page;
beforeAll(async () => {
browser = await qawolf.launch();
const context = await browser.newContext();
await qawolf.register(context);
page = await context.newPage();
});
afterAll(async () => {
await qawolf.stopVideos();
await browser.close();
});
test("myTest", async () => {
await page.goto("http://todomvc.com/examples/react");
await qawolf.create();
});
Any clue?
innerText
method: https://playwright.dev/#version=v1.3.0&path=docs%2Fapi.md&q=pageinnertextselector-options
const myText = await page.innerText('#mySelector')