-
Notifications
You must be signed in to change notification settings - Fork 61
/
namespaces.spec.js
90 lines (72 loc) · 2.63 KB
/
namespaces.spec.js
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
const namespaces = ['default', 'some-other-namespace'];
describe('Namespaces page', () => {
beforeEach(() => {
cy.interceptApi();
cy.visit('/namespaces');
cy.fixture('namespaces.json')
.then(({ namespaces }) => {
return namespaces
.map((n) => n.namespaceInfo.name)
.filter((name) => name !== 'temporal-system');
})
.as('namespaces');
cy.wait('@namespaces-api');
});
it('have the correct namespaces in the dropdown when using navigation header', () => {
cy.get('h1').contains('Namespaces');
cy.get(':nth-child(1) > td').contains(namespaces[0]);
cy.get(':nth-child(2) > td').contains(namespaces[1]);
});
});
describe('Namespaces button', () => {
beforeEach(() => {
cy.interceptApi();
cy.visit('/namespaces/default/workflows');
cy.fixture('namespaces.json')
.then(({ namespaces }) => {
return namespaces
.map((n) => n.namespaceInfo.name)
.filter((name) => name !== 'temporal-system');
})
.as('namespaces');
cy.wait('@workflows-api');
cy.wait('@namespaces-api');
cy.get('[data-cy="namespaces-button"]').as('namespaces-button');
});
it('have the correct namespaces in the dropdown when using navigation header', () => {
cy.get('@namespaces-button').click();
cy.get('[data-cy="namespace-selector-title"]').contains('Namespaces');
cy.get(':nth-child(1) > td').contains(namespaces[0]);
cy.get(':nth-child(2) > td').contains(namespaces[1]);
});
});
describe('Namespace Select', () => {
beforeEach(() => {
cy.interceptApi();
cy.visit('/namespaces/default/workflows');
cy.fixture('namespaces.json')
.then(({ namespaces }) => {
return namespaces
.map((n) => n.namespaceInfo.name)
.filter((name) => name !== 'temporal-system');
})
.as('namespaces');
cy.wait('@workflows-api');
cy.wait('@namespaces-api');
cy.get('[data-cy="namespace-select-button"]').as('namespace-select-button');
});
it('have the correct namespaces in the dropdown when using navigation header', () => {
cy.get('@namespace-select-button').click({ wait: 1000 });
cy.get('[data-cy="namespace-select-header"]').contains(
'Select a Namespace',
);
});
it('navigates to the correct namespaces in the dropdown when using navigation header', () => {
cy.get('@namespace-select-button').click({ wait: 1000 });
cy.get('[data-cy="namespace-select-header"]').contains(
'Select a Namespace',
);
cy.get('[data-cy="namespace-list"] > :nth-child(2)').click();
cy.get('[data-cy="namespace-name"]').contains(namespaces[1]);
});
});