Move spaces tests from Puppeteer to Cypress (#8645)
* Move spaces tests from Puppeteer to Cypress * Add missing fixture * Tweak synapsedocker to not double error on a docker failure * Fix space hierarchy loading race condition Fixes https://github.com/matrix-org/element-web-rageshakes/issues/10345 * Fix race condition when creating public space with url update code * Try Electron once more due to perms issues around clipboard * Try set browser permissions properly * Try to enable clipboard another way * Try electron again * Try electron again again * Switch to built-in cypress feature for file uploads * Mock clipboard instead * TMPDIR ftw? * uid:gid pls * Clipboard tests can now run on any browser due to mocking * Test Enter as well as button for space creation * Make the test actually work * Update cypress/support/util.ts Co-authored-by: Eric Eastwood <erice@element.io> Co-authored-by: Eric Eastwood <erice@element.io>
This commit is contained in:
parent
d75e2f19c5
commit
f3f14afbbf
21 changed files with 492 additions and 148 deletions
|
@ -66,9 +66,6 @@ async function cfgDirFromTemplate(template: string): Promise<SynapseConfig> {
|
|||
}
|
||||
const tempDir = await fse.mkdtemp(path.join(os.tmpdir(), 'react-sdk-synapsedocker-'));
|
||||
|
||||
// change permissions on the temp directory so the docker container can see its contents
|
||||
await fse.chmod(tempDir, 0o777);
|
||||
|
||||
// copy the contents of the template dir, omitting homeserver.yaml as we'll template that
|
||||
console.log(`Copy ${templateDir} -> ${tempDir}`);
|
||||
await fse.copy(templateDir, tempDir, { filter: f => path.basename(f) !== 'homeserver.yaml' });
|
||||
|
@ -113,6 +110,7 @@ async function synapseStart(template: string): Promise<SynapseInstance> {
|
|||
console.log(`Starting synapse with config dir ${synCfg.configDir}...`);
|
||||
|
||||
const containerName = `react-sdk-cypress-synapse-${crypto.randomBytes(4).toString("hex")}`;
|
||||
const userInfo = os.userInfo();
|
||||
|
||||
const synapseId = await new Promise<string>((resolve, reject) => {
|
||||
childProcess.execFile('docker', [
|
||||
|
@ -121,6 +119,8 @@ async function synapseStart(template: string): Promise<SynapseInstance> {
|
|||
"-d",
|
||||
"-v", `${synCfg.configDir}:/data`,
|
||||
"-p", `${synCfg.port}:8008/tcp`,
|
||||
// We run the docker container as our uid:gid otherwise cleaning it up its media_store can be difficult
|
||||
"-u", `${userInfo.uid}:${userInfo.gid}`,
|
||||
"matrixdotorg/synapse:develop",
|
||||
"run",
|
||||
], (err, stdout) => {
|
||||
|
@ -129,8 +129,6 @@ async function synapseStart(template: string): Promise<SynapseInstance> {
|
|||
});
|
||||
});
|
||||
|
||||
synapses.set(synapseId, { synapseId, ...synCfg });
|
||||
|
||||
console.log(`Started synapse with id ${synapseId} on port ${synCfg.port}.`);
|
||||
|
||||
// Await Synapse healthcheck
|
||||
|
@ -150,7 +148,9 @@ async function synapseStart(template: string): Promise<SynapseInstance> {
|
|||
});
|
||||
});
|
||||
|
||||
return synapses.get(synapseId);
|
||||
const synapse: SynapseInstance = { synapseId, ...synCfg };
|
||||
synapses.set(synapseId, synapse);
|
||||
return synapse;
|
||||
}
|
||||
|
||||
async function synapseStop(id: string): Promise<void> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue