generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,7 @@ | ||
Feature: Login page functionality | ||
|
||
Scenario: Register | ||
Given I am on the add user page | ||
When I register a user | ||
Then I am in /menu | ||
|
This file contains 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
This file contains 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,51 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/addUser.feature'); | ||
|
||
const { register, login, logout } = require("../utils"); | ||
|
||
let page; | ||
let browser; | ||
|
||
const email = "[email protected]"; | ||
const username = "testUser1" | ||
const password = "testUserPassword" | ||
|
||
defineFeature(feature, test => { | ||
|
||
beforeAll(async () => { | ||
browser = await puppeteer.launch({ | ||
headless: "new", | ||
slowMo: 40, | ||
defaultViewport: { width: 1920, height: 1080 }, | ||
args: ['--window-size=1920,1080'] | ||
}); | ||
|
||
page = await browser.newPage(); | ||
setDefaultOptions({ timeout: 30000 }); | ||
|
||
}); | ||
|
||
beforeEach(async () => { | ||
await logout(page); | ||
await login(page, username, password); | ||
}) | ||
|
||
test('Register', ({ given,when, then }) => { | ||
given('I am on the add user page', async () => { | ||
await page.goto('http://localhost:3000/addUser'); | ||
await page.waitForSelector('.general'); | ||
}); | ||
when('I register a user', async () => { | ||
await register(page, email, username, password); | ||
}); | ||
then('I am in /menu', async () => { | ||
await expect(page).toMatchElement('.divMenu'); | ||
}); | ||
}); | ||
|
||
|
||
|
||
}); |
This file contains 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