test: integrate cypress
This commit is contained in:
parent
3a4695bc03
commit
781e25909d
21 changed files with 1396 additions and 39 deletions
41
src/components/misc/theme-picker.cy.tsx
Normal file
41
src/components/misc/theme-picker.cy.tsx
Normal file
|
@ -0,0 +1,41 @@
|
|||
import React from 'react';
|
||||
import { ThemePicker } from '@/components/misc/theme-picker';
|
||||
import { ThemeProvider } from '@/components/wrappers/theme-provider';
|
||||
|
||||
describe('<ThemePicker />', () => {
|
||||
it('renders', () => {
|
||||
cy.mount(<ThemePicker />);
|
||||
});
|
||||
|
||||
it('toggle open and close', () => {
|
||||
cy.mount(<ThemePicker />);
|
||||
cy.getBySel('theme-picker').click();
|
||||
cy.getBySel('theme-picker-content').should('exist');
|
||||
cy.get('html').click();
|
||||
cy.getBySel('theme-picker-content').should('not.exist');
|
||||
});
|
||||
|
||||
it('enable dark mode', () => {
|
||||
cy.mount(
|
||||
<ThemeProvider>
|
||||
<ThemePicker />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
|
||||
cy.getBySel('theme-picker').click();
|
||||
cy.getBySel('dark-theme').click();
|
||||
cy.get('html').should('have.attr', 'data-theme', 'dark');
|
||||
});
|
||||
|
||||
it('enable light mode', () => {
|
||||
cy.mount(
|
||||
<ThemeProvider>
|
||||
<ThemePicker />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
|
||||
cy.getBySel('theme-picker').click();
|
||||
cy.getBySel('light-theme').click();
|
||||
cy.get('html').should('have.attr', 'data-theme', 'light');
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue