Skip to content

Commit

Permalink
Changing to smaller file
Browse files Browse the repository at this point in the history
  • Loading branch information
gr812b committed Nov 9, 2024
1 parent e34934a commit fb5dafb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion e2e/testers/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class GraphTester extends Tester {
await this.page.waitForTimeout(20000);
await this.openGraphForm();
await this.pressNextButton();
await this.selectFile('endurance/BATT PERC');
await this.selectFile('182848/BATT PERC');
await this.pressNextButton();
await this.submitGraph();
await this.verifyGraphCreated();
Expand Down
27 changes: 26 additions & 1 deletion e2e/testers/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class UploadTester extends Tester {

constructor(page: Page) {
super(page);
this.binFilePath = path.join(__dirname, '../test-files/endurance.bin');
this.binFilePath = path.join(__dirname, '../test-files/182848.bin');
this.csvFilePath = '';
this.mp4FilePath = '';

Expand Down Expand Up @@ -57,4 +57,29 @@ export class UploadTester extends Tester {
await dialog.accept();
});
}

// TODO: Implement this better
async checkFileParsed(filePath: string) {
await this.page.getByRole('button', { name: 'Download' }).click();

let fileUploaded = false;
while (!fileUploaded) {
try {
// Attempt to locate the file cell and check visibility
const fileCell = this.page.getByRole('row', { name: 'endurance 307 MB -' }).getByRole('cell').first();
if (await fileCell.isVisible()) {
fileUploaded = true; // Exit the loop if the file is visible
} else {
throw new Error('File not yet visible'); // Continue to the catch block if not visible
}
} catch (error) {
// Close the modal and wait before re-trying
await this.page.getByRole('button', { name: 'X' }).click();
await this.page.waitForTimeout(1000); // Wait for a short delay before retrying
await this.page.getByRole('button', { name: 'Download' }).click(); // Re-open the modal
}
}

await this.page.getByRole('button', { name: 'X' }).click();
}
}
1 change: 0 additions & 1 deletion front-end/src/components/modal/download/DownloadModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const DownloadModal = ({ setModal }) => {
useEffect(() => {
// Fetch data when the component mounts
ApiUtil.getFolder('csv')
.then((response) => response.json())
.then((data) => {
setFiles(data);
});
Expand Down

0 comments on commit fb5dafb

Please sign in to comment.