Skip to content

Commit

Permalink
e2e: refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Now11 committed Sep 10, 2019
1 parent d367477 commit f757f79
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 28 deletions.
2 changes: 2 additions & 0 deletions client/test/helpers/helpers.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const LoginSteps = require('../specs/Login/steps/login_pa');
const credentials = require('../specs/credentials');
const wait = require('../helpers/waiters');

class HelpClass {
loginWithDefaultUser() {
browser.maximizeWindow();
browser.url('https://stage.depothub.xyz/login');
LoginSteps.submitLoginForm(credentials.login.email, credentials.login.password);
wait.forSpinner();
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/test/specs/DropdownMenu/steps/menu_pa.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MenuSteps {
}
navigateToNewOrganization() {
this.moveToMenu();
MenuPage.newRepositoryLink.waitForDisplayed(2000);
MenuPage.newOrganizationLink.waitForDisplayed(2000);
MenuPage.newOrganizationLink.click();
}
}
Expand Down
6 changes: 3 additions & 3 deletions client/test/specs/Repository/page/repository_po.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class RepoPage {
return $$('span.styles_repoPath__3Ye3J a')[1];
}
get repoSettings() {
return $$('div.false a')[1];
return $$('div.false a')[3];
}
get deleteBtn() {
return $$('button[type=button]')[1];
}
get createNewFileBtn() {
return $$('div.ui.buttons button')[0];
return $('div.styles_repoActions__3UqWR button');
}
get newFileNameInput() {
return $('div.styles_fileNameInput__1baIY input');
Expand All @@ -45,7 +45,7 @@ class RepoPage {
return $('div button[type="submit"]');
}
get createdFileName() {
return $$('tbody tr td a')[6];
return $$('tbody tr td a.styles_link__2E3TI')[6];
}
}

Expand Down
21 changes: 8 additions & 13 deletions client/test/specs/Repository/repository_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,39 @@ const wait = require('../../helpers/waiters');
describe('Repositories ', () => {
beforeEach(() => {
help.loginWithDefaultUser();
wait.forSpinner();
});

afterEach(() => {
repoSteps.navigateToRepoSettings();
repoSteps.deleteRepo();
browser.reloadSession();
});

it('should create repository', () => {
menuSteps.navigateToNewRepository();
wait.forSpinner();
repoSteps.enterRepoName(credentials.repo.repoName);
repoSteps.enterRepoName(credentials.repo.repoName1);
repoSteps.enterDescription(credentials.repo.repoDescription);
repoSteps.selectReadme();
repoSteps.addGitignore();
repoSteps.addLicense();
repoSteps.submitCreateRepoBtn();
assert.strictEqual(credentials.repo.repoName, repoPage.createdRepoName.getText());
//postconditions
repoSteps.navigateToRepoSettings();
repoSteps.deleteRepo();
repoSteps.submitCreateRepoForm();
assert.strictEqual(credentials.repo.repoName1, repoPage.createdRepoName.getText());
});

it('should create new file in repository', () => {
menuSteps.navigateToNewRepository();
wait.forSpinner();
repoSteps.enterRepoName(credentials.repo.repoName);
repoSteps.enterRepoName(credentials.repo.repoName2);
repoSteps.enterDescription(credentials.repo.repoDescription);
repoSteps.selectReadme();
repoSteps.addGitignore();
repoSteps.addLicense();
repoSteps.submitCreateRepoBtn();
repoSteps.submitCreateRepoForm();
repoSteps.createNewFileBtn();
repoSteps.enterNewFileName(credentials.newFileName);
repoSteps.enterCommitMessage(credentials.commitMessage);
repoSteps.submitCommit();
assert.strictEqual(credentials.newFileName, repoPage.createdFileName.getText());
//postconditions
repoSteps.navigateToRepoSettings();
repoSteps.deleteRepo();
assert.strictEqual(credentials.newFileName2, repoSteps.getFileName());
});
});
10 changes: 8 additions & 2 deletions client/test/specs/Repository/steps/repository_pa.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RepoSteps {
repoPage.selectLicense.click();
}

submitCreateRepoBtn() {
submitCreateRepoForm() {
repoPage.createRepoBtn.click();
browser.pause(500);
}
Expand All @@ -55,13 +55,19 @@ class RepoSteps {

enterCommitMessage(commitMessage) {
repoPage.commitMessageInput.clearValue();
repoPage.commitMessageInput.scrollIntoView();
repoPage.commitMessageInput.setValue(commitMessage);
}

submitCommit() {
repoPage.commitFileBtn.scrollIntoView();
repoPage.commitFileBtn.waitForDisplayed(2000);
repoPage.commitFileBtn.click();
browser.pause(500);
browser.pause(750);
}
getFileName() {
browser.pause(750);
repoPage.createdFileName.getText();
}
}

Expand Down
13 changes: 11 additions & 2 deletions client/test/specs/UserSettings/steps/user_settings_pa.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const SettingsPages = require('../pages/user_settings_po');

class SettingsSteps {
enterName(name) {
fillUpUserProfile(info) {
SettingsPages.nameInput.waitForDisplayed(2000);
this.enterName(info.profileSettings.name);
this.enterBio(info.profileSettings.bio);
this.enterUrl(info.profileSettings.url);
this.enterCompany(info.profileSettings.company);
this.enterLocation(info.profileSettings.location);
}

enterName(name) {
SettingsPages.nameInput.clearValue();
SettingsPages.nameInput.setValue(name);
}
Expand All @@ -27,7 +35,8 @@ class SettingsSteps {
SettingsPages.locationInput.setValue(location);
}

updateProfileBtn() {
updateProfile() {
SettingsPages.updateProfileButton.waitForDisplayed(2000);
SettingsPages.updateProfileButton.click();
}

Expand Down
8 changes: 2 additions & 6 deletions client/test/specs/UserSettings/user_settings_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ describe('Settings', () => {

it('should change user public information', () => {
profileSteps.navigateToProfileSettings();
profileSteps.enterName(credentials.profileSettings.name);
profileSteps.enterBio(credentials.profileSettings.bio);
profileSteps.enterUrl(credentials.profileSettings.url);
profileSteps.enterCompany(credentials.profileSettings.company);
profileSteps.enterLocation(credentials.profileSettings.location);
profileSteps.updateProfileBtn();
profileSteps.fillUpUserProfile(credentials);
profileSteps.updateProfile();
profileSteps.navigateToYourProfile();

assert.strictEqual(credentials.profileSettings.name, profileObj.updatedName.getText());
Expand Down
3 changes: 2 additions & 1 deletion client/test/specs/credentials.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"password": "Q!w2e3r4t5"
},
"repo": {
"repoName": "RepoTest123",
"repoName1": "RepoTest1",
"repoName2": "RepoTest2",
"repoDescription": "test"
},

Expand Down

0 comments on commit f757f79

Please sign in to comment.