Skip to content

Commit 677c30a

Browse files
author
Janis Gailis
committed
jest selenium chromedriver
1 parent dfd0976 commit 677c30a

7 files changed

+82
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# IntelliJ
2+
.idea/
3+
14
# Logs
25
logs
36
*.log

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
# bacit-testing
22
Utforsker mulige rammeverk for testing som kan introduserer i BACIT
3+
4+
## cucumber
5+
Adverds-drevet utvikling (en. "Behaviour Driven Development")
6+
* installer Node.js/npm
7+
* installer Cucumber
8+
* lær grunnleggende syntaks i Cucumber og Gherkin
9+
10+
### Steg i Gherkin (samsvarer med Definisjon av Steg)
11+
Scenario: Breaker guesses a word
12+
  Given the Maker has chosen a word
13+
  When the Breaker makes a guess
14+
  Then the Maker is asked to score
15+
16+
### Definisjon av Steg (manipulerer systemet)
17+
```
18+
When("{maker} starts a game", function(maker) {
19+
maker.startGameWithWord({ word: "whale" })
20+
})
21+
```

package.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "bacit-testing",
3+
"version": "1.0.0",
4+
"description": "Checking out some testing frameworks for a university study program",
5+
"main": "index.js",
6+
"dependencies": {
7+
"selenium-webdriver": "^4.0.0"
8+
},
9+
"devDependencies": {
10+
"@cucumber/cucumber": "^8.0.0-rc.1",
11+
"chromedriver": "^95.0.0",
12+
"jest": "^27.3.1"
13+
},
14+
"scripts": {
15+
"test": "jest"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/digitnow/bacit-testing.git"
20+
},
21+
"keywords": [
22+
"testing",
23+
"bacit",
24+
"javascript",
25+
"browser"
26+
],
27+
"author": "Janis Gailis",
28+
"license": "ISC",
29+
"bugs": {
30+
"url": "https://github.com/digitnow/bacit-testing/issues"
31+
},
32+
"homepage": "https://github.com/digitnow/bacit-testing#readme"
33+
}

sum.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function sum(a, b) {
2+
return a + b;
3+
};
4+
module.exports = sum;

sum.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const sum = require('./sum');
2+
3+
test('adds 1 + 2 to equal 3', () => {
4+
expect(sum(1,2)).toBe(3);
5+
});

tests/test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const {By, Key, Builder} = require("selenium-webdriver");
2+
require("chromedriver");
3+
4+
async function testResultPageTitle(){
5+
//var searchString = "Automated testing with Selenium";
6+
let driver = await new Builder().forBrowser("chrome").build();
7+
await driver.get("https://bacit.info");
8+
//await driver.findElement(By.name("q")).sendKeys(searchString, Key.RETURN);
9+
var title = await driver.getTitle();
10+
console.log("Title is:", title);
11+
await driver.quit();
12+
}
13+
testResultPageTitle();
14+

word-guess.feature

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Scenario: Breaker guesses a word
2+
Given the Maker has chosen a word
3+
When the Breaker makes a guess
4+
Then the Maker is asked to score

0 commit comments

Comments
 (0)