mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-23 10:08:13 +08:00
Fix smoke tests to work with remote deployments of cellxgene (#1469)
* Add test for terms of service * Add workaround for chromium CSP require-trusted-types-for error
This commit is contained in:
@@ -29,6 +29,17 @@ describe("did launch", () => {
|
||||
);
|
||||
expect(element).toBe(data.title);
|
||||
});
|
||||
|
||||
test("terms of service, if they are there", async () => {
|
||||
try {
|
||||
await utils.clickOn("tos-cookies-accept", { timeout: 500 });
|
||||
} catch {
|
||||
console.warn("No terms of service footer detected.")
|
||||
}
|
||||
page.waitFor(50); // give the footer a chance to disappear
|
||||
const result = await page.$("[data-testid='tos-cookies-accept']");
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("metadata loads", () => {
|
||||
|
||||
@@ -44,8 +44,8 @@ export const puppeteerUtils = (page) => ({
|
||||
},
|
||||
|
||||
async clickOn(testid, options = {}) {
|
||||
await this.waitByID(testid);
|
||||
const click = await page.click(`[data-testid='${testid}']`, options);
|
||||
await this.waitByID(testid, options);
|
||||
const click = await page.click(`[data-testid='${testid}']`);
|
||||
await page.waitFor(50);
|
||||
return click;
|
||||
},
|
||||
|
||||
@@ -36,6 +36,10 @@ export async function setupTestBrowser() {
|
||||
page.on("console", async (msg) => {
|
||||
// If there is a console.error but an error is not thrown, this will ensure the test fails
|
||||
if (msg.type() === "error") {
|
||||
// TODO: chromium does not currently support the CSP directive on the
|
||||
// line below, so we swallow this error. Remove this when the test
|
||||
// suite uses a browser version that supports this directive.
|
||||
if (msg.text() === "Unrecognized Content-Security-Policy directive 'require-trusted-types-for'.\n") return;
|
||||
const errorMsgText = await Promise.all(
|
||||
// TODO can we do this without internal properties?
|
||||
msg.args().map((arg) => arg._remoteObject.description)
|
||||
|
||||
Reference in New Issue
Block a user