-
Notifications
You must be signed in to change notification settings - Fork 2
Changes for fallback key test #17
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,11 +47,11 @@ export function verifyLastMessageIsTrusted(): string { | |
return "verified"; | ||
} | ||
|
||
export function getTimeline(): JSONValue { | ||
const rsp = []; | ||
export function getTimeline(): Record<string, any> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we mean to change JSON value -> Record here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
type TimelineContent = {
user: string[];
e2e_issues: string[];
} |
||
const rsp: any = []; | ||
Cypress.$('.mx_EventTile').each( | ||
function(index, obj) { | ||
tile = {}; | ||
const tile = {}; | ||
tile['user'] = Cypress.$(obj).find('.mx_BaseAvatar_image').attr('title'); | ||
const e2eicon = Cypress.$(obj).find('.mx_EventTile_e2eIcon').attr('class'); | ||
tile['e2e_issues'] = e2eicon; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -106,7 +106,7 @@ function recurse() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function sendResponse(responseStatus) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (typeof responseStatus == "string") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (typeof responseStatus === "string") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data = { response: responseStatus }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data = responseStatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -121,23 +121,25 @@ function recurse() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const data: JSONValue = resp.body.data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const action: string = resp.body.action; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cy.log('running action', action, JSON.stringify(data)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
let result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result = runAction(action, data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cy.resolveFromPromise(runAction(action, data)).then(result => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sendResponse(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens to the flow if we don't send a result? We need to handle that as an error case (ActionRecord can be of type undefined) otherwise I think we'll end up in a loop doing a poll then trying to perform the action again There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should move the whole set of methods to a promise interface and stop returning undefined; instead making the promise error. IDK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only certain actions like idle and exit return undefined. All other actions will return something (most likely a string). trafficlight-adapter-element-web/cypress/e2e/trafficlight/trafficlight.spec.ts Lines 56 to 87 in 51d7e79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that this can probably be written in a better way but I suggest that we just create an issue for now (since this code was not introduced by the changes in this PR). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Don't keep running if we encounter an error! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sendResponse(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (action !== 'exit') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
recurse(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function runAction(action: string, data: JSONValue): string | JSONValue | undefined { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type ActionResult = string | JSONValue | undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function runAction(action: string, data: JSONValue): ActionResult | Promise<ActionResult> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
switch (action) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Auth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'register': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
// Add | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* Custom command to go to All Settings view in element web. | ||
*/ | ||
gotoAllSettings(): Chainable<Element>; | ||
gotoAllSettings(): Chainable<Element>; | ||
/** | ||
* A very hacky way to use promises in Cypress | ||
*/ | ||
resolveFromPromise(p: any): Chainable<any>; | ||
} | ||
} | ||
} | ||
|
||
export { }; | ||
export {}; |
Uh oh!
There was an error while loading. Please reload this page.