Skip to content

Commit 3b220f6

Browse files
committed
test: fix remaning e2e tests
1 parent 1516f76 commit 3b220f6

File tree

4 files changed

+45
-74
lines changed

4 files changed

+45
-74
lines changed

test/func/tests/common-gui/hotkeys.testplane.js

Lines changed: 37 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -95,100 +95,69 @@ describe('GUI mode', () => {
9595
});
9696
});
9797

98-
describe('Screenshot accept/undo hotkeys', () => {
98+
describe('Screenshot accept/undo hotkeys on Suites page', () => {
9999
beforeEach(async ({browser}) => {
100-
await browser.keys('v');
100+
await browser.keys('s');
101101

102-
const visualChecksTitle = await browser.$('[data-qa="sidebar-title"]');
103-
await expect(visualChecksTitle).toHaveText('Visual Checks');
102+
const suitesTitle = await browser.$('[data-qa="sidebar-title"]');
103+
await expect(suitesTitle).toHaveText('Suites');
104104
});
105105

106-
it('should accept screenshot with "a" key and auto-advance to next', async ({browser}) => {
107-
const failedTab = await browser.$('[title="Failed"]');
108-
await failedTab.click();
109-
110-
await browser.waitUntil(async () => {
111-
const items = await browser.$$('[data-qa="tree-view-item"]');
112-
return items.length > 0;
113-
});
106+
it('should accept all visible with "shift+a" key', async ({browser}) => {
107+
await browser.keys(['Shift', 'a']);
114108

115-
const initialTitle = await browser.$('h2');
116-
const initialText = await initialTitle.getText();
109+
await waitForFsChanges(screensDir);
117110

118-
const acceptButton = await browser.$('[data-qa="accept-button"]');
119-
const isAcceptAvailable = await acceptButton.isExisting();
111+
const failedTab = await browser.$('[title="Failed"]');
112+
await failedTab.click();
120113

121-
if (isAcceptAvailable) {
122-
await browser.keys('a');
114+
const failedItems = await browser.$$('[data-qa="tree-view-item"]');
115+
expect(failedItems.length).toBe(0);
116+
});
117+
});
123118

124-
await waitForFsChanges(screensDir);
119+
describe('Screenshot accept/undo hotkeys on Visual Checks page', () => {
120+
beforeEach(async ({browser}) => {
121+
await browser.keys('v');
125122

126-
await browser.waitUntil(async () => {
127-
const title = await browser.$('h2');
128-
const text = await title.getText();
129-
return text !== initialText;
130-
}, {timeout: 5000, timeoutMsg: 'Did not auto-advance to next screenshot'});
131-
}
123+
const visualChecksTitle = await browser.$('[data-qa="sidebar-title"]');
124+
await expect(visualChecksTitle).toHaveText('Visual Checks');
132125
});
133126

134-
it('should undo accept with "u" key', async ({browser}) => {
135-
const failedTab = await browser.$('[title="Failed"]');
136-
await failedTab.click();
137-
127+
it('should accept screenshot with "a" key and auto-advance to next', async ({browser}) => {
138128
await browser.waitUntil(async () => {
139129
const items = await browser.$$('[data-qa="tree-view-item"]');
140130
return items.length > 0;
141131
});
142132

143-
const acceptButton = await browser.$('[data-qa="accept-button"]');
144-
const isAcceptAvailable = await acceptButton.isExisting();
145-
146-
if (isAcceptAvailable) {
147-
await acceptButton.click();
148-
await waitForFsChanges(screensDir);
149-
150-
await browser.keys('ArrowUp');
151-
152-
const undoButton = await browser.$('[data-qa="undo-button"]');
153-
await browser.waitUntil(async () => await undoButton.isExisting());
154-
155-
await browser.keys('u');
133+
const initialTitle = await browser.$('h2');
134+
const initialText = await initialTitle.getText();
156135

157-
await waitForFsChanges(screensDir, (output) => output.length === 0);
136+
await browser.keys('a');
158137

159-
const acceptButtonAfterUndo = await browser.$('[data-qa="accept-button"]');
160-
await expect(acceptButtonAfterUndo).toBeDisplayed();
161-
}
162-
});
138+
await browser.pause(5000);
163139

164-
it('should accept all visible with "shift+a" key', async ({browser}) => {
165-
const failedTab = await browser.$('[title="Failed"]');
166-
await failedTab.click();
140+
await waitForFsChanges(screensDir);
167141

168142
await browser.waitUntil(async () => {
169-
const items = await browser.$$('[data-qa="tree-view-item"]');
170-
return items.length > 0;
171-
});
172-
173-
const failedItems = await browser.$$('[data-qa="tree-view-item"]');
174-
const failedCount = failedItems.length;
143+
const title = await browser.$('h2');
144+
const text = await title.getText();
145+
return text !== initialText;
146+
}, {timeout: 5000, timeoutMsg: 'Did not auto-advance to next screenshot'});
147+
});
175148

176-
if (failedCount > 0) {
177-
await browser.keys(['Shift', 'a']);
149+
it('should undo accept with "u" key', async ({browser}) => {
150+
await browser.keys('a');
151+
await waitForFsChanges(screensDir);
178152

179-
await waitForFsChanges(screensDir);
153+
await browser.keys('ArrowUp');
180154

181-
const passedTab = await browser.$('[title="Passed"]');
182-
await passedTab.click();
155+
const undoButton = await browser.$('[data-qa="undo-button"]');
156+
await browser.waitUntil(async () => await undoButton.isExisting());
183157

184-
await browser.waitUntil(async () => {
185-
const items = await browser.$$('[data-qa="tree-view-item"]');
186-
return items.length > 0;
187-
});
158+
await browser.keys('u');
188159

189-
const passedItems = await browser.$$('[data-qa="tree-view-item"]');
190-
expect(passedItems.length).toBeGreaterThan(0);
191-
}
160+
await waitForFsChanges(screensDir, (output) => output.length === 0);
192161
});
193162
});
194163

test/func/tests/common/new-ui/suites-page/expand-collapse-button.testplane.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (process.env.TOOL === 'testplane') {
1010
await expandCollapseButton.assertView('button');
1111

1212
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
13-
await expect(tooltip).toHaveText('Collapse tree');
13+
await expect(tooltip).toHaveText(/Collapse tree/);
1414
});
1515

1616
it('should offer to expand when collapsed using button', async ({browser}) => {
@@ -21,7 +21,7 @@ if (process.env.TOOL === 'testplane') {
2121
await expandCollapseButton.assertView('button');
2222

2323
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
24-
await expect(tooltip).toHaveText('Expand tree');
24+
await expect(tooltip).toHaveText(/Expand tree/);
2525
});
2626

2727
it('should offer to expand when collapsed manually', async ({browser}) => {
@@ -42,7 +42,7 @@ if (process.env.TOOL === 'testplane') {
4242
await expandCollapseButton.assertView('button');
4343

4444
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
45-
await expect(tooltip).toHaveText('Expand tree');
45+
await expect(tooltip).toHaveText(/Expand tree/);
4646
});
4747
});
4848

test/func/tests/common/new-ui/suites-page/name-filter.testplane.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ if (process.env.TOOL === 'testplane') {
1111
searchInput = await browser.$('[data-qa="name-filter"] input');
1212
matchCaseButton = await browser.$('[data-qa="match-case"]');
1313
regexButton = await browser.$('[data-qa="regex"]');
14+
15+
await searchInput.waitForClickable();
1416
});
1517

1618
it('usual search', async () => {

test/func/tests/common/new-ui/visual-checks-page/common.testplane.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if (process.env.TOOL === 'testplane') {
8383
await expandCollapseButton.assertView('button');
8484

8585
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
86-
await expect(tooltip).toHaveText('Collapse tree');
86+
await expect(tooltip).toHaveText(/Collapse tree/);
8787
});
8888

8989
it('should offer to expand when collapsed using button', async ({browser}) => {
@@ -94,7 +94,7 @@ if (process.env.TOOL === 'testplane') {
9494
await expandCollapseButton.assertView('button');
9595

9696
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
97-
await expect(tooltip).toHaveText('Expand tree');
97+
await expect(tooltip).toHaveText(/Expand tree/);
9898
});
9999

100100
it('should offer to expand when collapsed manually', async ({browser}) => {
@@ -115,7 +115,7 @@ if (process.env.TOOL === 'testplane') {
115115
await expandCollapseButton.assertView('button');
116116

117117
const tooltip = await browser.$('.gn-composite-bar-item__icon-tooltip');
118-
await expect(tooltip).toHaveText('Expand tree');
118+
await expect(tooltip).toHaveText(/Expand tree/);
119119
});
120120
});
121121

0 commit comments

Comments
 (0)