-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress tests don't run on Windows(?) anymore #23487
Labels
Comments
In case someone else is staring at this trying to figure out wtf is going on, this is the debugging I've managed to get through so far (the console logs don't really reveal anything): diff --git a/cypress/e2e/user-view/user-view.spec.ts b/cypress/e2e/user-view/user-view.spec.ts
index 30c3ff23ca9..11ba5bd0301 100644
--- a/cypress/e2e/user-view/user-view.spec.ts
+++ b/cypress/e2e/user-view/user-view.spec.ts
@@ -19,6 +19,10 @@ limitations under the License.
import { SynapseInstance } from "../../plugins/synapsedocker";
import { MatrixClient } from "../../global";
+Cypress.on("uncaught:exception", (err) => {
+ console.error("@@", err);
+});
+
describe("UserView", () => {
let synapse: SynapseInstance;
@@ -27,7 +31,7 @@ describe("UserView", () => {
synapse = data;
cy.initTestUser(synapse, "Violet");
- cy.getBot(synapse, { displayName: "Usman" }).as("bot");
+ // cy.getBot(synapse, { displayName: "Usman" }).as("bot");
});
});
@@ -36,16 +40,18 @@ describe("UserView", () => {
});
it("should render the user view as expected", () => {
- cy.get<MatrixClient>("@bot").then(bot => {
- cy.visit(`/#/user/${bot.getUserId()}`);
- });
-
- cy.get("#mx_RightPanel .mx_UserInfo_profile h2").should("contain", "Usman");
- cy.get(".mx_RightPanel .mx_Spinner").should("not.exist"); // wait for spinners to finish
- cy.get(".mx_RightPanel").percySnapshotElement("User View", {
- // Hide the MXID field as it'll vary on each test
- percyCSS: ".mx_UserInfo_profile_mxid { visibility: hidden !important; }",
- widths: [260, 500],
- });
+ cy.visit("/");
+ cy.get(".mx_AuthBody_language").should('exist').click();
+ // cy.get<MatrixClient>("@bot").then(bot => {
+ // cy.visit(`/#/user/${bot.getUserId()}`);
+ // });
+ //
+ // cy.get("#mx_RightPanel .mx_UserInfo_profile h2").should("contain", "Usman");
+ // cy.get(".mx_RightPanel .mx_Spinner").should("not.exist"); // wait for spinners to finish
+ // cy.get(".mx_RightPanel").percySnapshotElement("User View", {
+ // // Hide the MXID field as it'll vary on each test
+ // percyCSS: ".mx_UserInfo_profile_mxid { visibility: hidden !important; }",
+ // widths: [260, 500],
+ // });
});
});
diff --git a/cypress/support/login.ts b/cypress/support/login.ts
index e44be781231..b23668ec23e 100644
--- a/cypress/support/login.ts
+++ b/cypress/support/login.ts
@@ -104,31 +104,32 @@ Cypress.Commands.add("initTestUser", (synapse: SynapseInstance, displayName: str
return cy.loginUser(synapse, username, password);
}).then(response => {
cy.window({ log: false }).then(win => {
+ console.log("@@-1", response.accessToken);
// Seed the localStorage with the required credentials
win.localStorage.setItem("mx_hs_url", synapse.baseUrl);
win.localStorage.setItem("mx_user_id", response.userId);
- win.localStorage.setItem("mx_access_token", response.accessToken);
+ win.localStorage.setItem("mx_access_token", response.accessToken); // Comment this out
win.localStorage.setItem("mx_device_id", response.deviceId);
win.localStorage.setItem("mx_is_guest", "false");
win.localStorage.setItem("mx_has_pickle_key", "false");
- win.localStorage.setItem("mx_has_access_token", "true");
+ win.localStorage.setItem("mx_has_access_token", "true"); // Comment this out
// Ensure the language is set to a consistent value
win.localStorage.setItem("mx_local_settings", '{"language":"en"}');
});
-
- prelaunchFn?.();
-
- return cy.visit("/").then(() => {
- // wait for the app to load
- return cy.get(".mx_MatrixChat", { timeout: 30000 });
- }).then(() => ({
- password,
- username,
- accessToken: response.accessToken,
- userId: response.userId,
- deviceId: response.deviceId,
- homeServer: response.homeServer,
- }));
+ //
+ // prelaunchFn?.();
+ //
+ // return cy.visit("/").then(() => {
+ // // wait for the app to load
+ // return cy.get(".mx_MatrixChat", { timeout: 30000 });
+ // }).then(() => ({
+ // password,
+ // username,
+ // accessToken: response.accessToken,
+ // userId: response.userId,
+ // deviceId: response.deviceId,
+ // homeServer: response.homeServer,
+ // }));
});
});
diff --git a/src/Lifecycle.ts b/src/Lifecycle.ts
index 64d1d9b5fdf..df363cc4914 100644
--- a/src/Lifecycle.ts
+++ b/src/Lifecycle.ts
@@ -367,6 +367,8 @@ export async function getStoredSessionVars(): Promise<IStoredSession> {
isGuest = localStorage.getItem("matrix-is-guest") === "true";
}
+ console.log("@@ Done with lifecycle1");
+
return { hsUrl, isUrl, hasAccessToken, accessToken, userId, deviceId, isGuest };
}
@@ -651,6 +653,7 @@ function showStorageEvictedDialog(): Promise<boolean> {
class AbortLoginAndRebuildStorage extends Error { }
async function persistCredentials(credentials: IMatrixClientCreds): Promise<void> {
+ console.log("@@CALLING");
localStorage.setItem(HOMESERVER_URL_KEY, credentials.homeserverUrl);
if (credentials.identityServerUrl) {
localStorage.setItem(ID_SERVER_URL_KEY, credentials.identityServerUrl);
@@ -715,7 +718,7 @@ async function persistCredentials(credentials: IMatrixClientCreds): Promise<void
SecurityCustomisations.persistCredentials?.(credentials);
- logger.log(`Session persisted for ${credentials.userId}`);
+ logger.log(`@@ Session persisted for ${credentials.userId}`);
}
let _isLoggingOut = false;
@@ -878,6 +881,7 @@ export async function onLoggedOut(): Promise<void> {
* @returns {Promise} promise which resolves once the stores have been cleared
*/
async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void> {
+ console.log("@@ DIE");
if (window.localStorage) {
// try to save any 3pid invites from being obliterated and registration time
const pendingInvites = ThreepidInviteStore.instance.getWireInvites();
diff --git a/src/utils/StorageManager.ts b/src/utils/StorageManager.ts
index 1145bcfb15d..94014b15313 100644
--- a/src/utils/StorageManager.ts
+++ b/src/utils/StorageManager.ts
@@ -199,7 +199,11 @@ export async function idbLoad(
if (!idb) {
await idbInit();
}
- return new Promise((resolve, reject) => {
+ return new Promise((resolve, rejectt) => {
+ const reject = (f) => {
+ console.log("@@F", f);
+ rejectt(f);
+ };
const txn = idb.transaction([table], "readonly");
txn.onerror = reject;
@@ -218,7 +222,11 @@ export async function idbSave(
if (!idb) {
await idbInit();
}
- return new Promise((resolve, reject) => {
+ return new Promise((resolve, rejectt) => {
+ const reject = (f) => {
+ console.log("@@F2", f);
+ rejectt(f);
+ };
const txn = idb.transaction([table], "readwrite");
txn.onerror = reject; |
This is a local issue - closing as environmental. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No idea what this might be. The error message shows up in cypress-io/cypress#23937 but that could be unrelated.
Currently managed to isolate this to be something to do with localStorage values of the access token, somehow. Other localStorage values are fine though, which is weird and annoying. Upgrading Cypress did not help. See cypress-io/cypress#23937 (comment)
The text was updated successfully, but these errors were encountered: