Skip to content

Commit f735a60

Browse files
committed
WIP
1 parent 01352cb commit f735a60

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

cypress/e2e/trafficlight/actions/e2ee.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ export function acceptCrossSigningRequest(): string {
3737
// Can we please tag some buttons :)
3838
// Click 'Verify' when it comes up
3939
cy.get('.mx_Toast_buttons > .mx_AccessibleButton_kind_primary').click();
40+
return 'accepted_crosssign';
41+
}
42+
43+
export function verifyCrossSigningEmoji(): string {
4044
// Click to move to emoji verification
4145
cy.wait(1000).then(() => {
4246
// Choose whichever exists
4347
Cypress.$(".mx_VerificationPanel_verifyByEmojiButton")?.trigger("click");
4448
Cypress.$('.mx_VerificationPanel_QRPhase_startOption > .mx_AccessibleButton')?.trigger("click");
4549
});
46-
return 'accepted_crosssign';
47-
}
48-
49-
export function verifyCrossSigningEmoji(): string {
50-
cy.get('.mx_VerificationShowSas_buttonRow > .mx_AccessibleButton_kind_primary').click();
51-
cy.get('.mx_UserInfo_container > .mx_AccessibleButton').click();
50+
cy.contains("They match").click();
51+
cy.contains("Got it").click();
5252
return 'verified_crosssign';
5353
}
5454

cypress/e2e/trafficlight/trafficlight.spec.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ limitations under the License.
1818

1919
/// <reference types='cypress' />
2020

21+
import fetch from "node-fetch";
22+
2123
import { login, logout, register } from "./actions/auth";
2224
import { advanceClock, clearIDBStorage, exit, idle, reload, wait } from "./actions/browser";
2325
import {
@@ -50,10 +52,39 @@ type JSONValue =
5052
| { [x: string]: JSONValue }
5153
| Array<JSONValue>;
5254

53-
Cypress.on('uncaught:exception', (err, runnable) => {
55+
Cypress.on('uncaught:exception', (e, runnable) => {
56+
console.log("uncaught exception", e.message);
57+
const errorUrl = `${Cypress.env('TRAFFICLIGHT_URL') }/client/${ Cypress.env('TRAFFICLIGHT_UUID') }/error`;
58+
console.log(e.message);
59+
const body = JSON.stringify({
60+
error: {
61+
type: e.name,
62+
details: e.message,
63+
path: "foo/bar",
64+
},
65+
});
66+
fetch(errorUrl, { method: "POST", body });
5467
return false;
5568
});
5669

70+
Cypress.on('fail', (e) => {
71+
const errorUrl = `${Cypress.env('TRAFFICLIGHT_URL') }/client/${ Cypress.env('TRAFFICLIGHT_UUID') }/error`;
72+
console.log("fail", e.message);
73+
const body = JSON.stringify({
74+
error: {
75+
type: e.name,
76+
details: e.message,
77+
path: "foo/bar",
78+
},
79+
});
80+
fetch(errorUrl, {
81+
method: "post",
82+
body,
83+
headers: { 'Content-Type': 'application/json' },
84+
});
85+
throw e;
86+
});
87+
5788
describe('traffic light client', () => {
5889
it('runs a trafficlight client once', () => {
5990
recurse();

src/trafficlight.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ async function uploadFile(trafficlightUrl: string, uuid: string, filename: strin
8888

8989
async function runCypress(trafficlightUrl: string, uuid: string): Promise<boolean> {
9090
const cypressOptions = {
91-
headed: false,
91+
headed: true,
9292
// @ts-ignore-next-line
93-
exit: true,
93+
exit: false,
9494
quiet: false,
95-
browser: 'chrome',
95+
browser: 'chromium',
9696
spec: './cypress/e2e/trafficlight/trafficlight.spec.ts',
9797
env: {
9898
'TRAFFICLIGHT_URL': trafficlightUrl,

0 commit comments

Comments
 (0)