Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { Builder, By, until } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const webdriver = process.env.Chrome_DRIVER
const service = new chrome.ServiceBuilder(webdriver);
const login = require("./helperSimulations/simulateNoAdminLogin")
const adminLogin = require("./helperSimulations/simulateAdminLogin")
describe("logout and login as user test123", () => {
let driver
beforeAll(async () => {
driver = new Builder().forBrowser('chrome').setChromeService(service).build();
})
afterAll(async () => {
await driver.quit();
})
it("should be able to logout and find landing page again", async () => {
await adminLogin(driver)
const logoutButton = await driver.wait(until.elementLocated(By.id("LogoutButton")), 5000)
expect(logoutButton).toBeDefined()
await logoutButton.click()
const startPage = await driver.wait(until.elementLocated(By.id("LandingPage")), 5000)
expect(startPage).toBeDefined()
})
it("should be possible to login as user test123 again", async () => {
await login(driver)
})
it("should not show the User-Management-Button", async () => {
await login(driver);
const notFoundButton = await driver.findElements(By.id('OpenUserManagementPageButton'));
expect(notFoundButton.length).toBe(0);
});
})