-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[TESTS] Add E2E tests to delete server #2954
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
83a90df
[E2E TEST] Delete server
kresnaputra 247fd15
fixed test for delete server
kresnaputra 218e89e
Merge branch 'develop' into e2e.test.for.delete.server
diegolmello b3d8723
fix tests
kresnaputra af77a89
Merge branch 'e2e.test.for.delete.server' of github.com:RocketChat/Ro…
kresnaputra 8c2e3e4
Merge branch 'develop' into e2e.test.for.delete.server
diegolmello e1f10bd
minor changes
diegolmello 1f84b3a
Rename file
diegolmello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| const { | ||
| device, expect, element, by, waitFor | ||
| } = require('detox'); | ||
| const data = require('../../data'); | ||
| const { sleep, navigateToLogin, login } = require('../../helpers/app'); | ||
|
|
||
| const checkServer = async(server) => { | ||
| const label = `Connected to ${ server }`; | ||
| await element(by.id('rooms-list-view-sidebar')).tap(); | ||
| await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000); | ||
| await waitFor(element(by.label(label))).toBeVisible().withTimeout(60000); | ||
| await element(by.id('sidebar-close-drawer')).tap(); | ||
| } | ||
|
|
||
| describe('Delete server', () => { | ||
| before(async() => { | ||
| await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); | ||
| await navigateToLogin(); | ||
| await login(data.users.regular.username, data.users.regular.password); | ||
| await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000); | ||
| }); | ||
|
|
||
| it('should be logged in main server', async() => { | ||
| await checkServer(data.server); | ||
| }) | ||
|
|
||
| it('should add server', async() => { | ||
| await sleep(5000); | ||
| await element(by.id('rooms-list-header-server-dropdown-button')).tap(); | ||
| await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000); | ||
| await element(by.id('rooms-list-header-server-add')).tap(); | ||
|
|
||
| // TODO: refactor | ||
| await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000); | ||
| await element(by.id('new-server-view-input')).replaceText(data.alternateServer); | ||
| await element(by.id('new-server-view-button')).tap(); | ||
| await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000); | ||
| await element(by.id('workspace-view-register')).tap(); | ||
| await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000); | ||
|
|
||
| // Register new user | ||
| await element(by.id('register-view-name')).replaceText(data.registeringUser.username); | ||
| await element(by.id('register-view-username')).replaceText(data.registeringUser.username); | ||
| await element(by.id('register-view-email')).replaceText(data.registeringUser.email); | ||
| await element(by.id('register-view-password')).replaceText(data.registeringUser.password); | ||
| await element(by.id('register-view-submit')).tap(); | ||
| await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000); | ||
|
|
||
| // Need run this instead of register the user | ||
| // await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000); | ||
| // await element(by.id('new-server-view-input')).replaceText(data.alternateServer); | ||
| // await element(by.id('new-server-view-button')).tap(); | ||
| // await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000); | ||
| // await element(by.id('workspace-view-login')).tap(); | ||
| // await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000); | ||
| // await expect(element(by.id('login-view'))).toBeVisible(); | ||
| // await login(data.users.existing.username, data.users.existing.password); | ||
|
|
||
| // For a sanity test, to make sure roomslist is showing correct rooms | ||
| // app CANNOT show public room created on previous tests | ||
| // await waitFor(element(by.id(`rooms-list-view-item-public${ data.random }`))).toBeNotVisible().withTimeout(60000); | ||
| // await expect(element(by.id(`rooms-list-view-item-public${ data.random }`))).toBeNotVisible(); | ||
| await checkServer(data.alternateServer); | ||
| }); | ||
|
|
||
| it('should delete server', async() => { | ||
| await element(by.id('rooms-list-header-server-dropdown-button')).tap(); | ||
| await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000); | ||
| await element(by.id(`rooms-list-header-server-${ data.server }`)).longPress(1500); | ||
| await element(by.label('Delete').and(by.type('_UIAlertControllerActionView'))).tap(); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not testing if the server was deleted.