Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
ffa1252e
Unverified
Commit
ffa1252e
authored
3 years ago
by
Nemanja Glumac
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
#18219 Repro: Temporal breakout fields are not formatted in export (#18436)
parent
bf25f105
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/test/metabase/scenarios/downloads/reproductions/18219-temporal-units-not-formatted.cy.spec.js
+83
-0
83 additions, 0 deletions
...productions/18219-temporal-units-not-formatted.cy.spec.js
with
83 additions
and
0 deletions
frontend/test/metabase/scenarios/downloads/reproductions/18219-temporal-units-not-formatted.cy.spec.js
0 → 100644
+
83
−
0
View file @
ffa1252e
import
{
restore
}
from
"
__support__/e2e/cypress
"
;
import
{
SAMPLE_DATASET
}
from
"
__support__/e2e/cypress_sample_dataset
"
;
const
xlsx
=
require
(
"
xlsx
"
);
const
{
ORDERS
,
ORDERS_ID
}
=
SAMPLE_DATASET
;
const
questionDetails
=
{
name
:
"
18219
"
,
query
:
{
"
source-table
"
:
ORDERS_ID
,
aggregation
:
[[
"
count
"
]],
breakout
:
[[
"
field
"
,
ORDERS
.
CREATED_AT
,
{
"
temporal-unit
"
:
"
year
"
}]],
},
};
const
testCases
=
[
{
type
:
"
csv
"
,
sheetName
:
"
Sheet1
"
},
{
type
:
"
xlsx
"
,
sheetName
:
"
Query result
"
},
];
describe
.
skip
(
"
issue 18219
"
,
()
=>
{
beforeEach
(()
=>
{
restore
();
cy
.
signInAsAdmin
();
});
it
(
"
should format temporal units on export (metabase#18219)
"
,
()
=>
{
cy
.
createQuestion
(
questionDetails
).
then
(({
body
:
{
id
}
})
=>
{
cy
.
intercept
(
"
POST
"
,
`/api/card/
${
id
}
/query`
).
as
(
"
cardQuery
"
);
cy
.
visit
(
`/question/
${
id
}
`
);
// Wait for `result_metadata` to load
cy
.
wait
(
"
@cardQuery
"
);
cy
.
findByText
(
"
Created At: Year
"
);
cy
.
findByText
(
"
2016
"
);
cy
.
findByText
(
"
744
"
);
cy
.
icon
(
"
download
"
).
click
();
cy
.
wrap
(
testCases
).
each
(({
type
,
sheetName
})
=>
{
cy
.
log
(
`downloading a
${
type
}
file`
);
const
endpoint
=
`/api/card/
${
id
}
/query/
${
type
}
`
;
cy
.
request
({
url
:
endpoint
,
method
:
"
POST
"
,
encoding
:
"
binary
"
,
}).
then
(
resp
=>
{
const
workbook
=
xlsx
.
read
(
resp
.
body
,
{
type
:
"
binary
"
,
raw
:
true
,
});
const
A1
=
workbook
.
Sheets
[
sheetName
][
"
A1
"
];
const
A2
=
workbook
.
Sheets
[
sheetName
][
"
A2
"
];
expect
(
A1
.
v
).
to
.
eq
(
"
Created At: Year
"
);
if
(
type
===
"
csv
"
)
{
expect
(
A2
.
v
).
to
.
eq
(
"
2016
"
);
}
if
(
type
===
"
xlsx
"
)
{
/**
* Depending on how we end up solving this issue,
* the following assertion on the cell type might not be correct.
* It's very likely we'll format temporal breakouts as strings.
* I.e. we have to take into account Q1, Q2, etc.
*/
// expect(A2.t).to.eq("n");
/**
* Because of the excel date format, we cannot assert on the raw value `v`.
* Rather, we have to do it on the parsed value `w`.
*/
expect
(
A2
.
w
).
to
.
eq
(
"
2016
"
);
}
});
});
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment