-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtest_dataset.py
More file actions
95 lines (82 loc) · 2.86 KB
/
test_dataset.py
File metadata and controls
95 lines (82 loc) · 2.86 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import re
import pytest
from playwright.sync_api import expect
@pytest.fixture()
def upage(unauthed_page):
unauthed_page.goto("/dataset/fixture-dataset-1")
yield unauthed_page
@pytest.fixture()
def apage(authed_page):
authed_page.goto("/dataset/fixture-dataset-1")
yield authed_page
class TestDatasetUnauthed:
"""
Test an unauthed view of the dataset detail page.
"""
def test_config_table_properties(self, upage):
"""
Test that the dataset table is populated witht he expected info.
"""
expect(
upage.locator(".config-table.dataset-config-properties table tr td")
).to_have_text(
[
"ID:",
"a1b2c3d4-e5f6-7890-abcd-ef1234567891",
"Slug:",
"fixture-dataset-1",
"Harvest Source:",
"2f2652de-91df-4c63-8b53-bfced20b276b",
"Organization:",
"Test Org",
"Popularity:",
"N/A",
"Last Harvested:",
re.compile(
r"\d{4}-\d{2}-\d{2} \d{1,2}:\d{2} [AP]M \(GMT(?:[+-]\d{1,2})?\)"
),
],
use_inner_text=True,
)
def test_dataset_actions_hidden(self, upage):
action_section = upage.locator(".config-actions.dataset-config-actions.mt-3")
expect(action_section).not_to_be_visible()
class TestDatasetAuthed:
"""
Test authed view of dataset detail page.
The details of the dataset should be visible along with the action to edit
the slug of a dataset.
"""
def test_config_table_properties(self, apage):
"""
Test that the dataset table is populated witht he expected info.
"""
expect(
apage.locator(".config-table.dataset-config-properties table tr td")
).to_have_text(
[
"ID:",
"a1b2c3d4-e5f6-7890-abcd-ef1234567891",
"Slug:",
"fixture-dataset-1",
"Harvest Source:",
"2f2652de-91df-4c63-8b53-bfced20b276b",
"Organization:",
"Test Org",
"Popularity:",
"N/A",
"Last Harvested:",
re.compile(
r"\d{4}-\d{2}-\d{2} \d{1,2}:\d{2} [AP]M \(GMT(?:[+-]\d{1,2})?\)"
),
],
use_inner_text=True,
)
def test_dataset_actions_visible(self, apage):
"""
Test actions are visible, currently the only action is to update slug.
"""
action_section = apage.locator(".config-actions.dataset-config-actions.mt-3")
expect(action_section).to_be_visible()
actions = apage.locator(".config-actions.dataset-config-actions.mt-3 button")
expect(actions).to_have_text(["Update Slug"])