Add testing
This commit is contained in:
parent
0f37e525d7
commit
67716138d2
3 changed files with 44 additions and 33 deletions
7
Makefile
7
Makefile
|
|
@ -2,7 +2,7 @@
|
||||||
PACKAGE_NAME := $(shell awk '/"name":/ {gsub(/[",]/, "", $$2); print $$2}' package.json)
|
PACKAGE_NAME := $(shell awk '/"name":/ {gsub(/[",]/, "", $$2); print $$2}' package.json)
|
||||||
VERSION := $(shell T=$$(git describe 2>/dev/null) || T=1; echo $$T | tr '-' '.')
|
VERSION := $(shell T=$$(git describe 2>/dev/null) || T=1; echo $$T | tr '-' '.')
|
||||||
ifeq ($(TEST_OS),)
|
ifeq ($(TEST_OS),)
|
||||||
TEST_OS = centos-7
|
TEST_OS = rhel-x
|
||||||
endif
|
endif
|
||||||
export TEST_OS
|
export TEST_OS
|
||||||
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
|
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
|
||||||
|
|
@ -120,6 +120,7 @@ rpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
||||||
$(VM_IMAGE): rpm bots
|
$(VM_IMAGE): rpm bots
|
||||||
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
|
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
|
||||||
bots/image-customize -v -i cockpit -i `pwd`/cockpit-$(PACKAGE_NAME)-*.noarch.rpm -s $(CURDIR)/test/vm.install $(TEST_OS)
|
bots/image-customize -v -i cockpit -i `pwd`/cockpit-$(PACKAGE_NAME)-*.noarch.rpm -s $(CURDIR)/test/vm.install $(TEST_OS)
|
||||||
|
bots/image-customize -v -u ./test/files/1.journal:/root/1.journal $(TEST_OS)
|
||||||
|
|
||||||
# convenience target for the above
|
# convenience target for the above
|
||||||
vm: $(VM_IMAGE)
|
vm: $(VM_IMAGE)
|
||||||
|
|
@ -127,7 +128,7 @@ vm: $(VM_IMAGE)
|
||||||
|
|
||||||
# run the browser integration tests; skip check for SELinux denials
|
# run the browser integration tests; skip check for SELinux denials
|
||||||
check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common
|
check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common
|
||||||
TEST_AUDIT_NO_SELINUX=1 test/check-application
|
TEST_AUDIT_NO_SELINUX=1 test/check-application -s
|
||||||
|
|
||||||
# checkout Cockpit's bots/ directory for standard test VM images and API to launch them
|
# checkout Cockpit's bots/ directory for standard test VM images and API to launch them
|
||||||
# must be from cockpit's master, as only that has current and existing images; but testvm.py API is stable
|
# must be from cockpit's master, as only that has current and existing images; but testvm.py API is stable
|
||||||
|
|
@ -139,7 +140,7 @@ bots:
|
||||||
# checkout Cockpit's test API; this has no API stability guarantee, so check out a stable tag
|
# checkout Cockpit's test API; this has no API stability guarantee, so check out a stable tag
|
||||||
# when you start a new project, use the latest relese, and update it from time to time
|
# when you start a new project, use the latest relese, and update it from time to time
|
||||||
test/common:
|
test/common:
|
||||||
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git 176
|
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git 180
|
||||||
git checkout --force FETCH_HEAD -- test/common
|
git checkout --force FETCH_HEAD -- test/common
|
||||||
git reset test/common
|
git reset test/common
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,40 +12,50 @@ sys.path.append(os.path.join(TEST_DIR, "common"))
|
||||||
sys.path.append(os.path.join(os.path.dirname(TEST_DIR), "bots/machine"))
|
sys.path.append(os.path.join(os.path.dirname(TEST_DIR), "bots/machine"))
|
||||||
import testlib
|
import testlib
|
||||||
|
|
||||||
|
# Test with pre-recorded journal with tlog UID 981
|
||||||
class TestApplication(testlib.MachineCase):
|
class TestApplication(testlib.MachineCase):
|
||||||
def testBasic(self):
|
def testPlay(self):
|
||||||
b = self.browser
|
b = self.browser
|
||||||
m = self.machine
|
m = self.machine
|
||||||
|
m.execute("cp /root/1.journal /var/log/journal/")
|
||||||
|
self.login_and_go("/session-recording")
|
||||||
|
b.wait_present(".content-header-extra")
|
||||||
|
b.wait_present("#user")
|
||||||
|
b.click(".listing-ct-item")
|
||||||
|
b.wait_present("button.margin-right-btn:nth-child(3)")
|
||||||
|
b.click("button.margin-right-btn:nth-child(3)")
|
||||||
|
b.wait_timeout(15000)
|
||||||
|
b.wait_present(".fa-pause")
|
||||||
|
b.click("button.margin-right-btn:nth-child(3)")
|
||||||
|
b.snapshot('play-default')
|
||||||
|
m.execute("rm -rf /var/log/journal/1.journal")
|
||||||
|
|
||||||
self.login_and_go("/starter-kit")
|
def testSkip(self):
|
||||||
# verify expected heading
|
b = self.browser
|
||||||
b.wait_present(".container-fluid h2")
|
m = self.machine
|
||||||
b.wait_text(".container-fluid h2", "Starter Kit")
|
m.execute("cp /root/1.journal /var/log/journal/")
|
||||||
|
self.login_and_go("/session-recording")
|
||||||
# verify expected host name
|
b.wait_present(".content-header-extra")
|
||||||
hostname = m.execute("hostname").strip()
|
b.wait_present("#user")
|
||||||
b.wait_present(".container-fluid p")
|
b.click(".listing-ct-item")
|
||||||
b.wait_text(".container-fluid p", "Running on " + hostname)
|
b.wait_present("button.margin-right-btn:nth-child(3)")
|
||||||
|
b.wait_present("button.margin-right-btn:nth-child(4)")
|
||||||
# change language to German
|
b.click("button.margin-right-btn:nth-child(4)")
|
||||||
b.switch_to_top()
|
b.wait_timeout(1000)
|
||||||
b.click("#content-user-name")
|
b.wait_present("button.margin-right-btn:nth-child(4)")
|
||||||
b.click(".display-language-menu a")
|
b.click("button.margin-right-btn:nth-child(4)")
|
||||||
b.wait_popup('display-language')
|
b.wait_timeout(1000)
|
||||||
b.set_val("#display-language select", "de-de")
|
b.wait_present("button.margin-right-btn:nth-child(4)")
|
||||||
b.click("#display-language-select-button")
|
b.click("button.margin-right-btn:nth-child(4)")
|
||||||
b.expect_load()
|
b.wait_timeout(1000)
|
||||||
# HACK: work around language switching in Chrome not working in current session (Cockpit issue #8160)
|
b.wait_present("button.margin-right-btn:nth-child(4)")
|
||||||
b.reload(ignore_cache=True)
|
b.click("button.margin-right-btn:nth-child(4)")
|
||||||
b.wait_present("#content")
|
b.wait_timeout(1000)
|
||||||
# menu label (from manifest) should be translated
|
b.wait_present("button.margin-right-btn:nth-child(4)")
|
||||||
b.wait_text("#host-apps a[href='/starter-kit']", "Bausatz")
|
b.click("button.margin-right-btn:nth-child(4)")
|
||||||
|
b.wait_timeout(1000)
|
||||||
b.go("/starter-kit")
|
b.snapshot('play-default')
|
||||||
b.enter_page("/starter-kit")
|
m.execute("rm -rf /var/log/journal/1.journal")
|
||||||
# page label (from js) should be translated
|
|
||||||
b.wait_in_text(".container-fluid p", "Läuft auf")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
testlib.test_main()
|
testlib.test_main()
|
||||||
|
|
|
||||||
BIN
test/files/1.journal
Normal file
BIN
test/files/1.journal
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue