setValueWrapper refactor, add group prefix for easier grepping, DRY

pull/1044/head
Ryan Tharp 5 years ago
parent 3d93c05929
commit 0bffccb441

@ -38,7 +38,7 @@ describe('Add friends', function() {
await common.stopStubSnodeServer();
});
it('can add a friend by sessionID', async () => {
it('addFriends: can add a friend by sessionID', async () => {
const textMessage = common.generateSendMessageText();
await app.client.element(ConversationPage.contactsButtonSection).click();
@ -46,13 +46,16 @@ describe('Add friends', function() {
await app.client.isExisting(ConversationPage.leftPaneOverlay).should
.eventually.be.true;
await app.client
.element(ConversationPage.sessionIDInput)
.setValue(common.TEST_PUBKEY2);
await common.setValueWrapper(
app,
ConversationPage.sessionIDInput,
common.TEST_PUBKEY2
);
await app.client
.element(ConversationPage.sessionIDInput)
.getValue()
.should.eventually.equal(common.TEST_PUBKEY2);
await app.client.element(ConversationPage.nextButton).click();
await app.client.waitForExist(
ConversationPage.sendFriendRequestTextarea,
@ -68,6 +71,7 @@ describe('Add friends', function() {
ConversationPage.existingFriendRequestText(textMessage),
1000
);
// assure friend request message has been sent
await common.timeout(3000);
await app.client.isExisting(ConversationPage.retrySendButton).should

@ -23,14 +23,16 @@ describe('Closed groups', function() {
await common.stopStubSnodeServer();
});
it('can create a closed group with a friend and send/receive a message', async () => {
it('closedGroup: can create a closed group with a friend and send/receive a message', async () => {
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.createClosedGroupButton).click();
// fill the groupname
await app.client
.element(ConversationPage.closedGroupNameTextarea)
.setValue(common.VALID_CLOSED_GROUP_NAME1);
await common.setValueWrapper(
app,
ConversationPage.closedGroupNameTextarea,
common.VALID_CLOSED_GROUP_NAME1
);
await app.client
.element(ConversationPage.closedGroupNameTextarea)
.getValue()

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

@ -23,25 +23,25 @@ describe('Open groups', function() {
await common.killallElectron();
});
it('works with valid group url', async () => {
// 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 app.client
.element(ConversationPage.openGroupInputUrl)
.setValue(common.VALID_GROUP_URL);
await common.setValueWrapper(app, ConversationPage.openGroupInputUrl, url);
await app.client
.element(ConversationPage.openGroupInputUrl)
.getValue()
.should.eventually.equal(common.VALID_GROUP_URL);
.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,
9000
60 * 1000
);
// validate overlay is closed
@ -50,35 +50,27 @@ describe('Open groups', function() {
// validate open chat has been added
await app.client.waitForExist(
ConversationPage.rowOpenGroupConversationName(common.VALID_GROUP_NAME),
ConversationPage.rowOpenGroupConversationName(name),
4000
);
}
await common.timeout(1000);
it('openGroup: works with valid open group url', async () => {
await joinOpenGroup(common.VALID_GROUP_URL, common.VALID_GROUP_NAME);
});
it('cannot join two times the same open group', async () => {
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click();
await app.client
.element(ConversationPage.openGroupInputUrl)
.setValue(common.VALID_GROUP_URL2);
await app.client.element(ConversationPage.joinOpenGroupButton).click();
// first add is a success
await common.timeout(2000);
await app.client.waitForExist(
ConversationPage.rowOpenGroupConversationName(common.VALID_GROUP_NAME2),
8000
);
it('openGroup: cannot join two times the same open group', async () => {
await joinOpenGroup(common.VALID_GROUP_URL2, common.VALID_GROUP_NAME2);
// adding a second time the same open group
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click();
await app.client
.element(ConversationPage.openGroupInputUrl)
.setValue(common.VALID_GROUP_URL2);
await common.setValueWrapper(
app,
ConversationPage.openGroupInputUrl,
common.VALID_GROUP_URL2
);
await app.client.element(ConversationPage.joinOpenGroupButton).click();
// validate session loader is not shown
await app.client.isExisting(ConversationPage.sessionLoader).should
@ -86,7 +78,7 @@ describe('Open groups', function() {
await app.client.waitForExist(
ConversationPage.sessionToastJoinOpenGroupAlreadyExist,
1000
1 * 1000
);
// validate overlay is still opened
@ -94,20 +86,28 @@ describe('Open groups', function() {
.eventually.be.true;
});
it('can send message to open group', async () => {
it('openGroup: can send message to open group', async () => {
// join dev-chat group
await app.client.element(ConversationPage.globeButtonSection).click();
await app.client.element(ConversationPage.joinOpenGroupButton).click();
await app.client
.element(ConversationPage.openGroupInputUrl)
.setValue(common.VALID_GROUP_URL2);
await common.setValueWrapper(
app,
ConversationPage.openGroupInputUrl,
common.VALID_GROUP_URL2
);
await app.client.element(ConversationPage.joinOpenGroupButton).click();
// first add is a success
await common.timeout(2000);
// wait for toast to appear
await app.client.waitForExist(
ConversationPage.sessionToastJoinOpenGroupSuccess,
30 * 1000
);
await common.timeout(5 * 1000); // wait for toast to clear
await app.client.waitForExist(
ConversationPage.rowOpenGroupConversationName(common.VALID_GROUP_NAME2),
8000
10 * 1000
);
// generate a message containing the current timestamp so we can find it in the list of messages
const textMessage = common.generateSendMessageText();
@ -118,14 +118,18 @@ describe('Open groups', function() {
await app.client.isExisting(
ConversationPage.rowOpenGroupConversationName(common.VALID_GROUP_NAME2)
);
await app.client
.element(
ConversationPage.rowOpenGroupConversationName(common.VALID_GROUP_NAME2)
)
.click();
await app.client
.element(ConversationPage.sendMessageTextarea)
.setValue(textMessage);
await common.setValueWrapper(
app,
ConversationPage.sendMessageTextarea,
textMessage
);
await app.client
.element(ConversationPage.sendMessageTextarea)
.getValue()
@ -139,7 +143,7 @@ describe('Open groups', function() {
// validate that the message has been added to the message list view
await app.client.waitForExist(
ConversationPage.existingSendMessageText(textMessage),
3000
3 * 1000
);
// we should validate that the message has been added effectively sent
// (checking the check icon on the metadata part of the message?)

@ -21,12 +21,12 @@ describe('Window Test and Login', function() {
await common.killallElectron();
});
it('opens one window', async () => {
it('registration: opens one window', async () => {
app = await common.startAndAssureCleanedApp();
app.client.getWindowCount().should.eventually.be.equal(1);
});
it('window title is correct', async () => {
it('registration: window title is correct', async () => {
app = await common.startAndAssureCleanedApp();
app.client
@ -34,7 +34,7 @@ describe('Window Test and Login', function() {
.should.eventually.be.equal('Session - test-integration-session');
});
it('can restore from seed', async () => {
it('registration: can restore from seed', async () => {
app = await common.startAndAssureCleanedApp();
await app.client.element(RegistrationPage.registrationTabSignIn).click();
@ -70,7 +70,7 @@ describe('Window Test and Login', function() {
.should.eventually.be.equal(common.TEST_PUBKEY1);
});
it('can create new account', async () => {
it('registration: can create new account', async () => {
app = await common.startAndAssureCleanedApp();
await app.client.element(RegistrationPage.createSessionIDButton).click();
// wait for the animation of generated pubkey to finish
@ -98,7 +98,7 @@ describe('Window Test and Login', function() {
.should.eventually.be.equal(pubkeyGenerated);
});
it('can delete account when logged in', async () => {
it('registration: can delete account when logged in', async () => {
// login as user1
const login = {
mnemonic: common.TEST_MNEMONIC1,

Loading…
Cancel
Save