Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kabir-Ivan committed Jul 8, 2024
1 parent a9b9148 commit 80bb4e6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/static/components/controls/control-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class ControlButton extends Component<ControlButtonProps> {
onClick={handler}
className={className}
disabled={isDisabled}
data-test-id={dataTestId}
qa={dataTestId?.toString()}
>
{label}
</Button>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const StrictMatchFilterInput = ({strictMatchFilter, actions}) => {
};

return (
<Switch size='m' content="Strict match" checked={checked} onChange={onChange} data-test-id="header-strict-match"/>
<Switch size='m' content="Strict match" checked={checked} onChange={onChange} qa="header-strict-match"/>
);
};

Expand Down
2 changes: 1 addition & 1 deletion lib/static/components/controls/test-name-filter-input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TestNameFilterInput = ({actions, testNameFilter: testNameFilterProp}) => {
value={testNameFilter}
placeholder="Filter by test name or regexp"
onChange={onChange}
data-test-id="header-test-name-filter"
qa="header-test-name-filter"
/>
);
};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions test/func/tests/common-tinder/index.testplane.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Tinder mode', () => {
beforeEach(async ({browser}) => {
const testFullName = await browser.$('span[data-test-id="screenshot-accepter-test-name"]').getText();

const acceptButton = await browser.$('button[data-test-id="screenshot-accepter-accept"]');
const acceptButton = await browser.$('button[data-qa="screenshot-accepter-accept"]');
await acceptButton.click();

await browser.waitUntil(async () => {
Expand All @@ -55,13 +55,13 @@ describe('Tinder mode', () => {
return progress === '1/2';
}, {interval: 100});

const switchAcceptModeButton = await browser.$('button[data-test-id="screenshot-accepter-switch-accept-mode"]');
const switchAcceptModeButton = await browser.$('button[data-qa="screenshot-accepter-switch-accept-mode"]');
await switchAcceptModeButton.click();

const testNameFilterInput = await browser.$('input[data-test-id="header-test-name-filter"]');
const testNameFilterInput = await browser.$('//*[@data-qa="header-test-name-filter"]//input');

await testNameFilterInput.setValue(testFullName);
await browser.$('div[data-test-id="header-strict-match"]').click();
await browser.$('*[data-qa="header-strict-match"]').click();

await waitForFsChanges(screensDir);
});
Expand All @@ -74,7 +74,7 @@ describe('Tinder mode', () => {
});

it('should make the test pass on next run', async ({browser}) => {
const retryButton = await browser.$('button[data-test-id="test-retry"]');
const retryButton = await browser.$('button[data-qa="test-retry"]');

// TODO: find a correct sign to wait for. Issue is that retry button is totally clickable, but doesn't
// work right away after switch accept mode and applying filtering for some reason.
Expand All @@ -93,7 +93,7 @@ describe('Tinder mode', () => {

describe(`undo accepting screenshot`, () => {
it('should leave project files intact', async ({browser}) => {
const acceptButton = await browser.$('button[data-test-id="screenshot-accepter-accept"]');
const acceptButton = await browser.$('button[data-qa="screenshot-accepter-accept"]');
await acceptButton.click();

await browser.waitUntil(async () => {
Expand All @@ -105,7 +105,7 @@ describe('Tinder mode', () => {
await waitForFsChanges(screensDir);
const fsDiffBeforeUndo = getFsDiffFromVcs(screensDir);

const undoButton = await browser.$('button[data-test-id="screenshot-accepter-undo"]');
const undoButton = await browser.$('button[data-qa="screenshot-accepter-undo"]');
await undoButton.click();

await waitForFsChanges(screensDir, (output) => output.length === 0);
Expand All @@ -118,7 +118,7 @@ describe('Tinder mode', () => {
});

it('should show success screen after accepting all screenshots', async ({browser}) => {
const acceptButton = await browser.$('button[data-test-id="screenshot-accepter-accept"]');
const acceptButton = await browser.$('button[data-qa="screenshot-accepter-accept"]');

for (let i = 1; i <= 2; i++) {
await acceptButton.click();
Expand Down
13 changes: 7 additions & 6 deletions test/unit/lib/static/components/controls/browser-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,25 @@ describe('<BrowserList />', () => {
available: [
{id: 'bro'},
{id: 'bro1', versions: ['v1']},
{id: 'bro2', versions: ['v1', 'v2']}
{id: 'bro2', versions: ['v1', 'v2', 'v3']}
],
selected: [
{id: 'bro'},
{id: 'bro1', versions: ['v1']},
{id: 'bro2', versions: ['v1']}
{id: 'bro2', versions: ['v1', 'v2', 'v3']}
],
onChange: sandbox.spy()
};
const component = mount(<ThemeProvider theme='light'><BrowserList {...props} /></ThemeProvider>);

component.first().find('.g-select-control__button').simulate('click');
component.first().find('.g-select-list__item').first().simulate('click');
component.first().find('.g-popup .g-select-list__option').last().simulate('click');

assert.equal(props.onChange.callCount, 1);
assert.deepEqual(props.onChange.firstCall.lastArg, [
assert.equal(props.onChange.callCount, 2);
assert.deepEqual(props.onChange.lastCall.lastArg, [
{id: 'bro', versions: []},
{id: 'bro1', versions: ['v1']}
{id: 'bro1', versions: ['v1']},
{id: 'bro2', versions: ['v1', 'v2']}
]);
});
});

0 comments on commit 80bb4e6

Please sign in to comment.