mirror of
				https://git.cloudron.io/cloudron/gitea-app
				synced 2025-11-04 00:52:35 +00:00 
			
		
		
		
	Fix tests
This commit is contained in:
		
							
								
								
									
										30
									
								
								test/test.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								test/test.js
									
									
									
									
									
								
							@@ -73,7 +73,7 @@ describe('Application life cycle test', function () {
 | 
				
			|||||||
        expect(app).to.be.an('object');
 | 
					        expect(app).to.be.an('object');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function setAvatar(done) {
 | 
					    function setAvatarOld(done) {
 | 
				
			||||||
        browser.get('https://' + app.fqdn + '/user/settings/avatar').then(function () {
 | 
					        browser.get('https://' + app.fqdn + '/user/settings/avatar').then(function () {
 | 
				
			||||||
            return browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
 | 
					            return browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
 | 
				
			||||||
        }).then(function () {
 | 
					        }).then(function () {
 | 
				
			||||||
@@ -89,6 +89,25 @@ describe('Application life cycle test', function () {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function setAvatar(done) {
 | 
				
			||||||
 | 
					        if (app.manifest.version === '1.5.4') return setAvatarOld(done);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        browser.get('https://' + app.fqdn + '/user/settings').then(function () {
 | 
				
			||||||
 | 
					            var button = browser.findElement(by.xpath('//label[contains(text(), "Use Custom Avatar")]'));
 | 
				
			||||||
 | 
					            return browser.executeScript('arguments[0].scrollIntoView(false)', button);
 | 
				
			||||||
 | 
					        }).then(function () {
 | 
				
			||||||
 | 
					            return browser.findElement(by.xpath('//label[contains(text(), "Use Custom Avatar")]')).click();
 | 
				
			||||||
 | 
					        }).then(function () {
 | 
				
			||||||
 | 
					            return browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
 | 
				
			||||||
 | 
					        }).then(function () {
 | 
				
			||||||
 | 
					            return browser.findElement(by.xpath('//button[contains(text(), "Update Avatar")]')).click();
 | 
				
			||||||
 | 
					        }).then(function () {
 | 
				
			||||||
 | 
					            return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"Your avatar has been updated.")]')), TIMEOUT);
 | 
				
			||||||
 | 
					        }).then(function () {
 | 
				
			||||||
 | 
					            done();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function checkAvatar(done) {
 | 
					    function checkAvatar(done) {
 | 
				
			||||||
return done();
 | 
					return done();
 | 
				
			||||||
        superagent.get('https://' + app.fqdn + '/avatars/a3e6f3316fc1738e29d621e6a26e93d3').end(function (error, result) {
 | 
					        superagent.get('https://' + app.fqdn + '/avatars/a3e6f3316fc1738e29d621e6a26e93d3').end(function (error, result) {
 | 
				
			||||||
@@ -129,12 +148,7 @@ return done();
 | 
				
			|||||||
    function addPublicKey(done) {
 | 
					    function addPublicKey(done) {
 | 
				
			||||||
        var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
 | 
					        var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var sshPage;
 | 
					        const sshPage = 'https://' + app.fqdn + '/user/settings/keys';
 | 
				
			||||||
        if (app.manifest.version === '1.0.3') {
 | 
					 | 
				
			||||||
            sshPage = 'https://' + app.fqdn + '/user/settings/ssh';
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            sshPage = 'https://' + app.fqdn + '/user/settings/keys';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        browser.get(sshPage).then(function () {
 | 
					        browser.get(sshPage).then(function () {
 | 
				
			||||||
            return browser.findElement(by.xpath('//div[text()="Add Key"]')).click();
 | 
					            return browser.findElement(by.xpath('//div[text()="Add Key"]')).click();
 | 
				
			||||||
@@ -248,7 +262,7 @@ return done();
 | 
				
			|||||||
        }).then(function () {
 | 
					        }).then(function () {
 | 
				
			||||||
            return browser.findElement(by.xpath('//button[@id="test-mail-btn"]')).click();
 | 
					            return browser.findElement(by.xpath('//button[@id="test-mail-btn"]')).click();
 | 
				
			||||||
        }).then(function () {
 | 
					        }).then(function () {
 | 
				
			||||||
            return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"Test email has been sent to \'test@cloudron.io\'")]')), TIMEOUT);
 | 
					            return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"A testing email has been sent to \'test@cloudron.io\'")]')), TIMEOUT);
 | 
				
			||||||
        }).then(function () {
 | 
					        }).then(function () {
 | 
				
			||||||
            done();
 | 
					            done();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user