Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

upgrade cypress, toggle theme test, changed cypress config #85

Merged
merged 6 commits into from
Feb 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
upgrade cypress, toggle theme test, changed cypress config
  • Loading branch information
sang2925 committed Feb 27, 2023
commit b9268e842c44fbea9f69c7dedab2d603168676eb
1 change: 1 addition & 0 deletions applications/client/src/components/Forms/SettingsForm.tsx
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ export const SettingsForm = observer<SettingsFormProps>(({ ...props }) => {
label="Show Hidden Beacons, Host, and Servers"
/>
<Switch // Uncomment to test light theme
cy-test="toggle-theme"
checked={store.settings.theme === 'light'}
onChange={(event) => store.settings.setTheme(event.currentTarget.checked ? 'light' : 'dark')}
label="Light Theme (beta)"
4 changes: 2 additions & 2 deletions applications/redeye-e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@ module.exports = defineConfig({
},
});
},
specPattern: '../../**/*.cy.js',
supportFile: './src/support/index.js',
specPattern: '**/**/e2e/**/*.cy.js',
supportFile: '**/**/src/support/e2e.js',
excludeSpecPattern: '*.skip.js',
defaultCommandTimeout: 15000,
},
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference types="cypress" />

describe('Light Theme Test', () => {
const camp = 'togglethemes';
const fileName = 'gt.redeye';

it('Toggle Themes From Campaign', () => {
cy.uploadCampaignBlue(camp, fileName);

cy.selectCampaign(camp);

cy.toggleLightTheme();

cy.get('[cy-test=graph]').should('have.css', 'color-scheme', 'light');

cy.toggleDarkTheme();

cy.get('[cy-test=graph]').should('have.css', 'color-scheme', 'dark');
});

it('Toggle Themes From Explorer Card', () => {
cy.toggleLightTheme();

cy.get('#root').should('have.css', 'color-scheme', 'light');

cy.toggleDarkTheme();

cy.get('#root').should('have.css', 'color-scheme', 'dark');
});

after(() => {
cy.deleteCampaignGraphQL(camp);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference types="cypress" />

describe('Light Theme Test', () => {
const camp = 'togglethemes';
const fileName = 'gt.redeye';

it('Toggle Themes From Campaign', () => {
cy.uploadCampaign(camp, fileName);

cy.selectCampaign(camp);

cy.toggleLightTheme();

cy.get('[cy-test=graph]').should('have.css', 'color-scheme', 'light');

cy.toggleDarkTheme();

cy.get('[cy-test=graph]').should('have.css', 'color-scheme', 'dark');
});

it('Toggle Themes From Explorer Card', () => {
cy.toggleLightTheme();

cy.get('#root').should('have.css', 'color-scheme', 'light');

cy.toggleDarkTheme();

cy.get('#root').should('have.css', 'color-scheme', 'dark');
});

after(() => {
cy.deleteCampaignGraphQL(camp);
});
});
2 changes: 2 additions & 0 deletions applications/redeye-e2e/src/support/command.d.ts
Original file line number Diff line number Diff line change
@@ -282,5 +282,7 @@ declare namespace Cypress {
* cy.verifyTotalCommands(expectedCount)
*/
verifyTotalCommands();

toggleLightTheme();
}
}
12 changes: 12 additions & 0 deletions applications/redeye-e2e/src/support/commands.js
Original file line number Diff line number Diff line change
@@ -263,3 +263,15 @@ Cypress.Commands.add('doNotShowHiddenItems', () => {
// cy.wait('@servers');
cy.get('[cy-test=close-log]').click();
});

Cypress.Commands.add('toggleLightTheme', () => {
cy.get('[cy-test=settings]').click();
cy.get('[cy-test=toggle-theme]').check({ force: true });
cy.get('[cy-test=close-log]').click();
});

Cypress.Commands.add('toggleDarkTheme', () => {
cy.get('[cy-test=settings]').click();
cy.get('[cy-test=toggle-theme]').uncheck({ force: true });
cy.get('[cy-test=close-log]').click();
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@
"barrelsby": "^2.3.0",
"builder-util": "^23.0.2",
"cross-env": "^7.0.3",
"cypress": "^12.5.1",
"cypress": "^12.7.0",
"cypress-multi-reporters": "^1.6.1",
"dotenv": "^8.2.0",
"eslint": "^8.22.0",
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -8325,9 +8325,9 @@ __metadata:
languageName: node
linkType: hard

"cypress@npm:^12.5.1":
version: 12.5.1
resolution: "cypress@npm:12.5.1"
"cypress@npm:^12.7.0":
version: 12.7.0
resolution: "cypress@npm:12.7.0"
dependencies:
"@cypress/request": ^2.88.10
"@cypress/xvfb": ^1.2.4
@@ -8346,7 +8346,7 @@ __metadata:
commander: ^5.1.0
common-tags: ^1.8.0
dayjs: ^1.10.4
debug: ^4.3.2
debug: ^4.3.4
enquirer: ^2.3.6
eventemitter2: 6.4.7
execa: 4.1.0
@@ -8373,7 +8373,7 @@ __metadata:
yauzl: ^2.10.0
bin:
cypress: bin/cypress
checksum: acea08c933084bbdffe8e0d8f24ecdc3be52731824f09cf2e720c974a153d808f5af1c665d977e46f171e275c590065aeadf729022d1338a6a424e5ec8b119af
checksum: a9489f7f254dcee1b8a374d14d175c8f8681a3388e4c02181e0486f064f4de59bfc79dec1f401605332d3a5869bf2ba06b3a1653a5c287e447810d756d470078
languageName: node
linkType: hard

@@ -17056,7 +17056,7 @@ __metadata:
cors: ^2.8.5
cross-env: ^7.0.3
crypto-js: ^4.0.0
cypress: ^12.5.1
cypress: ^12.7.0
cypress-multi-reporters: ^1.6.1
d3: ^6.7.0
dayjs: ^1.11.7