integration test: move joinOpenGroup() to common

pull/1137/head
Audric Ackermann 5 years ago
parent c7b76dfebb
commit 13791d28be
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -397,7 +397,7 @@ module.exports = {
.click(); .click();
}, },
async linkApp2ToApp(app1, app2) { async linkApp2ToApp(app1, app2, app1Pubkey) {
// app needs to be logged in as user1 and app2 needs to be logged out // app needs to be logged in as user1 and app2 needs to be logged out
// start the pairing dialog for the first app // start the pairing dialog for the first app
await app1.client.element(SettingsPage.settingsButtonSection).click(); await app1.client.element(SettingsPage.settingsButtonSection).click();
@ -422,7 +422,7 @@ module.exports = {
await this.setValueWrapper( await this.setValueWrapper(
app2, app2,
RegistrationPage.textareaLinkDevicePubkey, RegistrationPage.textareaLinkDevicePubkey,
this.TEST_PUBKEY1 app1Pubkey
); );
await app2.client.element(RegistrationPage.linkDeviceTriggerButton).click(); await app2.client.element(RegistrationPage.linkDeviceTriggerButton).click();
await app1.client.waitForExist(RegistrationPage.toastWrapper, 7000); await app1.client.waitForExist(RegistrationPage.toastWrapper, 7000);
@ -458,7 +458,7 @@ module.exports = {
// validate primary pubkey of app2 is the same that in app1 // validate primary pubkey of app2 is the same that in app1
await app2.webContents await app2.webContents
.executeJavaScript("window.storage.get('primaryDevicePubKey')") .executeJavaScript("window.storage.get('primaryDevicePubKey')")
.should.eventually.be.equal(this.TEST_PUBKEY1); .should.eventually.be.equal(app1Pubkey);
}, },
async triggerUnlinkApp2FromApp(app1, app2) { async triggerUnlinkApp2FromApp(app1, app2) {
@ -593,6 +593,36 @@ module.exports = {
} }
}, },
async joinOpenGroup(app, openGroupUrl, name) {
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click();
await this.setValueWrapper(app, ConversationPage.openGroupInputUrl, openGroupUrl);
await app.client
.element(ConversationPage.openGroupInputUrl)
.getValue()
.should.eventually.equal(openGroupUrl);
await app.client.element(ConversationPage.joinOpenGroupButton).click();
// validate session loader is shown
await app.client.isExisting(ConversationPage.sessionLoader).should
.eventually.be.true;
// account for slow home internet connection delays...
await app.client.waitForExist(
ConversationPage.sessionToastJoinOpenGroupSuccess,
60 * 1000
);
// validate overlay is closed
await app.client.isExisting(ConversationPage.leftPaneOverlay).should
.eventually.be.false;
// validate open chat has been added
await app.client.isExisting(
ConversationPage.rowOpenGroupConversationName(name)
).should.eventually.be.true;
},
async stopStubSnodeServer() { async stopStubSnodeServer() {
if (this.stubSnode) { if (this.stubSnode) {
this.stubSnode.close(); this.stubSnode.close();

@ -13,6 +13,7 @@ require('./link_device_test');
require('./closed_group_test'); require('./closed_group_test');
require('./message_functions_test'); require('./message_functions_test');
require('./settings_test'); require('./settings_test');
require('./message_sync_test');
before(async () => { before(async () => {
// start the app once before all tests to get the platform-dependent // start the app once before all tests to get the platform-dependent

@ -37,11 +37,11 @@ describe('Link Device', function() {
}); });
it('linkDevice: link two desktop devices', async () => { it('linkDevice: link two desktop devices', async () => {
await common.linkApp2ToApp(app, app2); await common.linkApp2ToApp(app, app2, common.TEST_PUBKEY1);
}); });
it('linkDevice: unlink two devices', async () => { it('linkDevice: unlink two devices', async () => {
await common.linkApp2ToApp(app, app2); await common.linkApp2ToApp(app, app2, common.TEST_PUBKEY1);
await common.timeout(1000); await common.timeout(1000);
await common.triggerUnlinkApp2FromApp(app, app2); await common.triggerUnlinkApp2FromApp(app, app2);
}); });

@ -24,43 +24,12 @@ describe('Open groups', function() {
await common.killallElectron(); await common.killallElectron();
}); });
// reduce code duplication to get the initial join
async function joinOpenGroup(url, name) {
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click();
await common.setValueWrapper(app, ConversationPage.openGroupInputUrl, url);
await app.client
.element(ConversationPage.openGroupInputUrl)
.getValue()
.should.eventually.equal(url);
await app.client.element(ConversationPage.joinOpenGroupButton).click();
// validate session loader is shown
await app.client.isExisting(ConversationPage.sessionLoader).should
.eventually.be.true;
// account for slow home internet connection delays...
await app.client.waitForExist(
ConversationPage.sessionToastJoinOpenGroupSuccess,
60 * 1000
);
// validate overlay is closed
await app.client.isExisting(ConversationPage.leftPaneOverlay).should
.eventually.be.false;
// validate open chat has been added
await app.client.isExisting(
ConversationPage.rowOpenGroupConversationName(name)
).should.eventually.be.true;
}
it('openGroup: works with valid open group url', async () => { it('openGroup: works with valid open group url', async () => {
await joinOpenGroup(common.VALID_GROUP_URL, common.VALID_GROUP_NAME); await common.joinOpenGroup(app, common.VALID_GROUP_URL, common.VALID_GROUP_NAME);
}); });
it('openGroup: cannot join two times the same open group', async () => { it('openGroup: cannot join two times the same open group', async () => {
await joinOpenGroup(common.VALID_GROUP_URL2, common.VALID_GROUP_NAME2); await common.joinOpenGroup(app, common.VALID_GROUP_URL2, common.VALID_GROUP_NAME2);
// adding a second time the same open group // adding a second time the same open group
await app.client.element(ConversationPage.globeButtonSection).click(); await app.client.element(ConversationPage.globeButtonSection).click();

Loading…
Cancel
Save