Skip to content
Snippets Groups Projects
Commit 8620f78b authored by Kirill Stytsenko's avatar Kirill Stytsenko
Browse files

e2e test 'create & delete database'

Former-commit-id: 42688cb2
parent f07ca7d9
Branches
Tags
1 merge request!23Sprint results
......@@ -27,6 +27,7 @@
Cancel
</v-btn>
<v-btn
id="createDB"
:disabled="!formValid"
:loading="loading"
color="primary"
......@@ -59,8 +60,17 @@ export default {
async createDB () {
this.loading = true
// create a container
let res
// TODO list images and create image if needed
// try {
// res = await this.$axios.get('/api/container/api/image/')
// console.log(res.data)
// return
// } catch (e) {
// console.log(e)
// }
//
// create a container
let containerId
try {
res = await this.$axios.post('/api/container/', {
......
......@@ -13,10 +13,9 @@
"lint": "yarn lint:js",
"test:unit": "ava test/unit/**/* test/specs/**/*",
"test:watch": "ava --watch test/unit/**/* test/specs/**/*",
"test:watch:e2e": "cross-env PORT=3001 ava --watch test/e2e/**/*",
"test:e2e:dev": "cross-env PORT=3001 ava test/e2e/**",
"test:e2e:prod": "cross-env PORT=3000 ava test/e2e/**",
"test": "yarn test:unit && yarn test:e2e:prod"
"test:e2e": "cross-env PORT=3001 ava --timeout=2h --fail-fast test/e2e/**",
"test:e2e:docker": "cross-env PORT=3000 ava --timeout=2h --fail-fast test/e2e/**",
"test": "yarn test:unit && yarn test:e2e:docker"
},
"dependencies": {
"@babel/plugin-transform-runtime": "^7.13.9",
......
......@@ -3,9 +3,23 @@ const { chromium } = require('playwright')
let browserPromise
export function before (t) {
let config = {
// extra settings
}
if (process.env.SLOWMO) {
const debugConfig = {
headless: false,
// devtools: true,
slowMo: Number(process.env.SLOWMO)
}
config = {
...config,
...debugConfig
}
}
browserPromise = chromium.launch({
// headless: false,
// slowMo: 500
...config
})
}
......
......@@ -5,6 +5,37 @@ test.before(before)
test.after(after)
test('create & delete database', pageMacro, async (t, page) => {
const dbname = 'TestDB_' + Math.random().toString(36).substring(7)
await page.go('/databases')
// t.is(await page.title(), 'fda-ui - fda-ui')
// Click button:has-text("Create Database")
await page.click('button:has-text("Create Database")')
// Fill random DB Name
await page.fill('#dbname', dbname)
// Click Create button
await page.click('#createDB')
// make sure row exists
const newRow = await page.waitForSelector(`tr >> text=${dbname}`)
t.true(!!newRow, `DB ${dbname} row does not exist in DB list`)
// Go to db info page
await page.click(`text=${dbname} >> a`)
// click on admin tab
await page.click('text=admin')
// click delete
await page.click('.v-btn >> text=delete')
// confirm deletion in dialog
await page.click('.v-dialog .v-btn >> text=delete')
// await page.go('/databases')
// assert table row does not exist
const oldRow = await page.$(`tr >> text=${dbname}`)
t.false(!!oldRow, `Database ${dbname} not deleted`)
})
......@@ -4,10 +4,6 @@ const { pageMacro, before, after } = require('./_utils')
test.before(before)
test.after(after)
test('e2e placeholder', (t) => {
t.is(1, 1)
})
test('visit homepage', pageMacro, async (t, page) => {
await page.go('/')
t.is(await page.title(), 'fda-ui - fda-ui')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment