Skip to content

Commit d3aebd0

Browse files
authored
e2e test - publisher test screenshot addition for skips (#8114)
### QA Notes This PR adds the ability to attach a screenshot to the report if dogfood is down. Upon failing to get a desired response from the API (_e.g.,_ due to it being down), it takes a screenshot like the one below. If API is down, such screenshot will have message `502 Bad Request` or similar _(i.e.,_ page will not load properly). <img alt="image" width="1722" src="https://private-user-images.githubusercontent.com/129895386/454950056-dcfa0428-2d56-4e32-9bc8-c13f965eda89.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDk4NDczMjUsIm5iZiI6MTc0OTg0NzAyNSwicGF0aCI6Ii8xMjk4OTUzODYvNDU0OTUwMDU2LWRjZmEwNDI4LTJkNTYtNGUzMi05YmM4LWMxM2Y5NjVlZGE4OS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDYxM1QyMDM3MDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MmIyYWI1NDk0Y2RiZGI3MDZmYWFhNDRmZWM4MGNjZjBlZTdjODk3MDQ3YjM0MmJjMjcwZjJkM2RjM2E4NjhiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.maOCIdM0OVOzk0tp-V_6AKXR5WJKrj3Z6at-bBCBAPQ"> **Overall, this addition to the test ensures that, when test fails, we know the root cause without having to assume that it was because dogfood was down.** @:web @:win @:publisher
1 parent 2d3f4b0 commit d3aebd0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/e2e/tests/publisher/publisher.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,23 @@ test.describe('Publisher - Positron', { tag: [tags.WEB, tags.WIN, tags.PUBLISHER
3535
await app.workbench.positConnect.deleteUserContent();
3636
});
3737
*/
38-
test.beforeAll('Check Dogfoods API status', async function ({ app }, testInfo: TestInfo) {
38+
test.beforeAll('Check Dogfoods API status', async function ({ app, page }, testInfo: TestInfo) {
3939
try {
40+
// to test that catch block works, add `throw new Error('Force fail');` by uncommenting line below.
41+
// throw new Error('Force fail');
4042
await app.workbench.positConnect.getUser();
4143
} catch {
44+
await app.workbench.quickaccess.runCommand('workbench.action.positronPreview.openUrl', { keepOpen: true });
45+
await app.workbench.quickInput.waitForQuickInputOpened();
46+
await app.workbench.quickInput.type(`${process.env.E2E_CONNECT_SERVER}`);
47+
await page.keyboard.press('Enter');
48+
await app.workbench.quickInput.waitForQuickInputClosed();
49+
await app.code.wait(5000);
50+
const screenshot = await page.screenshot();
51+
await testInfo.attach('API check failed screenshot', {
52+
body: screenshot,
53+
contentType: 'image/png'
54+
});
4255
testInfo.annotations.push({ type: 'skip', description: 'Skipping due to env var' });
4356
test.skip();
4457
}

0 commit comments

Comments
 (0)