Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Apr 30, 2024
1 parent 61a5613 commit c0ee959
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ describe('Differential Functions page', () => {
cy.wait('@getTopNFunctions');
[
{ id: 'overallPerformance', value: '0%' },
{ id: 'annualizedCo2', value: '79.81 lbs / 36.2 kg' },
{ id: 'annualizedCost', value: '$341.05' },
{ id: 'totalNumberOfSamples', value: '17,186' },
{ id: 'annualizedCo2', value: '74.49 lbs / 33.79 kg' },
{ id: 'annualizedCost', value: '$318.32' },
{ id: 'totalNumberOfSamples', value: '513' },
].forEach((item) => {
cy.get(`[data-test-subj="${item.id}_value"]`).contains(item.value);
cy.get(`[data-test-subj="${item.id}_comparison_value"]`).should('not.exist');
Expand All @@ -50,9 +50,9 @@ describe('Differential Functions page', () => {
cy.wait('@getTopNFunctions');
[
{ id: 'overallPerformance', value: '0%' },
{ id: 'annualizedCo2', value: '0 lbs / 0 kg', comparisonValue: '79.81 lbs / 36.2 kg' },
{ id: 'annualizedCost', value: '$0', comparisonValue: '$341.05' },
{ id: 'totalNumberOfSamples', value: '0', comparisonValue: '515,580' },
{ id: 'annualizedCo2', value: '0 lbs / 0 kg', comparisonValue: '74.49 lbs / 33.79 kg' },
{ id: 'annualizedCost', value: '$0', comparisonValue: '$318.32' },
{ id: 'totalNumberOfSamples', value: '0', comparisonValue: '15,390' },
].forEach((item) => {
cy.get(`[data-test-subj="${item.id}_value"]`).contains(item.value);
if (item.comparisonValue) {
Expand All @@ -73,23 +73,23 @@ describe('Differential Functions page', () => {
cy.wait('@getTopNFunctions');
cy.wait('@getTopNFunctions');
[
{ id: 'overallPerformance', value: '78.01%', icon: 'sortUp_success' },
{ id: 'overallPerformance', value: '65.89%', icon: 'sortUp_success' },
{
id: 'annualizedCo2',
value: '9.81 lbs / 36.2 kg',
comparisonValue: '28.23 lbs / 12.81 kg (64.62%)',
value: '74.49 lbs / 33.79 kg',
comparisonValue: '25.41 lbs / 11.53 kg (65.89%)',
icon: 'comparison_sortUp_success',
},
{
id: 'annualizedCost',
value: '$341.05',
comparisonValue: '$120.65 (64.62%)',
value: '$318.32',
comparisonValue: '$108.59 (65.89%)',
icon: 'comparison_sortUp_success',
},
{
id: 'totalNumberOfSamples',
value: '17,186',
comparisonValue: '3,780 (78.01%)',
value: '513',
comparisonValue: '175 (65.89%)',
icon: 'comparison_sortUp_success',
},
].forEach((item) => {
Expand All @@ -113,23 +113,23 @@ describe('Differential Functions page', () => {
cy.wait('@getTopNFunctions');
cy.wait('@getTopNFunctions');
[
{ id: 'overallPerformance', value: '354.66%', icon: 'sortDown_danger' },
{ id: 'overallPerformance', value: '193.14%', icon: 'sortDown_danger' },
{
id: 'annualizedCo2',
value: '28.23 lbs / 12.81 kg',
comparisonValue: '79.81 lbs / 36.2 kg (182.67%)',
value: '25.41 lbs / 11.53 kg',
comparisonValue: '74.49 lbs / 33.79 kg (193.14%)',
icon: 'comparison_sortDown_danger',
},
{
id: 'annualizedCost',
value: '$120.65',
comparisonValue: '$341.05 (182.67%)',
value: '$108.59',
comparisonValue: '$318.32 (193.14%)',
icon: 'comparison_sortDown_danger',
},
{
id: 'totalNumberOfSamples',
value: '3,780',
comparisonValue: '17,186 (354.66%)',
value: '175',
comparisonValue: '513 (193.14%)',
icon: 'comparison_sortDown_danger',
},
].forEach((item) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe('Functions page', () => {
cy.get(firstRowSelector).eq(2).contains('vmlinux');
cy.get(firstRowSelector).eq(3).contains('0.16%');
cy.get(firstRowSelector).eq(4).contains('0.16%');
cy.get(firstRowSelector).eq(5).contains('4.41 lbs / 2 kg');
cy.get(firstRowSelector).eq(6).contains('$18.61');
cy.get(firstRowSelector).eq(5).contains('3.97 lbs / 1.8 kg');
cy.get(firstRowSelector).eq(6).contains('$17.37');
cy.get(firstRowSelector).eq(7).contains('28');
});

Expand All @@ -66,16 +66,16 @@ describe('Functions page', () => {
{ parentKey: 'impactEstimates', key: 'annualizedSelfCoreSeconds', value: '17.03 days' },
{ parentKey: 'impactEstimates', key: 'co2Emission', value: '~0.00 lbs / ~0.00 kg' },
{ parentKey: 'impactEstimates', key: 'selfCo2Emission', value: '~0.00 lbs / ~0.00 kg' },
{ parentKey: 'impactEstimates', key: 'annualizedCo2Emission', value: '4.41 lbs / 2 kg' },
{ parentKey: 'impactEstimates', key: 'annualizedCo2Emission', value: '3.97 lbs / 1.8 kg' },
{
parentKey: 'impactEstimates',
key: 'annualizedSelfCo2Emission',
value: '4.41 lbs / 2 kg',
value: '3.97 lbs / 1.8 kg',
},
{ parentKey: 'impactEstimates', key: 'dollarCost', value: '$~0.00' },
{ parentKey: 'impactEstimates', key: 'selfDollarCost', value: '$~0.00' },
{ parentKey: 'impactEstimates', key: 'annualizedDollarCost', value: '$18.61' },
{ parentKey: 'impactEstimates', key: 'annualizedSelfDollarCost', value: '$18.61' },
{ parentKey: 'impactEstimates', key: 'annualizedDollarCost', value: '$17.37' },
{ parentKey: 'impactEstimates', key: 'annualizedSelfDollarCost', value: '$17.37' },
].forEach(({ parentKey, key, value }) => {
cy.get(`[data-test-subj="${parentKey}_${key}"]`).contains(value);
});
Expand Down Expand Up @@ -134,16 +134,16 @@ describe('Functions page', () => {
columnIndex: 5,
highRank: 693,
lowRank: 44,
highValue: '48.28 lbs / 21.9 kg',
highValue: '44.97 lbs / 20.4 kg',
lowValue: '0 lbs / 0 kg',
},
{
columnKey: 'annualizedDollarCost',
columnIndex: 6,
highRank: 693,
lowRank: 44,
highValue: '$206.09',
lowValue: '$0.66',
highValue: '$192.36',
lowValue: '$0.62',
},
].forEach(({ columnKey, columnIndex, highRank, highValue, lowRank, lowValue }) => {
cy.get(`[data-test-subj="dataGridHeaderCell-${columnKey}"]`).click();
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Functions page', () => {
const firstRowSelector = '[data-grid-row-index="0"] [data-test-subj="dataGridRowCell"]';
cy.get(firstRowSelector).eq(1).contains('1');
cy.get(firstRowSelector).eq(2).contains('vmlinux');
cy.get(firstRowSelector).eq(5).contains('4.41 lbs / 2 kg');
cy.get(firstRowSelector).eq(5).contains('3.97 lbs / 1.8 kg');
cy.contains('Settings').click();
cy.contains('Advanced Settings');
cy.get(`[data-test-subj="management-settings-editField-${profilingCo2PerKWH}"]`)
Expand All @@ -208,7 +208,7 @@ describe('Functions page', () => {
});
cy.go('back');
cy.wait('@getTopNFunctions');
cy.get(firstRowSelector).eq(5).contains('2k lbs / 908.4 kg');
cy.get(firstRowSelector).eq(5).contains('1.87k lbs / 847.8 kg');
const firstRowSelectorActionButton =
'[data-grid-row-index="0"] [data-test-subj="dataGridRowCell"] .euiButtonIcon';
cy.get(firstRowSelectorActionButton).click();
Expand All @@ -218,12 +218,12 @@ describe('Functions page', () => {
{
parentKey: 'impactEstimates',
key: 'annualizedCo2Emission',
value: '2k lbs / 908.4 kg',
value: '1.87k lbs / 847.8 kg',
},
{
parentKey: 'impactEstimates',
key: 'annualizedSelfCo2Emission',
value: '2k lbs / 908.4 kg',
value: '1.87k lbs / 847.8 kg',
},
].forEach(({ parentKey, key, value }) => {
cy.get(`[data-test-subj="${parentKey}_${key}"]`).contains(value);
Expand Down

0 comments on commit c0ee959

Please sign in to comment.