Skip to content

Commit 6649238

Browse files
committed
selenium e2e testing
1 parent 0851b4f commit 6649238

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

e2e/seleniumTest.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const webdriver = require('selenium-webdriver');
2+
const { By, until } = webdriver;
3+
4+
(async function() {
5+
const driver = new webdriver.Builder()
6+
.usingServer('http://localhost:9515')
7+
.withCapabilities({
8+
'goog:chromeOptions': {
9+
debuggerAddress: 'localhost:9222',
10+
}
11+
})
12+
.forBrowser('chrome')
13+
.build();
14+
15+
try {
16+
await driver.wait(until.elementLocated(By.className('card')), 30000);
17+
await driver.findElement(By.className('card')).click();
18+
await driver.wait(until.elementLocated(By.className('add-container')), 10000);
19+
await driver.findElement(By.className('env-button2')).click();
20+
await driver.wait(until.elementLocated(By.className('add-container')), 10000);
21+
22+
await driver.findElement(By.id('serv-type')).sendKeys('Docker');
23+
await driver.findElement(By.id('db-type')).sendKeys('SQL');
24+
await driver.findElement(By.id('db-uri')).sendKeys('mongodb://localhost:27017/mydb');
25+
await driver.findElement(By.id('db-name')).sendKeys('My App');
26+
await driver.findElement(By.id('db-desc')).sendKeys('A description of my app');
27+
28+
await driver.findElement(By.xpath('//button[text()="Submit"]')).click();
29+
console.log('E2E test completed successfully');
30+
31+
} catch (error) {
32+
console.error('E2E test failed:', error);
33+
} finally {
34+
await driver.quit();
35+
}
36+
})();

0 commit comments

Comments
 (0)